Friday, September 12, 2008

ArcGIS Tiles on Amazon S3

Once you have generated your tiles from a map services, you can move these tiles to Amazon S3. I used the S3Fox Firefox extension to move the files from my local system to S3. In addition, make sure to copy the JSON map service metadata to a file named "MapServer" (without quotes of course :-). You can access these tiles using the Flex API for ArcGIS server as follows:

<?xml version="1.0" encoding="utf-8"?>

And here is the implements of S3ArcGISTiledMapServiceLayer class:

package com.esri.s3
import com.esri.ags.layers.ArcGISTiledMapServiceLayer;


public class S3ArcGISTiledMapServiceLayer extends ArcGISTiledMapServiceLayer
private var m_baseURL : String;

public function S3ArcGISTiledMapServiceLayer(url:String=null)

override public function set url(value:String):void
super.url = value;
if( value )
var index : int = value.lastIndexOf( "/" );
m_baseURL = value.substr( 0, index );
m_baseURL = "";

override protected function getTileURL(
return new URLRequest( m_baseURL + "/l" + level + "r" + row + "c" + col + ".jpg" );

Note that I simplified the storage retrieval in the getTileURL function. ArcGIS places the tiles on the file system as a set of sub-directories of the form level/row/column.jpg. I decided (out of laziness :-) to keep it flat and have a set of files in the form lXrXcX.jpg.


Stuart said...

Great example. Have you tried using Akamai for storage of tile cache?

ThunderHead said...

Interesting idea - will connect with some folks here at ESRI that have Akamai knowledge and see what we can come up with :-)

Daniel said...

I must say that this blog is great!! I am a new-b to flex and the discussions, code, and examples here open my eyes to all the great possibilities. Thanks and keep blogging

ThunderHead said...

Glad you like it :-)

Greg said...

You are a madman Mr. Raad! Great stuff!

Jesse Andrews said... is another option for interacting with S3 in firefox.

西域蝈蝈 said...

hello,i want to known "JSON map service metadata" how to create,give me a simple sample for "MapServer".thank

ThunderHead said...

Check out

西域蝈蝈 said... help me more,I get my map metadata from my_map_service/MapServer?f=json. I'm intresting your blog.