Thursday, April 05, 2007
Posted on Thursday, April 05, 2007 2:57:01 PM (Mountain Daylight Time, UTC-06:00)  Comments [7] | 
Categories: ArcGIS Server

So I was just playing around with a simple ArcGIS Server app, seeing what I could do to reduce the amount of data sent to the client and at the same time speed things up a little. I took a look at the PreferredTileHeight and Width properties of the Map control. By default, these values are set to zero, which means that each tile will be the size of the entire map control. But, if you have a pretty large map, a small pan can result in a lot of data being sent back to the client.

[I should note at this point that for this use case, we cannot build a tile cache - the data is too dynamic and the cache cooking process is too slow - maybe at 9.3 when the cache can be cooked dynamically.]

Supposing you have an 600 x 600 map canvas, and since you've got imagery, it's set to 24bit PNG. In my testing, this results in a ~700kb image (example here) on average. So - if the user just pans down and right a little, ArcGIS Server will be creating and sending three 700kb images for a total of  2.1 Mb of data being transferred. Not bad on a LAN, but a few users like this can overwhelm at T1 pretty quickly.

My idea was to set the PreferredTileHeight and PreferredTileWidth to some smaller value - say 200 x 200. In that case, a small pan would result in (at most) 7, smaller tiles (example) being sent across, and since these averaged 100kb each, it would be 1/3rd the data sent across the wire as compared to the 600 x 600 tiles. The end result was a much smoother panning experience for the map service with the imagery (occasionally there were "tile holes" though - not sure why).

Where things got interesting is when I switched to a different map service which was just vectors. More specifically this service has feature labels. It seems that the rendering engine does not know that it's sending the data as a block of tiles - thus it renders a label for each feature in each tile, resulting in repeated labels across the image. This makes sense, but ends up looking a little weird...



The TileCache gets around this by rendering much larger "super tiles" which are then cut up into the smaller tiles - and this avoids the multiple-labelling issue. Anyhow - if you are thinking about using a non-zero value for PreferredTileHeight / Width, watch out for this.
Friday, April 06, 2007 12:43:04 PM (Mountain Daylight Time, UTC-06:00)
Dave,
You mentioned waiting for 9.3 to cache tiles dynamically-

There is an http://www.openlayers.org Openlayers front end called http://www.tilecache.org tilecache that will act as a front end for your server (in this case a wms server) it will analyze your request and determine if the tile requested already exists in your cache. It is written in Python but it has already been ported into a java servlet using Jython. I know that your place is a dot net shop so why couldn't you just port it into Iron Python? That might work for you.

PS it also will "seed" the cache in advance, and also has the ability to do "rendering much larger "super tiles" which are then cut up into the smaller tiles" except it calls them meta tiles.

Here is my problem.

I want to use the same set of ArcGIS generated tiles in my AGS apps as in World Wind. Now I can use World Wind tiles in AGS apps by hacking this example http://edndoc.esri.com/arcobjects/9.2/NET_Server_Doc/developer/samples/Web_Applications/Common_CustomDataSource/e45f36a3-4b96-470a-bbcf-63922b9cbe7e.htm (pointed out to me by Jeremy Bartley). Which will allow my World Wind Tiles to be consumed as a custom data source in AGS apps.That will take care of my imagery but....

Now I need to figure out how to make AGS natively produce tiles in the World Wind format of my mxd's.
CH
Friday, April 06, 2007 8:13:40 PM (Mountain Daylight Time, UTC-06:00)
My first thought was TileCache as mentioned above. But if your not serving a WMS that is not as useful as the AGS functions.
If you have raster data to serve up, I don't see how that can be too dynamic for tile caching unless you are serving near realtime data. Even if it changed daily, you could have a script run nightly to rebuild the cache. There is an option which will only overwrite what has changed. You can also set custom extents for that you only re-cache areas that have changed. At the Building Map Caches session at the Dev Summit, they claimed that their tests showed that significantly better response times were gained by using jpeg for non-transparent raster data sets (generally aerial or satelite imagery).
You can build a service which fuses several caches & dynamic data together. However, you should have things in similar projections and the tile caches should at least have the same zoom levels.
You may want to look at that presentation on EDN, it might have some helpful hints for you.
Saturday, April 07, 2007 2:00:18 PM (Mountain Daylight Time, UTC-06:00)
@Cole

This for the links, but as Matt points out, those options are not that good when you're using the ESRI Web ADF. We may look at Openlayers/MapServer/PostGIS/TileCache in the future, but for now, we're in the ESRI boat.

@Matt
I did not make it to the Map Cache session, so I'll check out the powerpoint @ EDN.

Thanks!

Dave
Dave
Monday, April 09, 2007 11:20:25 AM (Mountain Daylight Time, UTC-06:00)
@Matt,@Dave

I guess I didn't explain my idea very well.I didn't mean to suggest using AGS output as WMS. I was just referencing TileCache as a front end for WMS... As I read over my post it doesn't even make sense to me.

Let me try again

I have three clients- World Wind, OpenLayers, and AGS apps. I only want to maintain one set of tiles.

All three can use the World Wind tile spec:

World Wind (native)

OpenLayers (via Tilecache, From the TileCache homepage:
"...In addition (to WMS), there are two cache backends:

* DiskCache -- Store files on disk. (Files stored in directories like basic/0/000/001/053/000/021/052.png)
* MemoryCache -- Store data in a memcached instance or cluster. (Requires memcached server running.)

TileCache supports three tile request mechanisms: WMS requests, ..., WorldWind requests, ..., and TMS requests, ...."

AGS Apps (using the code mentioned in my first post World Wind tiles as custom data source)

So here was what I meant:

If the AGS map control can be used to input other tile scheme's (as a custom data source) it stands to reason that you can make AGS output different tile schemes (ie. Word Wind). If you coded AGS server to output World Wind Tiles, you could then dynamically populate your cache, or seed it ahead of time (for static data) with TileCache in front of AGS server.. I hope that makes more sense.

CH
Monday, April 09, 2007 11:35:35 AM (Mountain Daylight Time, UTC-06:00)
I forgot to add at the bottom my last post:

If you want to stay with ESRI's tile scheme it doesn't seem like it would be too difficult to add another format to TileCache.

@Matt,
From your notes on Building & Using ArcGIS Server Map Caches (Best Practices) it looks like ESRI is going to do something like that eventually.

"Dynamic cache building (a la TileCache) is planned for future releases."

CH
Wednesday, April 18, 2007 10:31:01 AM (Mountain Daylight Time, UTC-06:00)
Have you noticed that IE7 chops up the big tile into smaller ones and results in the multiple labels?
Wednesday, April 18, 2007 11:18:32 AM (Mountain Daylight Time, UTC-06:00)
Steve - I did not do my original testing in IE7, and I have not see this when doing testing on the site (but it's not specifying the ht & wd any more either)

Dave
Comments are closed.