Monthly Archives: May 2007
Welcome to the ArcGIS Explorer Blog, your “source from the source” about ArcGIS Explorer and related topics.
Just as the world around us is rapidly changing, so is the landscape of geographic information systems and mapping. We’re here to keep you up-to-date on what’s possible now, what’s in the works, and where we’re headed in the future.
We hope this blog will serve you well and that you’ll feel welcome to comment and provide feedback. We’re looking forward to your ideas and learning more about how you are using ArcGIS Explorer.
If you’re planning on coming to the ESRI User Conference in San Diego this June, you’ll find us in the ESRI Showcase area. You may also want to attend one of our ArcGIS Explorer sessions. To find those sessions and add them to your planner, just visit the Agenda/Planner and search for “ArcGIS Explorer.”
The ArcGIS Explorer Team
One purpose of this blog is to share some of the things we’ve learned about our software by using it ourselves. The ArcGIS Online project uses the ArcGIS Server map and globe caching technology. In this post, we share a technique we’ve developed to create 3D caches for ArcGIS Online.
For performance and appearance benefits, many of the 3D globe caches on ArcGIS Online were created originally from 2D fused map caches. These 2D caches were overlaid on the globe and cached to make globe tiles. This technique improves the performance of the globe service because it yields only one cached layer. It also improves the appearance of the service because anti-aliasing effects in the 2D cache transfer to the 3D cache. This post lists the steps that you can follow to create a 3D cache from a 2D cache.
The instructions in this post are written for intermediate to advanced ArcGIS Server users. Before attempting this technique, it’s helpful to have some previous experience publishing ArcGIS Server services, creating map caches, and connecting to GIS services in ArcGlobe.
Create the 2D map cache
The first step in this process is to create the 2D cached map service. Start by using ArcMap to create an attractive map document that is designed for display at some pre-determined scale levels. You’ll need to select the scale levels you want cached and then apply the appropriate symbology for each scale level. You can find tips for this process in Planning a map cache.
Below is a list of scale levels used by ArcGIS Online 2D caches. These scale levels translate well to the fixed scale levels used by ArcGIS Explorer and ArcGlobe, and are strongly recommended if you plan on eventually creating a 3D cache from your 2D cache. The high-precision values of the scales prevent tiles from overlapping at the edge of the globe near the International Date Line. If your map does not have worldwide coverage, you do not have to enter all of the decimal places for these numbers, but it’s recommended that you stay close to these numbers for the best visual effects. You do not have to use all of the scales; you can use a sequential subset of them.
Recommended scales for your 2D cache
- 147748799.285417 (To clarify, this corresponds to approximately 1:147,748,799 scale)
- 73874399.6427087 (This corresponds to approximately 1:73,874,299)
- 36937199.8213544 (Etc.)
Once you’ve finished designing and creating your map document, you should publish it as an ArcGIS Server map service and create a map cache. If using the above values, you can copy and paste them directly into the Generate Map Server Cache tool. This post does not focus on the details of publishing the 2D service and generating the cache, but ample instructions are available in the ArcGIS Server Help.
Configure a custom error for missing tiles
A previous post on this blog explained how you can configure your web server to return a blank or “No data available” image in areas where a client cannot find a cache tile. This is an important step when you’re generating a 3D cache from a 2D cache because the tile edges may not always line up between the two types of caches. The 3D cache generating process will perform better with a blank or “No data available” tile than it will when no tile is found. Follow the steps at this link to configure your web server to return the blank tile: Configuring your server to display a “Data not available” tile for empty map cache areas.
Create a globe document from the 2D service
Now that you have a 2D map service running, you can add it to an ArcGlobe document. The service will be draped over the globe in 3D. Follow these steps to create and appropriately configure the document:
- Start ArcGlobe
Tip: If you’re using ArcGlobe in a remote desktop session, you may get better performance by resizing the application window to eliminate the globe portion of the display. You don’t need to see the globe during these steps.
- Remove the default layers named Continents and World Image.
- Click Tools > Options and click the Cache tab.
- Set the Cache path to be the same as the server cache directory where you want your globe cache to be created, with “GlobeCache” appended to the end (Example: \myServercacheGlobeCache) This is an application-level property, so you may want to make note of the original cache path and set this value back the next time you use ArcGlobe.
- Click OK to dismiss the options dialog, then click the Add Data button.
- Add the 2D map service that you created in the previous steps. Be sure to use an Internet connection to ArcGIS Server (not a local connection). ArcGlobe can display the 2D service draped over the globe.
- Right-click the map service layer and select Properties.
- In the Globe General tab, modify the Layer Name and Description as you like.
- Click the Cache tab
- If you’re creating a base map layer, such as satellite imagery or a street map, check “Use lossy spatial compression”. If you’re creating a transparent reference layer, such as boundaries or a road network, this compression is not necessary.
- If you are using the recommended ArcGIS Online scale levels listed above, change the minimum cell size to twice the calculated value. Leaving this unchanged will cause your cache to grow larger than necessary.
- Click OK to dismiss the dialog.
- Save the globe document and close ArcGlobe.
Create a globe service
Now you need to publish a globe service using the globe document you created in the steps above. You can create the service in ArcCatalog or Manager. Be sure to set the service properties to reference the appropriate cache directory (It’s not necessary to append “GlobeCache” to the name this time.)
The globe service you create should be pooled, with 2 – 4 instances per server object container (SOC) that will be employed in the cache-building process. You may need to adjust this number depending on memory and CPU constraints you observe during the caching process.
Note about number of service instances: The map service that you created earlier only needs to have about ¼ the number of instances that your globe service has at this point. This is because you’ve cached the map service already, so requests for its tiles can be generally satisfied by the virtual cache directory, without making a request to the GIS server. The globe service is going to need a lot of instances while caching. After the cache is generated you can reduce the number of globe service instances.
Generate a globe cache
Once the globe service is started, you can begin generating the cache. You must do this step in ArcCatalog. In the Caching tab of the globe service properties, you’ll find two options for generating the cache. The Generate button creates a cache for the entire globe service, while the Update option only caches an extent that you provide.
As you set the parameters for the caching tools, you’ll need to select the levels of detail that the cache will be created at. Set the From level to “Globe – 1:10000000″ even if your service does not have global coverage. This will not generate an unreasonably large cache because tiles that are outside the service extent will just be skipped by the cache generation process.
When selecting the To level of detail, use the table below which associates each ArcGIS Online scale level with the appropriate To level of detail you should use for your globe cache. For example, if your map cache’s closest scale level is 72142.968… choose “City – 1:9765″ from the To Level of Detail dropdown in the Generate Globe Server Cache tool. Ignore the scale given in the dropdown (in this example 1:9765).
|Scale level||Globe cache “To” level of detail|
When you’ve set all of the parameters for the caching tools, click OK and let the cache generation process do its work. When it completes, you’ll have a set of globe tiles that look like the tiles in your 2D map cache.
Create a disconnected service (optional)
At this point, you could leave your globe service running and users would see the new cache tiles. However, your map service would always need to be running in order for your globe service to start correctly. To avoid this dependence on the map service, you can do the following to create a disconnected globe service:
- Stop the globe service you created previously.
- Open ArcGlobe and create a new globe document.
- Remove the default layers named Continents and World Image.
- Click the Add Data button.
- Browse to the folder on disk that contains the globe cache you just created. This involves browsing to your server cache directory, opening the GlobeCache folder, and finding the folder that represents your new globe cache. (Tip: The folder name will probably contain a representation of the URL of your 2D service, for example: ESRI_ServerLyrLocalGlobeCache_http___myserver_arcgis_services_world_mapserver_Layers_world.)
- Inside the globe cache’s folder, you’ll see a file named cache.lyr. Add cache.lyr to your map.
- Save the globe document and close ArcGlobe.
- Use ArcGIS Server to publish the globe document as a globe service. You’ve created a disconnected globe service.
(Note: Creating a 3D cache from a 2D cache using the method described above adds temporary local cache files that can add up to cumbersome sizes during long caching jobs. If this occurs you can use the operating system tools to schedule a task that deletes the local cache periodically, such as every 10 minutes. The local cache is typically stored in C:Documents and Settings<SOC account name>Local SettingsTempesrimapcache.)
Do you have a question about this technique or a tip of your own you’d like to share? If so, please leave a comment.
Once you know what ArcGIS Server is and you’ve skimmed the introductory topics in the Help, where’s the best place to go for information about how ArcGIS Server works?
Following are 10 useful help topics which I recommend for all ArcGIS Server users. These topics are updated regularly on http://webhelp.esri.com
Note: All links provided in this post go to the .NET help, but many of these topics apply to Java or there are equivalent topics in the Java help system.
- Tuning and configuring services
Discusses service pooling, recycling, isolation, timeouts, capacity, pool shrinking, etc. This topic is especially useful for former ArcIMS administrators who want to understand the workings of ArcGIS Server services.
- Planning a map cache
This new topic covers designing a tiling scheme, designing maps that will be cached, choosing cache input parameters, and anticipating cache creation resources.
- Configuring a distributed installation of ArcGIS Server
Contains steps, screenshots, diagrams, troubleshooting tips, etc. for configuring an ArcGIS Server system that uses multiple machines. However, many of these principles apply to all deployments of ArcGIS Server.
- How the GIS server works
Contains a more detailed architecture discussion than is found in the Introduction section. Explains what an instance of ArcGIS Server is (.NET), and how to configure ArcGIS Server in a Windows Workgroup environment.
- Accounts used by the GIS server
Explains the SOM Account, the SOC Account, and the ArcGIS Web Services account. You can complete the post install with confidence after reading this topic.
- Configuring tasks
Contains some new detailed information on the .NET Editing task, including the Service Pack 2 enhancements.
- Securing a service
Explains how to secure local and Internet services. Also talks about supported operations (which methods can be called on a service).
- What is an Explorer home server?
This is the gateway to a new book in the Web Help about ArcGIS Explorer home server administration.
- Developing with ArcGIS Server: An overview
This topic is an introduction to what possibilities are available for ArcGIS Server developers, and acts as a bridge to the Developer Help.
- Common problems and solutions
Contains answers to common questions and issues not covered elsewhere in the help.
If you have suggestions for these topics, or ideas for new ones, please leave us a comment!
In this post, Bryan Baker comments on a new sample you can use to add a Print task to your Web ADF applications:
A sample print task for the Web ADF for the Microsoft .NET Framework is now available at the ESRI Developer Network website. This sample allows users to do simple printing of a map and task results. ESRI plans to include printing in the upcoming 9.3 version, but this sample should get you started with printing from the Web ADF. The sample works in the Web ADFs for both ArcGIS Server and ArcIMS.
The sample task prints all resources and services in the Map control, including graphics layers and scalebar. It merges the resources into a single image that the browser displays in a new window. If the user has generated task results, such as with a query or identify, the user may also choose to print those results as a table below the map. The sample also allows entering a custom title. It does not currently support printing other items in the website, such as the table of contents or overview map.
In the website, the Map may be zoomed to any location, and other map properties may be set, such as turning layers on/off or displaying highlights from task results. If other tasks, such as a QueryAttributes task, have been added, the print task displays a list of results from those tasks to print. From the Print task dialog, the user may set a print title and task results to print (if any have been generated in the website). Clicking Print in the dialog pops up a new browser window with the title, map and task results (if any). The user may then print the page with their usual printing methods, to any available printer.
Some additional highlights:
- The user may choose print size, resolution and scale. Resolution (e.g., 300 dpi) is accomplished via standard HTML in the browser.
- The administrator can configure properties of the task, such as the default print page title, the maximum print size, whether to allow printing task results, and whether to print the scale bar on the map.
Installing the sample Print Task
You can install and use the sample task as-is, or customize it for your own use. To install the task you need to:
- Make sure the Web ADF is already installed, with Service Pack 1 or higher applied.
- Unzip the downloaded file.
- Register the task with the .NET global assembly cache.
- (Optional) Add the task to the Visual Studio toolbox.
- (Optional) Add the task to Manager.
Details for these steps are in the instructions at the EDN website, and also in the Readme.doc file accompanying the sample. The sample includes the source code for the task, which can be customized. (Note: If you downloaded the EDN sample before the date of this post, you should revisit the EDN site for updated instructions for adding the task to Manager.)
The instructions on EDN include the path to the ArcGIS Server Manager. To add the task to the ArcIMS Web Manager, follow the same instructions, except add the appropriate entry into the Tasks.xml file for the ArcIMS Web Manager, which by default is in C:InetpubwwwrootArcIMSManagerApplicationsApp_Data.
If you install a service pack for the Web ADF, you will need to reinstall the task into Manager. Uninstalling the task must be done manually; see the readme document for details.
Adding the sample Print Task to a Website
After you install the task, you can add it to a Web ADF web page, using either Manager or Visual Studio. In Manager, you should see the Print task in the list of available tasks when you create or edit a website. Add it to the list of tasks in the website, then configure it (you must click Configure for any task, even if you just keep the default settings). The configuration settings allows you to set properties such as the maximum allowed size and resolution and default title for the print page. When you save the website, the print task should appear in the menu of tasks in the website.
From Visual Studio, add the Print task like other tasks, usually into a TaskManager. Set the Print task's results container to a TaskResults control on the page, using the "smart tag" in the upper right of the task. You can set other properties in the Properties window of Visual Studio. You can set the task's Visible property to false if desired, and make sure a Menu or TreeView control is buddied to the TaskManager so the user sees a list of tasks to open.
The task currently requires that the web page include a Map control. If no Map control is present, an error will occur. The code could be customized to allow for a page with only tasks, such as a query task, with no map. Also, please note that the task will not work with ArcGIS Online services (currently in beta), since those services currently deliver maps only as cached tiles (this task requests new map images for printing).
This task does not use the layout of any ArcGIS Server service in the website. If you want to print using an MXD-based layout, you might want to check out Ismael Chivite's sample posted at ArcScripts that prints layouts.
We'd welcome your comments on this sample. The download page for the sample includes a user comments section. We'll also post periodic updates to the sample based on feedback.
You can try out the task yourself by printing a map from this example web application.
By Charlie Frye, Esri Chief Cartographer
For thematic and analytical maps, it is often helpful to give readers an idea of the statistical nature of the attribute data. Graphs are an effective way to give readers another window into the data. Before version 9.2, ArcMap’s graphing functionality was rather limited. At version 9.2, it is quite possible that nearly any graph you want to make can be created in ArcMap.
The user interface is new, and you now have the ability to make more choices, such as the selection of any color, including those that you have already chosen for the layers in your map (figure 1). Graphs can be bars, columns, XY scatter plots, lines, areas, pies, and box plots. Any graph can be two- or three dimensional, and any property can be customized. Continue reading
Rex Hansen wrote this thorough post about the new support for map rotation in version 9.2, Service Pack 2 of the Web ADF for the Microsoft® .NET Framework:
ArcGIS Server map services support the ability to serve a rotated data frame (map). In 9.2 SP 2, the .NET Web ADF has been enhanced to support map rotation. This involved a number of changes in many sections of the Web ADF. Each section is discussed below:
The Map control has a new Rotation property that can be used to specify, in degrees, the rotation of resources in the Map. A value of NaN means that the rotation of the PrimaryMapResource will be applied; 0 will unrotate rotated resources and leave other resources alone; values greater or less than 0 will rotate resources, throwing an exception if unrotatable resources are present. Map rotation is supported for ArcGIS Server (both Internet and Local) and Web ADF Graphics data sources.
If the Map control has a rotation value greater or less than 0:
- The presence of non-rotatable resources will return an exception in the Web page at runtime. The exception will indicate which resource does not support rotation.
- The ContinuousCallback and EnableTileCaching properties on the Map control will be disabled.
If the Map Rotation property is NaN, the rotation of the PrimaryMapResource (PMR) can be used. Since a Web ADF Graphics resource cannot be a PMR, only a rotation value specified for a data frame in an ArcGIS Server map service can be used.
Map rotation can also be set on the fly at runtime. As long as the resources in the Map control support rotation, Map contents will be updated. Again, if a resource does not support rotation, an exception will returned in the Web page indicating which resource.
The following code snippet illustrates how to change the Rotation property on a Map control:
Map1.Rotation = 45;
Rotating an ArcGIS Server cached map service requires that dynamic map images are generated – the cached map tiles will not be used. As a result, many of the performance benefits of a cached map service are negated.
Web ADF controls that work with the Map have also been updated to support rotation, such as the Navigation, Magnifier, and OverviewMap controls.
TransformationParams and RotationParams classes
Two new classes have been introduced to support parameters used when transforming and rotating map content: TransformationParams and RotationParams.
TransformationParams stores parameters needed to convert coordinates between screen and map units. The Map control has a GetTransformationParams() method to return a TransformationParams instance set up using Map properties. The TransformationDirection enumeration allows you to select which direction the transformation will take place: either screen to map units (ToMap) or map to screen units (ToScreen).
The RotationParams class stores parameters associated with a rotated map extent. The TransformationParams class uses the RotatedParams class to account for rotation when converting coordinates between screen and map units.
In most cases, you’ll use an instance of TransformationParams when converting geometry to and from screen and map units. This is discussed in more detail in the next section.
A set of static methods on the Web ADF Geometry, Point and Envelope classes (in ESRI.ArcGIS.ADF.Web.Geometry) used to convert to and from screen and map units have been overloaded to support map rotation. Previous methods of the same name in 9.2 final and 9.2 sp1 have been marked obsolete because they do not support rotated maps. Obsolete methods will still work with unrotated map content. The new overloads provide a more efficient pattern for transforming Web ADF geometry. A single TransformationParams instance can be created from scratch or retrieved from a Map control and used in multiple geometry conversion calls. TransformationDirection.ToMap should be used for ToMap_ methods while TransformationDirection.ToScreen should be used with ToScreen_ methods. The overloaded methods are listed below:
In the ESRI.ArcGIS.ADF.Web.Geometry.Geometry class (inherited by concrete Web ADF geometry classes):
In the ESRI.ArcGIS.ADF.Web.Geometry.Point class:
ToMapPoint(int, int, ESRI.ArcGIS.ADF.Web.Geometry.TransformationParams)
In the ESRI.ArcGIS.ADF.Web.Geometry.Envelope class:
The following code snippet illustrates how to convert from a point in screen units to a Web ADF Point object in map units:
ESRI.ArcGIS.ADF.Web.Geometry.Point adfPoint = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screenPoint.X, screenPoint.Y, Map1.GetTransformationParams(TransformationDirection.ToMap);
When building a Web application in Manager, the Map rotation property is set to a value of NaN and cannot be changed explicitly. Instead, the Primary Map Resource (PMR) can be used to define a rotation value. In Manager, the PMR is set in the Preview Layers dialog by selecting a resource in the drop down list under “Use coordinate system, rotation and extent of:”. If the PMR is rotated, you cannot use non-rotatable service types, such as ArcIMS and WMS, in the same map. Manager will provide an informative warning if this situation occurs. If you select a non-rotatable service as the PMR, the Web ADF will unrotate any rotated service so that it lines up with the non-rotatable service.
Welcome to the new home of the ArcGIS Server Development Blog! Please update your bookmarks and RSS feeds to reference this new location.
To sign in to this blog, use your ESRI Global Account. Creating an ESRI Global Account is free.
This blog will continue to be written by the ArcGIS Server development team. We have a lot of exciting things to post in the coming months and thank you for your interest and feedback about ArcGIS Server.
From Bryan Baker, a product engineer working on the .NET SDK:
I wrote an earlier post that showed how to extend the QueryAttributes task so that all features are immediately highlighted. Several users have asked about also zooming to the selected features. I'll show that here, though keep in mind that the user can also zoom to the selected features by right-clicking on the node for the layer (Cities in the graphic at the top of the earlier post) and choosing to zoom to selected features.
It turns out that it's a little more difficult to zoom to the features than I originally thought, because the FullExtent property of the graphics layer is null for queries like this. Instead, we have to construct our own envelope around all the features by looping through them. This isn't that difficult, though of course it does require more processing.
I’ve included code below that does the zooming. This code should be added to near the bottom of the existing code in the earlier post. If for some reason you didn’t want to highlight all the features, you could omit or comment out the line in the loop that sets the selectedCol to true.
The code below first creates an envelope to use, then in the existing loop that selects each feature, it widens the envelope to surround each feature. Once it has the envelope, it gets a reference to the Map control so it can set the Map’s extent. This takes some work, since the task itself has no reference to the Map. We have to get the ID of the Map and then search the page’s control tree. Since the Map control could be nested within another control, such as in a FloatingPanel, we search for it recursively using a custom function (found at the bottom of this listing).
One more thing before we zoom the map: the task could be querying a point layer, and if only one point is found, the “envelope” around all features is a point. We can’t zoom to a point, so instead we set the envelope to a percentage of the full extent of the Map (five percent—this value is hard-coded here, and you can change it depending on tightly you want to zoom in this one-point case).
Finally, we’ve got an envelope that will work, and we set the Map to this extent, refresh the Map, and copy its CallbackResults to the task’s CallbackResults. This last step is necessary because a callback only works with one control (the task in this case), and we need to tell another control (the Map) to update its contents.
' Set up the items to hold the extent of all features
Dim geom As ESRI.ArcGIS.ADF.Web.Geometry.Geometry
Dim layerEnv As New _
Double.MaxValue, Double.MaxValue, _
' Set each feature to selected (this loop is
' at the end the code in my previous blog post)
For Each row As DataRow In graphicsLayer.Rows
row(selectedCol) = True
' Enlarge the overall envelope to
' include the current feature
geom = graphicsLayer.GeometryFromRow(row)
' If any records found, zoom to them
If graphicsLayer.Rows.Count > 0 Then
' Get a reference to the Map – have to search the Page since
' task itself has no direct reference to the Map
' (the task's TaskResults does have the ID of the map)
Dim mapCtrl As Map = Nothing
Dim taskResultsId As String =
Dim taskResults As TaskResults = _
Me.Page, taskResultsId), TaskResults)
If Not TaskResults Is Nothing Then
mapCtrl = CType(FindControlRecursive( _
Me.Page, taskResults.Map), Map)
If Not mapCtrl Is Nothing Then
' If only one point found, envelope will be a point
' – set to a percentage of the full extent
If layerEnv.XMin = layerEnv.XMax AndAlso _
layerEnv.YMin = layerEnv.YMax AndAlso _
Not IsNothing(mapCtrl) Then
' Percentage of the full extent to use when zooming to point
Dim zoomToPointPercentage As Integer = 5
Dim NewWidth As Double = mapCtrl.GetFullExtent().Width _
* (zoomToPointPercentage / 100)
Dim NewHeight As Double = mapCtrl.GetFullExtent().Height _
* (zoomToPointPercentage / 100)
layerEnv.XMin -= NewWidth / 2
layerEnv.XMax += NewWidth / 2
layerEnv.YMin -= NewHeight / 2
layerEnv.YMax += NewHeight / 2
' Now we can zoom the map to the extent of the features
mapCtrl.Extent = layerEnv
' We have to tell the client to refresh, using CallbackResults
Below is the function called in the above code. This searches the page and its child controls for the control with the given ID. Put this after the end of the Execute method (End Sub), but inside the Class (before the End Class statement).
' Finds the control in the Page's control tree
Public Function FindControlRecursive(ByVal root As _
Control, ByVal id As String) As Control
If root.ID = id Then
Dim c As Control
For Each c In root.Controls
Dim t As Control = FindControlRecursive(c, id)
If Not t Is Nothing Then
If you add the code above to the custom task as outlined in the earlier blog post, it should automatically zoom to the extent of all features found by the task.
When the Editor task was released at version 9.2 of the Web ADF for the .NET Framework, a common question was “How can I customize the Editor task?”. Service Pack 2 provides an answer to this question. You can now customize the Editor task with custom tools and Editor Panels and we have added more events that allow you to hook into the Editor task.
In addition to these new customization options for developers, the Editor task has another key change at Service Pack 2 which it allows it to be configured with a pooled map service. You can edit non-versioned data using a pooled map service.
See the Editor Task control discussion in the Developer Help for samples and instructions.
By Charlie Frye, Esri Chief Cartographer
This blog entry addresses one of the new features in the ArcGIS mapmakers’ suite of tools. At version 9.2, we added the ability to store representations in your geodatabase; this has wide ranging possibilities for map makers and data publishers. You will definitely be seeing more blog entries about other uses of representations in the coming months. Continue reading