Designing, Deploying, and Using Designing, Deploying, and Using Cached Map Services Cached Map Services Nikki Golding Nikki Golding
Designing, Deploying, and Using Designing, Deploying, and Using Cached Map ServicesCached Map Services
Nikki GoldingNikki Golding
What to expect in this sessionWhat to expect in this session
•• Basic to advanced topicsBasic to advanced topics
•• OutlineOutline–– What is map caching?What is map caching?–– Why should I cache?Why should I cache?–– How to create a cacheHow to create a cache–– Caching strategiesCaching strategies–– More 9.3 improvementsMore 9.3 improvements–– Questions?Questions?
22
What is map caching?What is map caching?
33
What is a Cache?What is a Cache?
55
What does it mean to cache a map service?What does it mean to cache a map service?
•• A cached service has a set of map images that have been preA cached service has a set of map images that have been pre--rendered for rapid display.rendered for rapid display.
•• Created at preCreated at pre--determined scale levelsdetermined scale levels•• Tiles stored on web server for fast retrievalTiles stored on web server for fast retrieval
1:500,000
1:250,000
Why Cache Maps?Why Cache Maps?
WorldWorld--Class CartographyClass CartographyBest Performance & ScalabilityBest Performance & Scalability
77
What users expect todayWhat users expect today•• Cached mapCached map•• FastFast•• Beautiful cartographyBeautiful cartography
What users expected 10 years agoWhat users expected 10 years ago•• Dynamically drawn mapDynamically drawn map•• SlowSlow•• Compromised cartographyCompromised cartography
Internet users expect the performance of cached mapsInternet users expect the performance of cached maps
DemoDemo
•• Java Script Extension for Java Script Extension for VEVE
•• http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/ve/sve/sdk/index.htm#showmedk/index.htm#showme
88
How to create a cacheHow to create a cache
•• Cache creation toolsCache creation tools•• Properties of a cacheProperties of a cache
–– Tiling schemeTiling scheme•• Tile SizeTile Size•• DPIDPI•• ScalesScales•• OriginOrigin
–– Image format and compressionImage format and compression–– AntiAnti--aliasingaliasing–– Fused or multiFused or multi--layerlayer
99
1010
New caching workflow at 9.3New caching workflow at 9.3
•• Set the tiling scheme, then create the tilesSet the tiling scheme, then create the tiles–– Use Manage Map Server Cache Tiles tool for both Create and UpdatUse Manage Map Server Cache Tiles tool for both Create and Updatee–– Cannot change tiling scheme after clicking OK or ApplyCannot change tiling scheme after clicking OK or Apply
1111
Caching tab is also available in Manager in 9.3Caching tab is also available in Manager in 9.3
•• You can use it to:You can use it to:–– Define the tiling scheme for a service Define the tiling scheme for a service –– Enable cache on demandEnable cache on demand
•• You cannot use it to launch the caching toolsYou cannot use it to launch the caching tools
Set the tiling schemeSet the tiling scheme
•• Choose from wellChoose from well--known tiling schemes of Web map servicesknown tiling schemes of Web map services–– ArcGIS OnlineArcGIS Online–– Google Maps & Virtual EarthGoogle Maps & Virtual Earth
•• Import from file or serviceImport from file or service
•• Create your ownCreate your own
1212
Choosing the scales for a tiling schemeChoosing the scales for a tiling scheme
•• Build just the Build just the scales you needscales you need
–– Determine closest required Determine closest required scalescale
–– Double scale denominator Double scale denominator until full extent is reached until full extent is reached
–– Adjust smallest scale Adjust smallest scale to full extent of map serviceto full extent of map service
•• Always prototype your Always prototype your cachecache
–– Set custom full extent of Set custom full extent of map data frame to a small map data frame to a small areaarea
–– Use as a guide for cache Use as a guide for cache appearance, creation time, appearance, creation time, and sizeand size
77--1313
Level Scale Tiles % of total1 1:16,000,000 1 0.000%2 1:8,000,000 4 0.001%3 1:4,000,000 16 0.005%4 1:2,000,000 64 0.018%5 1:1,000,000 256 0.073%6 1:500,000 1,024 0.293%7 1:250,000 4,096 1.172%8 1:125,000 16,384 4.688%9 1:62,500 65,536 18.750%10 1:31,250 262,144 75.000%
Sample 10 level cache
Final level is always ~75% of the total
Design for your cache scales in ArcMapDesign for your cache scales in ArcMap
•• Choose a set of scale levels and design at Choose a set of scale levels and design at thosethose
–– ArcGIS Online, Google Maps, VE scales, or your ArcGIS Online, Google Maps, VE scales, or your own?own?
–– Add the scales to the ArcMap dropdown listAdd the scales to the ArcMap dropdown list–– Make the map look good at each scale Make the map look good at each scale
•• Copy layers Copy layers –– Can set a different scale range and symbology Can set a different scale range and symbology
for each copyfor each copy
•• Group layers by scale levelGroup layers by scale level–– Only have to set the scale range at the group Only have to set the scale range at the group
layer levellayer level
1414
DemoDemo
•• Load Scales for ArcGIS OnlineLoad Scales for ArcGIS Online•• Publish Map Document Publish Map Document •• Caching ParametersCaching Parameters
1515
`
Map authoring tipsMap authoring tips
•• Background colorBackground color–– Data Frame (ArcMap) Background = transparency colorData Frame (ArcMap) Background = transparency color–– Transparent color defaults to nearTransparent color defaults to near--white (253, 253, 253)white (253, 253, 253)–– Avoid using a background color thatAvoid using a background color that’’s already in your maps already in your map
•• Use the Maplex labeling engineUse the Maplex labeling engine
1616
Tile size and DPITile size and DPI
•• Tile sizeTile size–– Pixel dimensions of each imagePixel dimensions of each image–– 256x256 and 512x512 are defacto standards256x256 and 512x512 are defacto standards
•• ArcGIS Online uses 512 X 512ArcGIS Online uses 512 X 512•• Google Maps and Virtual Earth use 256 X 256Google Maps and Virtual Earth use 256 X 256•• Use caution outside these sizesUse caution outside these sizes
–– Larger dimensions are faster to build, but tiles take longer to Larger dimensions are faster to build, but tiles take longer to downloaddownload
•• DPIDPI–– Resolution of the cache tiles that the server will generateResolution of the cache tiles that the server will generate–– Set higher than default (96) if clients printing cached servicesSet higher than default (96) if clients printing cached services
•• Use caution when changing defaultUse caution when changing default•• Symbol sizes are affected by DPISymbol sizes are affected by DPI
1717
66--1818
Transparency # of colors Storage Best for
JPEG No 16 million Lossy (1%-100% compression) Raster
PNG8 Yes 256 Lossless Vector
PNG32 Yes 16 million Lossless Raster / Vector
PNG24 Yes (No in IE 6) 16 million Lossless Raster / Vector
Choosing output image typeChoosing output image type
DA
•• Use PNG8 for overlay services Use PNG8 for overlay services ––Boundaries, Street network for overlaying imagery, etc.Boundaries, Street network for overlaying imagery, etc.
•• Use JPG image format for base mapsUse JPG image format for base maps––Compression quality = 90 is a good choiceCompression quality = 90 is a good choice
•• Avoid PNG24 with Web applicationsAvoid PNG24 with Web applications––IE6 does not honor transparency in PNG24IE6 does not honor transparency in PNG24
AntiAnti--aliasingaliasing
•• Smoothes edges of labels and lines by blending them with the Smoothes edges of labels and lines by blending them with the backgroundbackground
–– Choose background color carefully!Choose background color carefully!•• Cannot set this up in ArcMap. Use the caching tools. Cannot set this up in ArcMap. Use the caching tools. •• Takes longer to cacheTakes longer to cache
1919
Anti-aliasingAnti-aliasingNo anti-aliasingNo anti-aliasing
Fused or MultiFused or Multi--layerlayer
•• FusedFused–– Single image tiles for all map layers Single image tiles for all map layers
at each scale levelat each scale level–– Best performanceBest performance–– No control over individual layer visibilityNo control over individual layer visibility
•• MultiMulti--layerlayer–– Image tile for each map layer at each scale levelImage tile for each map layer at each scale level–– Only practical with ArcMap clientsOnly practical with ArcMap clients–– Avoid with web applicationsAvoid with web applications
•• Blending on web tier reduces scalability and performanceBlending on web tier reduces scalability and performance•• Internet users expect the performance of fused cached mapsInternet users expect the performance of fused cached maps
66--2020
Fused vs. MultiFused vs. Multi--layer Cacheslayer Caches
Fused caches are recommended for the full Fused caches are recommended for the full performance benefits of Server caching.performance benefits of Server caching.
Create Map Server Cache tool Advanced Cached Service Properties
Create tilesCreate tiles
•• Manage Map Server Cache TilesManage Map Server Cache Tiles–– New tool at 9.3New tool at 9.3–– Similar to Update Map Server Cache Tiles at 9.2Similar to Update Map Server Cache Tiles at 9.2–– Allows fineAllows fine--grained control over scales that are cachedgrained control over scales that are cached
•• Launch this tool from:Launch this tool from:–– ArcCatalog by clicking ArcCatalog by clicking ““Create tilesCreate tiles”” or or ““Update tilesUpdate tiles”” in the Caching in the Caching
tab of Service Propertiestab of Service Properties–– ArcToolboxArcToolbox–– Command lineCommand line–– Scripting environment such as PythonScripting environment such as Python
•• Service must be started to create tilesService must be started to create tiles•• Use N+1 instances where N = the number of sockets on serverUse N+1 instances where N = the number of sockets on server
2222
Demonstration: Cached Map ServicesDemonstration: Cached Map Services
•• Portland (Notification): Portland (Notification): http://mapapps.esri.com/serverdemos/mailinglist/index.htmlhttp://mapapps.esri.com/serverdemos/mailinglist/index.html
•• ArcGIS Online (Site Selection): ArcGIS Online (Site Selection): http://mapapps.esri.com/serverdemos/siteselection/index.htmlhttp://mapapps.esri.com/serverdemos/siteselection/index.html
•• FiddlerFiddler
Clients to Cached Map ServicesClients to Cached Map Services
•• ArcMap (2D)ArcMap (2D)•• ArcGlobe and ArcGIS Explorer ArcGlobe and ArcGIS Explorer
(3D)(3D)•• ArcGIS Web Mapping Applications ArcGIS Web Mapping Applications
–– .Net , Java, JavaScript.Net , Java, JavaScript
•• ArcGIS for AutoCADArcGIS for AutoCAD•• OGC clientsOGC clients•• Google Maps, VE and Google Google Maps, VE and Google
EarthEarth
Using caches in Web applicationsUsing caches in Web applications
•• Navigation limited to the tiling scheme scalesNavigation limited to the tiling scheme scales•• Tiles cannot be reprojectedTiles cannot be reprojected•• ArcGIS Online mashupsArcGIS Online mashups
–– Map must use WGS 1984 coordinate systemMap must use WGS 1984 coordinate system–– Must use ArcGIS online tiling schemeMust use ArcGIS online tiling scheme
•• Google Maps and Virtual Earth mashupsGoogle Maps and Virtual Earth mashups–– Map must use WGS 1984 Web Mercator coordinate systemMap must use WGS 1984 Web Mercator coordinate system–– Must use Microsoft Virtual Earth / Google Maps tiling schemeMust use Microsoft Virtual Earth / Google Maps tiling scheme–– May need to apply appropriate transformation to get data to aligMay need to apply appropriate transformation to get data to alignn
•• WGS_1984_Major_Auxiliary_Sphere_To_WGS_1984WGS_1984_Major_Auxiliary_Sphere_To_WGS_1984•• See KB article See KB article 3474934749
2525
Using caches in DesktopUsing caches in Desktop
•• ArcMapArcMap–– High level of control over tile appearanceHigh level of control over tile appearance
•• Continuous zoomContinuous zoom•• ReprojectionReprojection
–– Can easily overlay with other services and dataCan easily overlay with other services and data
•• ArcGIS ExplorerArcGIS Explorer–– Can overlay 2D cache on globe surfaceCan overlay 2D cache on globe surface–– ArcGIS Online tiling scheme recommendedArcGIS Online tiling scheme recommended
•• Must clear local cache after updateMust clear local cache after update
2626
Desktop clients and cache updatesDesktop clients and cache updates
•• ArcGIS Desktop and ArcGIS Explorer maintain local cachesArcGIS Desktop and ArcGIS Explorer maintain local caches
•• Users must clear local cache to see updatesUsers must clear local cache to see updates
•• User can disable local cachingUser can disable local caching
•• Server administrator can also disable local cachingServer administrator can also disable local caching–– New at 9.3New at 9.3–– Overrides client settingsOverrides client settings
2727
ClientClient--side ArcMap Parametersside ArcMap Parameters
•• ArcMap creates a local cacheArcMap creates a local cache–– Located: %temp%Located: %temp%\\esrimapcacheesrimapcache\\–– Can get out of sync with server side cacheCan get out of sync with server side cache–– Administrator can allow/disallow client cachingAdministrator can allow/disallow client caching–– ArcMap users can also control caching behavoirsArcMap users can also control caching behavoirs
Caching strategiesCaching strategies
2929
Cache size affects strategyCache size affects strategy
•• Small caches Small caches –– Create all tilesCreate all tiles–– Update all tiles frequentlyUpdate all tiles frequently
•• Large caches Large caches –– Create the most accessed areas firstCreate the most accessed areas first–– Create tiles on demandCreate tiles on demand–– Update strategicallyUpdate strategically
3030
3131
Cache by feature classCache by feature class
•• Cache only within boundary of features you supplyCache only within boundary of features you supply–– You can supply a feature class with just one featureYou can supply a feature class with just one feature–– Avoid numerous features or geographically small featuresAvoid numerous features or geographically small features
–– Saves time and diskspaceSaves time and diskspace
•• Optionally, track the Optionally, track the status of which features status of which features have been cachedhave been cached
•• http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/02/05/http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/02/05/TipsTips--forfor--cachingcaching--byby--featurefeature--class.aspxclass.aspx
3232
OnOn--demand cachingdemand caching
•• Creates tiles as they Creates tiles as they are visited by users and are visited by users and adds them to your cacheadds them to your cache
•• First visitor to an area First visitor to an area must wait for tiles must wait for tiles to be createdto be created
•• PrePre--create tiles for areas create tiles for areas that you anticipate will that you anticipate will be most popularbe most popular
•• Set as a service property in Set as a service property in ArcCatalog or ManagerArcCatalog or Manager
Cache by feature class + cache on demandCache by feature class + cache on demand
•• Southern California populated places exampleSouthern California populated places example
3333
Updating the cacheUpdating the cache
•• Necessary if you want to see changes in your dataNecessary if you want to see changes in your data•• Gives you the performance benefit of caching, even with changingGives you the performance benefit of caching, even with changing
data data
•• Update with Manage Map Server Cache Tiles toolUpdate with Manage Map Server Cache Tiles tool–– Execute manually or via a scheduled scriptExecute manually or via a scheduled script–– See the See the HelpHelp for an example Python scriptfor an example Python script
3434
Strategic updatesStrategic updates
•• Geoprocessing model can be used to update only areas that Geoprocessing model can be used to update only areas that have changedhave changed
•• Custom Geoprocessing tool:Custom Geoprocessing tool:Show Edits Since ReconcileShow Edits Since Reconcile
–– Use geodatabase versioning to track changesUse geodatabase versioning to track changes–– Generate a feature class of where changes have occurredGenerate a feature class of where changes have occurred–– Update the cache using feature class outputUpdate the cache using feature class output
•• Repeat on a regular basisRepeat on a regular basis
3535
parcels
parcels
Update a cache using a staging server (scenario)Update a cache using a staging server (scenario)
3636
Production ArcGIS Server Instance
Staging ArcGIS Server Instance
File Geodatabase
Multi-user versioned Geodatabase
Map service on staging server has all layers to support cache creation
Map service on production server has layers to support queries and TOC
Cache folderCache folder
Cache folderCache folderXcopy, or Securecopy,
or …
Xcopy, or Securecopy,
or …
QueriesQueries
DisplayDisplay
Globe cachesGlobe caches
•• 3D globe caches give optimal performance in ArcGlobe and 3D globe caches give optimal performance in ArcGlobe and ArcGIS ExplorerArcGIS Explorer
•• Image format and tiling scheme is preImage format and tiling scheme is pre--configuredconfigured
•• Requires a globe service and use of globe caching toolsRequires a globe service and use of globe caching tools
3737
Creating a 3D globe cache from a 2D map cacheCreating a 3D globe cache from a 2D map cache
•• Create a 3D cache from a globe containing a Create a 3D cache from a globe containing a draped 2D map cachedraped 2D map cache
–– Gives better cartographic quality and performance than you wouldGives better cartographic quality and performance than you would get get if you authored the .3DD in ArcGlobeif you authored the .3DD in ArcGlobe
–– This is how ESRI created the ArcGIS Online globe cachesThis is how ESRI created the ArcGIS Online globe caches
–– For instructions see ArcGIS Server Development Blog post: For instructions see ArcGIS Server Development Blog post: Creating a Creating a 3D globe cache from a 2D map cache3D globe cache from a 2D map cache
–– http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2007/05/30/http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2007/05/30/CreatiCreatingng--aa--3D3D--globeglobe--cachecache--fromfrom--aa--2D2D--mapmap--cache.aspxcache.aspx
3838
9.3 improvements9.3 improvements
3939
Add and remove scales from an existing cacheAdd and remove scales from an existing cache
•• Use the Manage Map Server Cache Scales toolUse the Manage Map Server Cache Scales tool
•• Edits the cache configuration and the cache folders on diskEdits the cache configuration and the cache folders on disk
4040
Improvements to ArcMap as a clientImprovements to ArcMap as a client
•• Improved display of resampled cached tilesImproved display of resampled cached tiles
–– Improves the look of Improves the look of ArcGIS Online Street MapArcGIS Online Street Map
–– Helps eliminate issues like Helps eliminate issues like ““disappearing boundariesdisappearing boundaries””::
4141
WMS services take advantage of cacheWMS services take advantage of cache
1.1. Enable WMS capability on a cached map serviceEnable WMS capability on a cached map service2.2. WMS service uses cached images instead of generating an WMS service uses cached images instead of generating an
image on the flyimage on the fly
•• Only uses cache when there is no need to change projection, Only uses cache when there is no need to change projection, layer order, layer visibility, background, etc.layer order, layer visibility, background, etc.
4242
Updated documentationUpdated documentation
•• Caching Help greatly expanded between 9.2 and 9.3Caching Help greatly expanded between 9.2 and 9.3
•• Web help is constantly updatedWeb help is constantly updated–– Web Help is available at 9.3 Beta (requires a login): Web Help is available at 9.3 Beta (requires a login):
http://webhelp.esri.comhttp://webhelp.esri.com
•• ArcGIS Server Development Blog ArcGIS Server Development Blog posts address specific problems posts address specific problems and are later moved to the web help and are later moved to the web help
–– http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2007/07/12/http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2007/07/12/StrateStrategiesgies--forfor--largelarge--cachingcaching--jobs.aspxjobs.aspx
4343
TrainingTraining
•• ArcGIS Server: Web Administration Using the Microsoft .NET ArcGIS Server: Web Administration Using the Microsoft .NET FrameworkFramework
–– Two full lessons on map cachingTwo full lessons on map caching
•• Free Live Training SeminarFree Live Training Seminar–– Implementing and Optimizing ArcGIS Server Map CachesImplementing and Optimizing ArcGIS Server Map Caches
•• DemoDemo--drivendriven•• Focuses on strategiesFocuses on strategies•• Offered at 9:00 AM, 11:00 AM, and 3:00 PM Pacific TimeOffered at 9:00 AM, 11:00 AM, and 3:00 PM Pacific Time
•• Visit training.esri.com for more informationVisit training.esri.com for more information
4444
4545
Questions?Questions?
•• (Please fill out session surveys!)(Please fill out session surveys!)