This library provides access to ESRI's ArcGIS Server via it's REST API from Google Maps API. The main concepts of this library are:
For developers who are familiar with the core Google Maps API classes, this library can be considered as a collection of custom/extension classes to the core API that facilitates access to ArcGIS Server. You can accomplish many tasks by using only those subclasses. Several principles are used in the design:
The following table describes the classes in the core Google Maps API and their corresponding sub classes in this library.
Core Google Maps API Class | ArcGIS Link Class |
---|---|
GOverlay, GGroundOverlay | ArcGISMapOverlay |
GTileLayer | ArcGISTileLayer |
GTileLayerOverlay | ArcGISTileLayerOverlay |
GMapType | ArcGISMapType |
GProjection | ArcGISProjection |
The GMap extension classes are built on top of a number of classes that
communicates with ArcGIS Server. Developers who want to get lower level access can
use those classes by calling the ArcGISTileLayer.getMapService()
or ArcGISMapOverlay.getMapService()
. Those classes are designed to
closely reflect the actual REST API.
Several principles are used in the design:
The following is a table that describes the REST resource and their corresponding classes:
REST Resource | Library Class |
---|---|
Map Service | ArcGISMapService |
Layer | ArcGISLayer |
Geocode Service | ArcGISGeocodeService |
GP Service | TBD |
Geometry Service | ArcGISGeometryService |
Image Service | TBD |
ArcGIS services may be published with different spatial reference systems. If they are pre-rendered as map tiles, they will use a certain "tiling scheme". Some of them may use the exact same tile scheme as Google maps, some may not. In order to let the core Google Maps API know how to load tiles correctly, it is necessary to get information about how the tiles are constructed from the server first. This is an asynchronous process. For this reason, it's often necessary to wait for the "load" event before using an ArcGIS Link class. It is not necessary to wait if...
Rule of thumb: when in doubt, always use 'load' event.
var tileLayer=new ArcGISTileLayer(url); GEvent.addListener(tileLayer,'load', function(){ // start use the tile Layer. });
This library provides additional spatial reference support by implementing interface
ArcGISSpatialReference, which converts between
Lat/Lng and map coordinates, then using an intermediate class
ArcGISProjection to bridge Google's
coordinate system to ArcGIS's system. This library includes a few built-in spatial references:
WGS84 (4326) and WebMercator (102113). It also has two of the most widely used projections:
LambertConformalConic and Transverse Mercator. Spatial references based on these
two projections can be used by calling ArcGISSpatialReferences.addSpatialReference(wkid, wkt)
.
A developer can also implement their own projection class and plug it in.
If the system fails to find an implemented spatial reference, it will use
ArcGISFlatSpatialReference
for somewhat less accurate coordinates transformation. Here is a summary of options:
gmap.addOverlay(new ArcGISMapOverlay(url));
gmap.addMapType(new ArcGISMapType(url));.
var maptype=new ArcGISMapType(url); GEvent.addListener(maptype, 'load', function(){ gmap.addMapType(maptype); });.
ArcGISSpatialReferences.addSpatialReference(2264, 'PROJCS["NAD_1983_StatePlane_North_Carolina_FIPS_3200_Feet",......'); var maptype=new ArcGISMapType(url); GEvent.addListener(maptype, 'load', function(){ gmap.addMapType(maptype); });.
var maptype=new ArcGISMapType(url); GEvent.addListener(maptype, 'load', function(){ gmap.addMapType(maptype); });.
function MySpatialReference=function(params){...} MySpatialReference.prototype.reverse=function(coordsArray){...return [lng,lat]}; MySpatialReference.prototype.forward=function(lnglatArray){...return [x,y]}; MySpatialReference.prototype.getWrapWidth=function(){...}; ArcGISSpatialReferences.addSpatialReference(myWkid,new MySpatialReference({...})); var maptype=new ArcGISMapType(url); GEvent.addListener(maptype, 'load', function(){ gmap.addMapType(maptype); });.
ArcGIS Maps can be added with one of the following types: ArcGISMapOverlay, ArcGISTileLayerOverlay, or ArcGISMapType.
ArcGISMapOverlay
is best suited for dynamic map service in which
sub layers can be turned on/off and map images will be generated on the fly.
They should be on top of map resources.
They are added to the G_MAP_OVERLAY_LAYER_PANE
.
ArcGISTileLayerOverlay
is best suited for some common shared service that maybe
used in different background context. They are below ArcGISMapOverlay
but on top of
the ArcGISTileLayer
s inside the MapTypes. They are in G_MAP_OVERLAY_LAYER_PANE
.
ArcGISMapOverlay
and ArcGISTileLayerOverlay
depends on the order they were added to Map.
The one added later will be on top of the one added earlier.
ArcGISMapType
is best suited for specialized background map. It consists of one or
more ArcGISTileLayer
and should stay at the bottom of the stack.
They are in G_MAP_MAP_PANE
.