ArcGIS Server Flex API access MapABC map

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

ArcGIS Server Flex API access MapABC map

(in this case only study, personal interest if you want the application to commercial use, please contact the relevant manufacturer)

Loading map service MapABC to ArcGIS Server ArcGIS Server Flex, need to be rewritten in API class TiledMapServiceLayer.

Code to achieve:

packagecom.esri.viewer.components.common.mapABC

{

importcom.esri.ags.SpatialReference;

import com.esri.ags.geometry.Extent;

importcom.esri.ags.geometry.MapPoint;

importcom.esri.ags.layers.TiledMapServiceLayer;

importcom.esri.ags.layers.supportClasses.LOD;

importcom.esri.ags.layers.supportClasses.TileInfo;

importflash.net.URLRequest;

public classMapABCTileMapServiceLayer extends TiledMapServiceLayer

{

//Member variable

private var_tileInfo:TileInfo = new TileInfo(); // see buildTileInfo()

private var_wkid:int = 102113;

public functionMapABCTileMapServiceLayer()

{

super();

buildTileInfo();// to create our hardcoded tileInfo

setLoaded(true);// Map will only use loaded layers

}

//-----—-

// Full range

// – required tocalculate the tiles to use

//-----—-

override publicfunction get fullExtent():Extent

{

return newExtent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787,new SpatialReference(_wkid));

}

//-----—-

// Initialization range

// – needed ifMap doesn"t have an extent

//-----—-

override publicfunction get initialExtent():Extent

{

return newExtent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787,new SpatialReference(_wkid));

}

//-----—-

// Spatial reference system

// – needed ifMap doesn"t have a spatialReference

//-----—-

override publicfunction get spatialReference():SpatialReference

{

return newSpatialReference(_wkid);

}

//-----—-

// tileInfo

//-----—-

override publicfunction get tileInfo():TileInfo

{

return_tileInfo;

}

//-----—-

// units

// – needed ifMap doesn"t have it set

//-----—-

/*

override publicfunction get units():String

{

return"esriDecimalDegrees";

}//*/

//------------–

//

// The key method, used to read cache the image on the server

//getTileURL(level:Number, row:Number, col:Number):URLRequest

//

//------------–

overrideprotected function getTileURL(level:Number, row:Number, col:Number):URLRequest

{

var url:String ="http://emap"+(col%4)+".mapabc.com/mapabc/maptile?v=w2.61&&"+

"x=" + col +"&" +

"y=" + row +"&" +

"z=" + level;

return newURLRequest(url);

}

//------------–

//

// Custom methods, definition of map zoom level

//

//------------–

private functionbuildTileInfo():void

{

_tileInfo.height=256;

_tileInfo.width=256;

_tileInfo.origin=newMapPoint(-20037508.342787, 20037508.342787);

_tileInfo.spatialReference=newSpatialReference(_wkid);

_tileInfo.lods =[

new LOD(0,156543.033928, 591657527.591555),

new LOD(1,78271.5169639999, 295828763.795777),

new LOD(2,39135.7584820001, 147914381.897889),

new LOD(3,19567.8792409999, 73957190.948944),

new LOD(4,9783.93962049996, 36978595.474472),

new LOD(5,4891.96981024998, 18489297.737236),

new LOD(6,2445.98490512499, 9244648.868618),

new LOD(7,1222.99245256249, 4622324.434309),

new LOD(8,611.49622628138, 2311162.217155),

new LOD(9,305.748113140558, 1155581.108577),

new LOD(10,152.874056570411, 577790.554289),

new LOD(11,76.4370282850732, 288895.277144),

new LOD(12,38.2185141425366, 144447.638572),

new LOD(13,19.1092570712683, 72223.819286),

new LOD(14,9.55462853563415, 36111.909643),

new LOD(15,4.77731426794937, 18055.954822),

new LOD(16, 2.38865713397468,9027.977411),

new LOD(17,1.19432856685505, 4513.988705),

new LOD(18,0.597164283559817, 2256.994353),

new LOD(19,0.298582141647617, 1128.497176)

];

}

}

}

Implementation effect

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Tommy at December 13, 2013 - 12:42 AM