Welcome to ESRI Blogs

Achieving smooth transitions with adjacent services

In your ArcGIS Server application you might have reason to work with adjacent map and image services. This is most often occurs when you want to display your authoritative data for a small area while using a public service (ArcGIS Online, Bing Maps, or Google Maps) for the surrounding area. This is very common when viewing your services in ArcGIS Explorer. For example, you may have recent aerial photography for your area, and you want to blend it with the basemap imagery available in ArcGIS Explorer. This can present a challenge because your service may include a white collar around the map. The discussion below focuses on how to remove this white collar for different service configurations.

Dynamic map services

The example below is a dynamic map service containing aerial photography for Jefferson County, Kentucky shown in ArcGIS Explorer.

Original dynamic map service in ArcGIS Explorer 

With this dynamic map service, ArcGIS Explorer is requesting a JPEG image because the service contains so many colors. Since JPEG does not support transparency, you get a white collar around the image. To clip the white area out of a map service for your desktop clients (ArcMap, ArcGIS Explorer, etc.), simply create a feature class that represents the boundary of your data. Then you can use the Data Frame Clipping capability as described below.

  1. In the ArcMap table of contents, right-click the data frame and click Properties.
  2. Click the Data Frame tab and then check Enable under Clip to Shape.
    Enabling Clip to Shape
  3. Choose Outline of Features and choose your boundary layer.
    Choosing the clip outline
  4. Click OK to all the dialogs.

After updating your map document you need to restart your map service for the changes to take effect. Then the map service will display in ArcMap or ArcGIS Explorer nicely without a collar as in the example below.

Clipped dynamic map service in ArcGIS Explorer

Image services

When dealing with image services you could run into the same white collar around your image. In this case the boundary feature and footprint features need to be clipped to the exact boundary of your imagery. Again, a feature class containing the exact boundary of your imagery would be very useful. You could replace the default boundary feature with your boundary feature and then clip all the footprints to the new boundary. Simply start an edit session, delete the existing boundary and copy and paste your existing boundary into the boundary feature class. After you save your edits and stop editing, right-click on the Footprint layer and click Recompute Footprint > By Clipping to Boundary. You can read about the many other ways to adjust image service footprints in the online help.

NoData and Web APIs/ADFs

The above two approaches for dynamic map services and images services use a boundary feature to differentiate between data and NoData. Any areas outside of the boundary features are NoData. The desktop clients like ArcMap and ArcGIS Explorer don’t render the NoData values. However, all of the Web APIs (JavaScript, Flex, Silverlight) and ADFs (.Net and Java) do render the NoData values as white if the requested image does not support transparency.

In the aerial photography example above, the Web application should request a JPEG image to preserve appropriate quality. Since JPEG does not support transparency, this image could not be used with another basemap service. In cases where a PNG image would work, the white collar will not display, but PNG should only be used with services that contain fewer colors than an aerial photo.

Since your basemaps should be cached anyway for Web applications, the discussion below dealing with cached map services is more appropriate for Web application basemaps.

Cached map services that use JPG tiles

Cached map services can produce an even larger white collar, as the example below illustrates.

Cached imagery with collar in ArcGIS Explorer

This is a cached map service using JPEG image format. As has been discussed in another post, JPEG is by far the best image format for cached map services that contain aerial photography to be used in a Web application. You can see in this example that the cached map service doesn't work all that well in ArcGIS Explorer. The larger white boundary is from the empty cache tiles around the map. Since the JPEG image format does not allow for transparency, you get a white collar. There is nothing you can do to get rid of this white collar in ArcGIS Explorer, ArcMap, or any of the Web ADFs or APIs. To mitigate this problem with JPEG services in ArcGIS Desktop or ArcGIS Explorer you have three options:

  1. Use layer files to control the visibility of the map service
  2. Include the surrounding data in your map cache
  3. Provide a second dynamic map service for desktop clients

Using layer files to control the visibility of the map service

Using a layer file, you can use scale dependent rendering to make sure the layer only turns on when zoomed way in. To do this follow these steps.

  1. Add the cached map service to ArcMap
  2. Zoom in on the data until you can start to see reasonable amounts of detail (that wouldn't otherwise be in ArcGIS Online or Bing maps).
  3. Right-click on the layer and click Zoom to Nearest Cache Resolution. This ensures your layer visibility corresponds to your cache tile level.
  4. Open the properties for the layer and set the minimum scale to your current scale.
  5. Right-click the layer and click Save As Layer Package.

Now you can share the layer file with all of your desktop users. The white collar will still be visible, but only when zoomed way in. At this larger scale, your users will likely be more interested in your map service than the surrounding data.

Including the surrounding data in your map cache

The second option of adding surrounding data to your map cache can also improve the usability of the service by your desktop clients. This can be done for the smaller scales of your map cache with little overall impact to the total size of your cache tiles. For more on map caching see the online help. This does mitigate the problem but essentially you have pushed the problem further away from your study area.

Providing a second dynamic map service for desktop clients

The third option is to use two services: a cached map service for your Web applications, and a dynamic map service for your ArcMap and ArcGIS Explorer users. If you are working with imagery like that in this example, an image service would be preferred to the dynamic map service. Since ArcMap and ArcGIS Explorer have local caching capabilities after the first time an area is drawn, a dynamic image service would likely perform very well. To make this easily consumable by your desktop clients you could simply share a layer file pointing to the image service for those users. You should also set the minimum scale in the layer as described above to control the number of dynamic requests and only show your basemap when appropriate.

Cached map services that use PNG tiles

Cached map services that use PNG do not display a collar because PNG supports transparency. This is a good solution for StreetMap-type basemaps, which can use PNG 8 or 32 (you should never use PNG 24 due to IE 6 limitations). Below is a cached streets basemap service that uses PNG32.

Cached PNG service overlapping ArcGIS Online

PNG is an acceptable choice in this example because it maintains crisp lines and text while still keeping the file size low. If this map contained a lot of gradient fills and other shading affects, JPEG with compression quality 90 would be a better choice. Using JPEG would mean the service would not be very useful with other basemaps but it would give you the best performance and quality in a Web application.

Warning! Be very careful when using PNG 32 for your basemap services. As the number of colors increase, so does the file size. Using PNG 32 for aerial photography, for example, can result in tiles being approximately ten times larger than the same service cached using JPEG. If the tiles are ten times larger, then the map will be ten times slower. Using an image format like JPEG 90 would give more consistently sized tiles for all scales, whereas PNG 32 would have much larger tiles at the small scales but smaller tiles at the large scales. The best approach is to build a test cache and validate that all scales have acceptable tile sizes.

Summary

With dynamic map service and image services you can easily clip the imagery to the extent of your data allowing you to blend multiple adjacent basemaps in your desktop applications like ArcMap or ArcGIS Explorer. You will still have the challenge of getting the base maps to look similar in a single application but the published map templates should help in this area. With cached map services that use JPEG tiles you should consider maintaining two services: the JPEG cache and a dynamic map or image service. The JPEG cache would be used in web applications and the dynamic service would be used in desktop applications like ArcMap or ArcGIS Explorer. Cached map service that use PNG work very nicely for integrating multiple adjacent services but should not be used as an "ultimate" solution as JPEG caches can be much more efficient for map services with high color variation.

Contributed by Tom Brenneman of the ESRI Technical Sales team.

Published Thursday, September 03, 2009 5:00 PM by sterlingdq

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Achieving smooth transitions with adjacent services

I'm caching a layer from my map service which has nearly 3 million records (Point) layer. I use ArcGIS online scale levels, my machine is 32 GB RAM and using 15 instances. But my caching is failed in middle. I need to find out exact reason for the same. Here are my other questions 1. How to validate caching is 100% completed? 2. In log files logs has entire details for all actions on map service which is really cumbersome to located Caching related verbose information. Is there any way to log only caching details in same or other file? 3. How to know, how much % of caching is completed? 4. When caching fails, is there any scripts or way to send out an email or notification by any means? 5. Please provide us best practices or approach when we do large caching. How to handle the situation when caching is failed, precautionary measures/guidlines.
Thursday, September 10, 2009 1:12 AM by Lakshmanan

# re: Achieving smooth transitions with adjacent services

hi,i'm using AGS 9.3.1 and publish WMS as the map service,but i found that if i cache the WMS use PNG8 ,then use IE8 or firefox to request the WMS service ,the image return from AGS is not transparent,but if i don't cache it,it works fine.follow is the URL i use to request the WMS Service: http://arcgisserver:8399/arcgis/services/test/MapServer/WMSServer?format=image/png&transparent=true&version=1.1.1&request=getmap&layers=0&styles=&SRS=EPSG:4326&bbox=38831.94,30102.96,41639.13,31997.17&width=512&height=512 is this a bug?any help will be appreciated!
Thursday, September 10, 2009 1:54 AM by zorry

# re: Achieving smooth transitions with adjacent services

The fused cache map service options that use JPG tiles will work in most cases but aren't really ideal.  Will 9.4 have any new options that specifically address this issue?  

Tuesday, September 15, 2009 1:17 PM by bgodfrey

Leave a Comment

(required) 
required 
(required)