<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:s3="com.esri.s3.*"
layout="absolute"
>
<esri:Map>
<s3:S3ArcGISTiledMapServiceLayer
url="http://s3.amazonaws.com/your_map_service/MapServer"/>
</esri:Map>
</mx:Application>
And here is the implements of
S3ArcGISTiledMapServiceLayer
class:
package com.esri.s3
{
import com.esri.ags.layers.ArcGISTiledMapServiceLayer;
import flash.net.URLRequest;
public class S3ArcGISTiledMapServiceLayer extends ArcGISTiledMapServiceLayer
{
private var m_baseURL : String;
public function S3ArcGISTiledMapServiceLayer(url:String=null)
{
super(url);
}
override public function set url(value:String):void
{
super.url = value;
if( value )
{
var index : int = value.lastIndexOf( "/" );
m_baseURL = value.substr( 0, index );
}
else
{
m_baseURL = "";
}
}
override protected function getTileURL(
level:Number,
row:Number,
col:Number
):URLRequest
{
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.
9 comments:
Great example. Have you tried using Akamai for storage of tile cache?
Interesting idea - will connect with some folks here at ESRI that have Akamai knowledge and see what we can come up with :-)
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
Glad you like it :-)
You are a madman Mr. Raad! Great stuff!
https://addons.mozilla.org/en-US/firefox/addon/6955 is another option for interacting with S3 in firefox.
hello,i want to known "JSON map service metadata" how to create,give me a simple sample for "MapServer".thank
Check out http://s3.amazonaws.com/ESRI_StreetMap_World_2D/MapServer
thanks.you help me more,I get my map metadata from my_map_service/MapServer?f=json. I'm intresting your blog.
Post a Comment