New Developer Samples Added

If you click on the Samples tab you will find 3 new developer samples that illustrate key capabilities of the Mobile SDK that you have been asking us about:

Live Traffic Sample for Windows Mobile 5 Pocket PC – this sample demonstrates how you can consume a real time feed and display its content on top of your map data using a custom layer.

ESRI Construction Sample for Windows Mobile 5 Pocket PC – this sample illustrates how to use the sketch component to create new features and update the attributes of existing features and synchronize those updates with a map service.

Working With Related Tables – this sample demonstrates how you can edit related tables on a Pocket PC device using ADO.NET and a GeoData web service.

 In addition, if you use the Map Cache Extractor sample, you should download the most recent version as we have made significant updates to it. Improvements include implementing a quad-tree algorithm for caching feature layers so that you do not run into server time-outs when caching large volumes of data, and support for raster caching as well. 

Posted in Developer, Mobile | Tagged , , , | Leave a comment

Debugging Custom Tasks with Visual Studio

(Submitted by Rob Dunfey, ArcGIS Explorer Dev Team)

When designing the ArcGIS Explorer API, above all we wanted to make it as simple and easy to use as possible, so people with no development experience would be able to develop their own custom tasks. If this is the first time you have developed using Visual Studio, here are some steps that will help you debug your Explorer custom task.

  • Build your custom task.
  • Open ArcGIS Explorer and add your custom task to the map.
  • Save your new map.
  • Open the Tools > Options dialog, and set the application to “Open the last saved map” when ArcGIS Explorer starts, then close ArcGIS Explorer.
  • Inside your custom task Visual Studio solution, open your project properties dialog. This can be done from the project menu.
  • On the debug tab you will notice a start action to “Start an external program.” Check this radio button and use the browse button to select the path of the ArcGIS Explorer excutable (E2.exe). It will similar to:

    C:Program FilesArcGIS ExplorerBinE2.exe

  • Now click the Run button to start debugging, or press F5. Explorer will start, and open with the last saved map that references your custom task. You can now run your task and step through it using the Visual Studio debugger.
Posted in Uncategorized | Tagged , , , , | Leave a comment

Symbolizing PLSS lines with the Cut Curve geometric effect

By Aileen Buckley, Mapping Center Lead

In the United States, the Public Land Survey System (PLSS) is a way of subdividing land. The USGS topographic map symbols for displaying PLSS data are an excellent way to symbolize PLSS data on not only topographic maps, but because the topographic symbols are  so well recognized, the same symbols can be used on many other kinds of maps. In the image to the left, the “plus” marker symbol shows where a found corner is located, however, if no corner has been found, then no marker should be shown, leaving a gap that signifies the doubtful location of the corner. Next we will describe how to use cartographic representations to symbolize township, range, or section lines to leave a gap at the corners, allowing corners to be added (as point features) or gaps to be shown. Continue reading

Posted in Mapping | Tagged , , , | Leave a comment

Security techniques for .NET Web ADF applications

In this post, Bryan Baker describes a new security sample he contributed to EDN:

A new developer sample that demonstrates security techniques for the Web ADF is available at the ESRI Developer Network. This sample will also be available as part of the installed software developer kit (SDK) samples with the next service pack of ArcGIS Server.

This sample shows some ways to restrict access to GIS resources and functionality based on the user’s login. While access may be restricted in a variety of ways, the sample takes this approach:

  • All users must log in before they can access the web application. Users are redirected to a login page to log in.
  • Once logged in, users see the main website page with map, table of contents, etc. This sample uses a simple set of web controls rather than the full Web Mapping Application template, but the same techniques could be applied to the template.
  • Content varies depending on the role (group) in which the user is a member. This sample has a Managers role. Users in this role see all content added to the web application. If the user is not in this role, the following content is hidden:
    • A map layer (highways) is hidden and its entry is removed from the table of contents.
    • An item is removed from the toolbar. This item is a command that displays information about map layers and fields.
    • Two query tasks are removed from the page.
  • ASP.NET controls are used to display the user’s login name, and to display hyperlinks to log out, to change the user’s password, and to create a new account from the login page.

The upcoming version 9.3 of ArcGIS Server will feature out-of-the-box security in ArcGIS Server Manager. Those features will enable you to require users to log in to access services or web applications. However, those will not include the ability to restrict access to specific functionality and layers within a web application, based on the identity of the user. So the techniques in this sample will be relevant for both 9.2 and 9.3.

The introduction page to the sample at EDN contains more information on the sample. Standard ASP.NET techniques provided the functionality for all of the security aspects of the sample. Note that this sample is limited to restrict content to authorized users. It does not cover other aspects of security, such as encrypting traffic between user and server using secure sockets layer (SSL, using HTTPS), or checking user input for invalid values. Many websites have information about these other important aspects of securing web applications.

Some details on the sample

For those of you who might be interested, read on for some discussion of how security is implemented in this sample. First we cover how we require all users to log in in order to access the site. Then we’ll see how resources and functionality differ depending on who the user is.

Require users to log in 

We require all users to log in in order to access the application. We could set this up manually in code, but a built-in tool makes it easier: the Web Site Administration Tool (WSAT). This ASP.NET tool is available from Visual Studio (or Visual Web Developer Express). After we open the website for which we want to set security, we can open WSAT from Visual Studio’s Website menu. This web-based administrative tool allows us to set up and manage security for our web application.

In the main WSAT menu, we choose Security. WSAT Security option WSAT displays two options for access: from the Internet and from a local network. These translate into where the users are stored. The local-network option means users are Windows users on the local server or on the domain. This option also typically means that users visiting the site will be prompted for their login by a pop-up dialog in the browser. While the local-network option is the default when creating a new ASP.NET web application, most websites use the second option (“from the Internet”), which means users are stored in a database or other external location. This way we can provide the typical web page form that users fill out to log in. Behind the scenes, this choice sets an authentication element in the web.config file of the website:

<authentication mode="Forms" />

Also behind the scenes, setting the authentication type sets up a database within our web application. By default, WSAT creates a SQL Server Express database within the App_Data folder of our website. This database is specific to this web application. It is possible to use a database outside the web application, including a database in the full SQL Server or another database. See documentation or websites on ASP.NET for information. For our sample, we use the default application-level database.

Once we choose our authentication type, we see the web page that allows us to manage the access security for our site. WSAT access management We will not go through the steps individually here, but we used this page to create our users, enable roles, add roles, and assign users to roles. Roles allow us to manage security without adding or removing users individually to access rules when people enter or leave the organization or change positions within the organization. All these users and roles are stored in our SQL Server Express database.

Finally in WSAT, we create access rules for our website. These rules determine who can access our website. We used a simple rule: anyone can obtain access to the website as long as they have a user account. All we need to do is to prevent access by anonymous users. We do that by clicking the Create access rules hyperlink, and in the add-access-rule page, we select Anonymous users, ensure that “Deny” is selected, and click OK.

Again behind the scenes, this adds an authorization element to the web.config file of the web application:

   <deny users="?" />

This element instructs the application to not allow anonymous users (indicated by the “?”) to access the website.

Now our application will require users to log in, and it will get their login from a form. We just need to provide the form for logging in. Fortunately, ASP.NET 2.0 (and above) makes this easy. We just create a new page within the website and name it login.aspx. By default, ASP.NET will look for this page and use it. In Visual Studio, we drag a Login web control onto this login.aspx page, and save it. That’s all that’s required to create a login page, though we added a few touches to ours, as you can see if you download the sample.

Display content based on user role

Now that users are logged in, we display different content depending on their roles. The approach in this sample is to add all functionality and content at design time in Visual Studio, and then remove items with runtime code where appropriate. We could also add new functionality for particular users at runtime, but the sample does not show that option.

In our server-side code, we can get information about the user and modify page content. In the sample, this happens in the Page_PreRenderComplete method. The code to check the user’s role is simple:

private string fullyEnabledRole = "Managers";

if (!User.IsInRole(fullyEnabledRole))
  // modify page content for role

The User object tells us the user name and also whether the user is a member of a particular role. In this case, we check whether the user is in the Managers role. If not, we insert code to modify the page content. In the sample, we have three methods (Subs) that are called within the if statement shown above:

  • HideLayer() – hides a specific map layer in the Map and Toc (table of contents) controls
  • RemoveItemFromToolbar() – removes a specific item from a toolbar
  • RemoveTask() – removes a task from the TaskManager and associated Menu

Finally, we added one other example of setting content based on role. Rather than using code, we used the ASP.NET LoginView control. This control allows you to easily show or hide content based on whether the user is logged in, or if the user is in a particular role. To set up the LoginView control in Visual Studio, you select the view where you want to show some content, and drag the content into the LoginView control. In our case, we created a “RoleGroup” for Managers using the “smart tag” on the LoginView control. Then we dragged a QueryAttributes task into the control. This way, ASP.NET automatically displays the task when someone in Managers is logged in, and hides it from everyone else. The only down side of the LoginView control is that you cannot use it with the TaskManager/Menu option as in the standard Web Mapping Application template. For that case you must use the approach as we did in the RemoveTask() method discussed above.

We hope this sample shows that it is possible, and for some items relatively easy, to add security to your web application. You can secure the entire website, so that all users must log in for any access. You can also secure specific aspects of your application, such as map layers or tasks, based on the user’s role.

Posted in Services | Tagged , , , | 2 Comments

How to get consistent quality of vectors when exporting to AI format

By Michael Law, Esri Product Engineer


Exporting to an external graphics package like Adobe Illustrator or Macromedia Freehand from the ArcMap environment can have its challenges. One positive aspect of exporting is the ability to make certain that CMYK values are retained for proper print color reproduction. Some of the challenges you may face after export are inconsistent vector line widths, irregular polygon shapes, and something our programmers call polygon dicing. Continue reading

Posted in Mapping | Tagged , | 3 Comments

Adding spatial reference systems to a WMS service's capabilities file

Yingqi Tang, a product engineer specializing in ArcGIS Server and OGC services, contributed the following post:

In ArcGIS Server 9.2 you can publish a map document as an OGC WMS service. All WMS services advertise the spatial reference systems they support through capabilities files. WMS clients read the capabilities file to find out which spatial reference systems they can use to request a map.

The WMS services you create with ArcGIS Server support hundreds of spatial reference systems, but only two are advertised in the capabilities file: EPSG 4326 (required by every WMS service) and the spatial reference of the data frame from which you published the service. Although you can request a map from the WMS service using any of the hundreds of supported spatial reference systems, some WMS clients will return an error if the spatial reference you request does not appear in the capabilities file. Other clients, such as ArcMap, only allow you to switch among the spatial reference systems listed in the capabilities file.

This post shows how to add more spatial reference systems to the capabilities file of a WMS service that you have published with ArcGIS Server. To do this, you publish the WMS service using an external capabilities file. You can then manually add spatial reference systems to this file. This procedure is mentioned in the ArcGIS Server 9.2 documentation as one reason to use external WMS capabilities files.

Assume that you have a map document whose data frame’s spatial reference system is “World_Fuller (EPSG:54050)”. So by default the WMS service being published on that map document will only support spatial reference system EPSG:4326 and EPSG:54050. Now let’s add one additional spatial reference system “World_Aitoff (EPSG:54043)” into this WMS service by following detailed steps below.

  1. Publish the map document as a WMS service using system generated capabilities
    files. Use a system generated capabilities file as a template when creating an
    external WMS capabilities file. To use system generated capabilities files,
    select the option “Enter service properties below” in the WMS capabilities page
    in the Service Properties.

    Publishing with system generated capabilities files

  2. Assume you named your map service “world”, so the WMS service URL for “world”
    will be something like
    “http://<host>:port/arcgis/services/world/MapServer/WMSServer?”. Start a
    browser and type
    Save the response as an XML file called “capabilities111.xml”.

  3. Copy “capabilities111.xml” to a place on your file system and make it
    accessible as a URL. As an example, “capabilities111.xml” can be copied to
    “C:InetpubwwwrootArcGISWmsworld” (assuming you are using ArcGIS Server for
    the Microsoft .NET Framework and you have created the folder “world” yourself).
    So now the file can be accessible as URL
    “http://<host>/arcgis/wms/world/capabilities111.xml”. Before you keep
    going, start a browser and type in this URL to make sure the file is
  4. Stop the map service you just published in step 1. Go to the WMS capabilities
    page of the map service properties panel.

    Switch to use the second option “Use external capabilities files” to publish
    this WMS service. Type in the URL of the folder where you put
    “capabilities111.xml” plus the prefix of file “capabilities” in the “Specify
    the location and prefix” input box. (So in this example you would type
    “http://<host>/arcgis/wms/world/capabilities”) The reason why only the
    URL of folder and file prefix are required is to allow you to create external
    capabilities files for other versions of WMS (1.0.0, 1.1.0, 1.3.0). Click “OK”
    and restart the map service “world”.

    Publishing with external capabilities files

  5. Before you keep going,
    make a connection in ArcCatalog
    to the WMS service you just republished
    in step 4. The URL of your service is “http://<server name>/<instance
    name>/services/<folder name (if applicable)>/<service
    name>/MapServer/WMSServer?”. Preview the WMS service and make sure it’s
    working properly.

  6. Now you can add spatial reference systems to your WMS service. Make a copy of
    your map document and open the copy in ArcMap. Change the data frame’s
    coordinate system to “World_Aitoff (EPSG:54043)”, which is the one we want to
    add, and save the map document.

    World Aitoff projection in ArcMap

  7. Zoom to the full extent of the map. Right click the data frame and click
    Properties > Data Frame. Write down the extent values of current map (see
    the values in Extent > Fixed Extent).

    Getting the extent of the map

  8. Open “capabilities111.xml” which you saved in step 3 in a text editor. Search
    for the root “<Layer>” element (There will be only root <Layer>
    element in the xml).

    Add “<SRS>EPSG:54043</SRS>” right after
    “<SRS>EPSG:4326</SRS>” and “<SRS>EPSG:54050</SRS>”.

    How can you get the EPSG code for the spatial reference you want to add? One way
    is to look it up here in the
    Coordinate IDs and Descriptions book.

    Now add “<BoundingBox SRS=”54043″ minx=”-22041257.7736507″
    miny=”-17284666.2314989″ maxx=”22041257.7724258″ maxy=”17222309.5138405″/>”
    right after “<BoundingBox SRS=”54050″ . . .>” Substitute your own minx,
    miny, maxx, and maxy values that you wrote down.

    Original XML file:

    XML before change

    XML after adding new spatial reference system “EPSG:54043″ and its “BoundingBox” for root

    XML after change

  9. For each layer of the map document, do the following things in order to figure
    out the layer’s extent: (1) Right-click the data frame and go to Properties
    > Data Frame. (2) Select “Other” in “Extent used by Full extent command” and
    click “Specify”; (3) Select “Outline of the Feature”, and pick the layer. (4)
    Apply the change and return to the map document. (5) Click Full Extent. (6) Go
    back to Properties > Data Frame and note the extent of the layer.

    Resetting Full Extent

  10. In “capabilities111.xml”, search for each <Layer> element according to
    its name and tile. For each layer add “<SRS>EPSG:54043</SRS>” right
    after “<SRS>EPSG:4326</SRS>” and
    “<SRS>EPSG:54050</SRS>”; Add “<BoundingBox SRS=”54043″ minx=”"
    miny=”" maxx=”" maxy=”"/>” right after “<BoundingBox SRS=”54050″……>”
    (you need to fill in minx, miny, maxx and maxy values with what you got in step

    Final XML

  11. Save “capabilities111.xml” and restart the map service.

  12. You’ve successfully added a spatial reference system to your WMS service. To
    prove it, connect to the WMS service in ArcCatalog and view the layer’s
    properties. “EPSG:54043″ should be listed as a “Supported SRS”.

    Supported spatial reference systems

  13. Add the WMS service in ArcMap. In the table of contents, right-click the service and click Change Coordinate System. Notice that World Aitoff is now a supported spatial reference system. You can use this dialog to switch among the supported spatial reference systems.

    Viewing spatial reference systems in ArcMap

Posted in Services | Tagged , | 3 Comments

Creating dash-dot symbols for polygon outlines

By Charlie Frye, Esri Chief Cartographer

Example of a dash-dot line symbol used on boundary lines

Dash-dot line symbols for polygon outlines should be displayed in a way that consistently shows the pattern of dashes and dots and clearly shows the shape of the polygon. In ArcGIS, a multi-layer line symbol is required. One layer is a cartographic line symbol with a dash pattern.  The second is a marker line symbol that shows a marker (the dot) with a complementary pattern to the dashes. Continue reading

Posted in Mapping | Tagged , , | 4 Comments

Using feature weight rankings to avoid placing labels on major streets

By Charlie Frye, Esri Chief Cartographer

Labeling toolbar with Label Weights button circled.

Notice in the first graphic below that the labels for “CAJON ST” and “CLIFTON CT” are placed over of major streets in a way that makes them difficult to read. This graphic is derived from my recent blog entry on the Maplex Street Placement option, and I was using the Street Placement option, but that left me with this problem. Well, this happened because I didn’t tell the Maplex Label Engine to treat the major streets differently. Continue reading

Posted in Mapping | Tagged , | Leave a comment

Explorer for Public Works

video featuring ArcGIS Explorer in a public works context has been published at ESRI’s GIS for Public Works Seminar site. The video demonstrates the use of Explorer for increasing operational awareness and for workforce management. The segment shows the integration of real-time weather,  asset locations, and network analysis of utility shut-off and affected customers.


Posted in Uncategorized | Tagged , , | Leave a comment

Tips for exporting to Adobe Illustrator format (AI) so CYMK colors are maintained

By Michael Law, Esri Product Engineer

Color Selector showing the menu that is shown be black triangle button.

For many GIS users and cartographers, the use of external graphics software is a common step in his or her workflow and production of print quality maps. One of ArcMap’s more popular export formats is the Adobe Illustrator (AI) export because of its wide compatibility with a number of graphics software packages. This export format was first made available in ArcGIS 8.1 Service Pack 1 and has been popular ever since. The ArcMap AI exporter has been fully tested to work in Adobe Illustrator CS and CS2. It is currently being tested in CS3 with good initial results. Continue reading

Posted in Mapping | Tagged , , | 12 Comments