ArcGIS Server Link for Google Maps JavaScript API V3

Examples

This library lets you add map resources accessible via ESRI ArcGIS Server™ REST API into Google Maps API V3 and provide some additional support for map tiles created with different spatial reference and tiling scheme.

.
TileLayer
TileLayerOptions
MapType
MapTypeOptions
MapOverlay
MapOverlayOptions
Projection
Catalog
MapService
Layer
GeocodeService
GeometryService
GPService
GPTask
RouteTask

SpatialReference
Geographic
LambertConformalConic
TransverseMercator
SphereMercator
SpatialRelationship
Util
Config

There are many objects used in the REST API that do not require a constructor and can be used just as object literal in the operation:

Field
TileInfo
LOD
ExportMapOptions
MapImage
IdentifyOptions
IdentifyResults
IdentifyResult

QueryOptions
ResultSet
FindOptions
FindResults
FindResult
Feature
GeocodeOptions
GeocodeResults
GeocodeResult
ReverseGeocodeOptions
ReverseGeocodeResult
BufferOptions
BufferResults
ProjectOptions
ProjectResults
RouteOptions
RouteResults

For a description and examples of how to use this library, check out the how-to.

class BufferOptions

This class represent the parameters needed in an buffer operation for a GeometryService. There is no constructor, use JavaScript object literal.
For more info see Project Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

Properties

Properties Type Description
bufferSpatialReference SpatialReference The well-known ID of or the spatial reference of the out geometries
distances Array.Number The distances the input geometries are buffered.
geometries Array.OverlayView|Array.Object Array of google.maps.LatLng, Polyline, Polygon, or ESRI Geometry format to project.
overlayOptions OverlayOptions how to render result overlay
unionResults Boolean If true, all geometries buffered at a given distance are unioned into a single (possibly multipart) polygon, and the unioned geometry is placed in the output array.
unit Number see esriSRUnitType Constants .

class BufferResults

This class represent the parameters needed in an project operation for a GeometryService. There is no constructor, use JavaScript object literal.
For more info see Project Operation.

Properties

Properties Type Description
geometries Array.OverlayView|Array.Object Array of google.maps.LatLng, Polyline, Polygon, or ESRI Geometry format to project.

class Catalog

The catalog resource is the root node and initial entry point into an ArcGIS Server host. This resource represents a catalog of folders and services published on the host.

Constructor

Constructor Description
Catalog(url:String) Create a ArcGIS service catalog instance using it's url: http://<host>/<instance>/rest/services

Properties

Properties Type Description
currentVersion String currentVersion
folders Array folders list
services Array list of services. Each has name, type property.

Events

Events Arguments Description
load None This event is fired when the catalog info is loaded.

class Config

This is an object literal that sets common configuration values used across the lib.

Properties

Properties Type Description
alwaysUseProxy Boolean whether to always use proxy page when send request to server.
proxyUrl String The URL to the web proxy page used in case the length of the URL request to an ArcGIS Server REST resource exceeds 2000 characters.

class Error

Error returned from Server. Syntax:

{
   "error" : 
  {
    "code" : 500, 
    "message" : "Object reference not set to an instance of an object.", 
    "details" : [
      "'geometry' parameter is invalid"
    ]
  }
  }
  

class ExportMapOptions

This class represent the parameters needed in an exportMap operation for a MapService. There is no constructor, use JavaScript object literal.
For more info see Export Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

Properties

Properties Type Description
bounds LatLngBounds bounds of map
dpi Number The dpi of the exported image, default 96
endTime Date The end time instant the exported map image if the service supports time (since AGS10). time=<timeInstant> or time=<startTime>, <endTime>, e.g. time=1199145600000, 1230768000000 (1 Jan 2008 00:00:00 GMT to 1 Jan 2009 00:00:00 GMT)
format String The format of the exported image. png | png8 | png24 | jpg | pdf | bmp | gif | svg The default value is png.
height Number height of image, ignored if size is specified;
imageSR SpatialReference The well-known ID of the spatial reference of the exported image or instance of SpatialReference.
layerDefinitions Object Allows you to filter the features of individual layers in the exported map by specifying definition expressions for those layers. Syntax: { "<layerId1>" : "<layerDef1>" , "<layerId2>" : "<layerDef2>" } key is layerId returned by server, value is definition for that layer.
layerIds Number[] list of layer ids. If not specified along with layerOptions, show list of visible layers.
layerOptions String show | hide | include | exclude. If not specified with along layerIds, show list of visible layers.
layerTimeOptions Object layerTimeOptions The time options per layer. Users can indicate whether or not the layer should use the time extent specified by the time parameter or not, whether to draw the layer features cumulatively or not and the time offsets for the layer. Syntax:
 {
  "<layerId1>" : {
    //If true, use the time extent specified by the time parameter
    "useTime" : < true | false >,
    //If true, draw all the features from the beginning of time for that data
    "timeDataCumulative" : < true | false >,
    //Time offset for this layer so that it can be overlaid on the top of a previous or future time period
    "timeOffset" : <timeOffset1>,
    "timeOffsetUnits" : "<esriTimeUnitsCenturies | esriTimeUnitsDays | esriTimeUnitsDecades | 
                             esriTimeUnitsHours | esriTimeUnitsMilliseconds | esriTimeUnitsMinutes | 
                             esriTimeUnitsMonths | esriTimeUnitsSeconds | esriTimeUnitsWeeks | esriTimeUnitsYears |
                             esriTimeUnitsUnknown>"
  },
  "<layerId2>" : {
    "useTime" : < true | false >,
    "timeDataCumulative" : < true | false >,
    "timeOffsetOffset" : <timeOffset2>,
    "timeOffsetUnits" : "<timeOffsetUnits2>"
  }
}
time Date The time instant the exported map image if the service supports time (since AGS10).
transparent Boolean If true, the image will be exported with the background color of the map set as its transparent color. note the REST API default value is false. The default value is true.
width Number width of image, ignored if size is specified;

class Feature

This class represent JSON feature object as returned by the REST API. There is no constructor, use JavaScript object literal.
For more info see Feature Object. Syntax:

{
  "geometry" : <overlays>,

  "attributes" : {
    "name1" : <value1>,
    "name2" : <value2>,
  }
}

Properties

Properties Type Description
attributes Object attributes as name-value JSON object.
geometry Marker[]|Polyline[]|Polygon[] geometry

class Field

This class represents a field in a Layer. It is accessed from the fields property. There is no constructor for this class, use Object Literal.

Properties

Properties Type Description
alias String field alias.
domain Domain domain
length Int length.
name String field Name
type String field type (esriFieldTypeOID|esriFieldTypeString|esriFieldTypeInteger|esriFieldTypeGeometry}.

class FindOptions

This class represent the parameters needed in an find operation for a MapService. There is no constructor, use JavaScript object literal.
For more info see Find Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

Properties

Properties Type Description
contains Boolean If false, the operation searches for an exact match of the searchText string. An exact match is case sensitive. Otherwise, it searches for a value that contains the searchText provided. This search is not case sensitive. The default is true. The default value is true.
layerIds Number[] The layers to perform the find operation on. The layers to perform the find operation on. The layers are specified as a comma-separated list of layer ids. It can also be an array of layer NAMEs.
maxAllowableOffset Number This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the find operation
returnGeometry Boolean If true, the resultset will include the geometries associated with each result. The default value is true.
searchFields String[] The names of the fields to search. The fields are specified as a comma-separated list of field names. If this parameter is not specified, all fields are searched. This can also be an array with field names .
searchText String The search string. This is the text that is searched across the layers and the fields that the user specifies.

class FindResult

This class represent one entry in the results of a find operation for a MapService. There is no constructor, use JavaScript object literal.
For more info see Find Operation.

Properties

Properties Type Description
displayFieldName String displayFieldName
feature Feature Feature
foundFieldName String foundFieldName
geometryType String esriGeometryPoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope
layerId Number layerId
layerName String layerName
value String value of the display field

class FindResults

This class represent the results of a find operation for a MapService. There is no constructor, use JavaScript object literal.
For more info see Find Operation.

Properties

Properties Type Description
results FindResult[] The find results as an array of FindResult

class FlatSpatialReference

This class (gmaps.ags.FlatSpatialReference) is a special type of coordinate reference assuming lat/lng will increase evenly as if earth is flat. Approximate for small regions without implementing a real projection. This class extends SpatialReference.

Constructor

Constructor Description
FlatSpatialReference(params:Object) Create a flat transform spatial reference. The params passed in constructor should have the following properties:
  • wkid: wkid
  • latlng: Envelope in latlng unit;
  • coords: Envelope in coords unit
  • Methods

    Methods Return Value Description
    forward(lnglat:Number[]) Number[] See SpatialReference
    getCircumference() Number See SpatialReference
    reverse(coords:Number[]) Number[] See SpatialReference

    class GeocodeOptions

    This class represent the parameters needed in a find address candidate operation on a GeocodeService. There is no constructor, use JavaScript object literal.
    For more info see Find Adddress Candidates Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    inputs Object an object literal with name-value pair of input values.
    outFields String|String[] The list of fields to be included in the returned resultset.
    outSR int|SpatialReference

    class GeocodeResult

    This class represent one entry in the results of a find address operation for a GeocodeService. There is no constructor, use JavaScript object literal.
    For more info see Find Adddress Candidates Operation.

    Properties

    Properties Type Description
    address String matched address
    attributes Object attributes as name-value JSON object. e.g. {"StreetName" : "MASON", "StreetType" : "ST"}
    location google.maps.LatLng matched location
    score Number matching score

    class GeocodeResults

    This class represent the results of an find address candidate operation for a GeocodeService. There is no constructor, use JavaScript object literal.
    For more info see Find Adddress Candidates Operation.

    Properties

    Properties Type Description
    candidates GeocodeResult[] The find address results as an array of GeocodeResult

    class GeocodeService

    This class (gmaps.ags.GeocodeService) represent an ArcGIS GeocodeServer service.

    Constructor

    Constructor Description
    GeocodeService(url:String) Creates a GeocodeService class. Params:
  • url: URL of service, syntax: http://{catalog-url}/{serviceName}/GeocodeServer
  • Properties

    Properties Type Description
    addressFields Field[] input fields. Each entry is an object of type Field, plus required(true|false)
    candidateFields Field[] candidate Fields. Each entry is an object of type Field
    intersectionCandidateFields Field[] intersectionCandidateFields Each entry is an object of type Field
    locatorProperties Object an object with key-value pair that is specific to Locator type.
    serviceDescription String serviceDescription
    spatialReference SpatialReference spatialReference

    Methods

    Methods Return Value Description
    findAddressCandidates(params:GeocodeOptions, callback:Function, errback:Function) None The findAddressCandidates operation is performed on a geocode service resource. The result of this operation is a resource representing the list of address candidates. This resource provides information about candidates including the address, location, and score. param is an instance of GeocodeOptions. An instance of GeocodeResults will be passed into callback function.
    geocode(params:GeocodeOptions, callback:Function) None Alias of GeocodeService.findAddressCandidates;
    reverseGeocode(params:ReverseGeocodeOptions, callback:Function, errback:Function) None The reverseGeocode operation is The reverseGeocode operation is performed on a geocode service resource. The result of this operation is a reverse geocoded address resource. param is an instance of ReverseGeocodeOptions. An instance of ReverseGeocodeResult will be passed into callback function.

    Events

    Events Arguments Description
    load None This event is fired when the service and it's service info is loaded.

    class Geographic

    This class (gmaps.ags.Geographic) will simply retuns same LatLng as Coordinates. The param should have wkid property. Any Geographic Coordinate Systems (eg. WGS84(4326)) can use this class As-Is.
    Note: This class does not support datum transformation. This class extends SpatialReference.

    Constructor

    Constructor Description
    Geographic(params:Object) Creates a Geographic Coordinate System. e.g.:
    var g = new Geographic({"wkid":4326});
    var g2 = new gmaps.ags.Geographic({"wkid":4326});

    class GeometryService

    This class (gmaps.ags.GeometryService) represent an ArcGIS Geometry service.

    Constructor

    Constructor Description
    GeometryService(url:String) Creates an GeometryService class. Params:
  • url: URL of service, syntax: http://{catalog-url}/{serviceName}/GeometryServer
  • Methods

    Methods Return Value Description
    buffer(params:BufferOptions, callback.:Function, errback:Function) None This resource projects an array of input geometries from an input spatial reference to an output spatial reference. Result of type BufferResults is passed in callback function.
    project(params:ProjectOptions, callback:Function, errback:Function) None This resource projects an array of input geometries from an input spatial reference to an output spatial reference. Result of type ProjectResults is passed in callback function.

    class GeometryType

    List of Geometry type supported by ArcGIS server.

    Properties

    Properties Type Description
    ENVELOPE String esriGeometryEnvelope
    MULTIPOINT String esriGeometryMultipoint
    POINT String esriGeometryPoint
    POLYGON String esriGeometryPolygon
    POLYLINE String esriGeometryPolyline

    class GPService

    GPService

    Properties

    Properties Type Description
    executionType String
    resultMapServerName String
    serviceDescription String
    tasks String[]

    Events

    Events Arguments Description
    load None This event is fired when the service and it's service info is loaded.

    class GPTask

    GPTask

    Properties

    Properties Type Description
    category String
    displayName String
    executionType String
    helpUrl String
    name String
    name String
    name String
    parameters GPParameter[] see GPParameter
    resultMapServerName String
    tasks String[]

    Methods

    Methods Return Value Description
    execute(p:GPOptions, callback:Function, errback:Function) None execute a GeoProcessing task

    class IdentifyOptions

    This class represent the parameters needed in an identify operation for a MapService. There is no constructor, use JavaScript object literal.
    For more info see Identify Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    bounds google.maps.LatLngBounds The bounding box of the map currently being viewed.
    dpi Number dpi of image, default 96;
    f String The response format. html | json . The default value is json.
    geometry Geometry The geometry to identify on, google.maps.LatLng, Polyline, or Polygon.
    height Number height of image in pixel
    layerIds Number[] The layers to perform the identify operation on.
    layerOption String The layers to perform the identify operation on. 'top|visible|all'.
    maxAllowableOffset Number This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the identify operation
    overlayOptions OverlayOptions how results should be rendered. See OverlayOptions
    returnGeometry Boolean If true, the resultset will include the geometries associated with each result. The default value is true.
    tolerance Number The distance in screen pixels from the specified geometry within which the identify should be performed
    width Number width of image in pixel

    class IdentifyResult

    This class represent one entry in the results of an identify operation for a MapService. There is no constructor, use JavaScript object literal.
    For more info see Identify Operation.

    Properties

    Properties Type Description
    displayFieldName String displayFieldName
    features Feature Feature
    layerId Number layerId
    layerName String layerName
    value String value of the display field

    class IdentifyResults

    This class represent the results of an identify operation for a MapService. There is no constructor, use JavaScript object literal.
    For more info see Identify Operation.

    Properties

    Properties Type Description
    results IdentifyResult[] The identify results as an array of IdentifyResult

    class LambertConformalConic

    This class (gmaps.ags.LambertConformalConic) represents a Spatial Reference System based on Lambert Conformal Conic Projection. This class extends SpatialReference.

    Constructor

    Constructor Description
    LambertConformalConic(params:Object) Create a Lambert Conformal Conic Projection based Spatial Reference. The params passed in construction should include the following properties:
    -wkid: well-known id
    -semi_major: ellipsoidal semi-major axis in meter
    -unit: meters per unit
    -inverse_flattening: inverse of flattening of the ellipsoid where 1/f = a/(a - b)
    -standard_parallel_1: phi1, latitude of the first standard parallel
    -standard_parallel_2: phi2, latitude of the second standard parallel
    -latitude_of_origin: phiF, latitude of the false origin
    -central_meridian: lamdaF, longitude of the false origin (with respect to the prime meridian)
    -false_easting: FE, false easting, the Eastings value assigned to the natural origin
    -false_northing: FN, false northing, the Northings value assigned to the natural origin

    e.g. North Carolina State Plane NAD83 Feet:
    var ncsp82 = new gmaps.ags.LambertConformalConic({wkid:2264, semi_major: 6378137.0,inverse_flattening: 298.257222101, standard_parallel_1: 34.33333333333334, standard_parallel_2: 36.16666666666666, central_meridian: -79.0, latitude_of_origin: 33.75,'false_easting': 2000000.002616666, 'false_northing': 0, unit: 0.3048006096012192 });

    Methods

    Methods Return Value Description
    forward(lnglat:Number[]) Number[] see SpatialReference
    getCircumference() Number see SpatialReference
    reverse(coords:Number[]) Number[] see SpatialReference

    class Layer

    This class (gmaps.ags.Layer) The layer / table(v10+) resource represents a single layer / table in a map of a map service published by ArcGIS Server.

    Constructor

    Constructor Description
    Layer(url:String) Create a ArcGIS map Layer using it's url (http://[mapservice-url]/[layerId])

    Properties

    Properties Type Description
    copyrightText String copyrightText, only available after load.
    defaultVisibility Boolean defaultVisibility
    definitionExpression String Layer definition.
    description String description
    drawingInfo DrawingInfo rendering info See DrawingInfo
    extent Envelope extent
    fields Field[] fields, only available after load. See Field
    geometryType String geometryType type(esriGeometryPoint|..), only available after load.
    hasAttachments Boolean hasAttachments
    id Number layer ID
    maxScale Number maxScale
    minScale Number minScale
    name String layer Name
    parentLayer Layer parent Layer Layer
    relationships Array relationships (id, name, relatedTableId)
    subLayers Layer[] sub Layers. Layer[].
    timeInfo TimeInfo timeInfo
    type String Feature Layer|Image Layer
    typeIdField String typeIdField
    types Array subtypes: id, name, domains.
    visibility Boolean Visibility of this layer

    Methods

    Methods Return Value Description
    isInScale(scale:Number) Boolean Whether the layer is viewable at given scale
    loadInfo(opt_callback:Function) None Load extra information such as it's fields from layer resource. If opt_callback function will be called after it is loaded
    query(params:QueryOptions, callback:Function, errback:Function) None The query operation is performed on a layer resource. The result of this operation is a resultset resource that will be passed in the callback function. param is an instance of QueryOptions
    For more info see Query Operation.
    queryRelatedRecords(params:QueryRelatedRecordsParameters, callback:Function, errback:Function) None The query related records operation is performed on a layer / table resource. The result of this operation are featuresets grouped by source layer / table object IDs. Each featureset contains Feature objects including the values for the fields requested by the user. For related layers, if you request geometry information, the geometry of each feature is also returned in the featureset. For related tables, the featureset does not include geometries.

    class LOD

    This class contains information about one "Level Of Detail" for a cached map service. It is the type of lods property of TileInfo
    There is no constructor for this class. Use as object literal.

    Properties

    Properties Type Description
    level Number zoom level.
    resolution Number map unit per pixel
    scale Number actual map scale. e.g a value of 5000 means 1:5000 scale.

    class MapImage

    This is the result of MapService.exportMap operation. There is no constructor, use as JavaScript object literal.

    Properties

    Properties Type Description
    bounds LatLngBounds The bounding box of the exported image.
    height Number height of the exported image.
    href String URL of image
    scale Number scale of the exported image.
    width Number width of the exported image.

    class MapOverlay

    This class (gmaps.ags.MapOverlay) extends the Google Maps API's OverlayView that draws map images from data source on the fly. It is also known as "Dynamic Maps". It can be added to the map via GMap.addOverlay method. The similar class in the core GMap API is GGroundOverlay, however, the instance of this class always cover the viewport exactly, and will redraw itself as map moves.

    Constructor

    Constructor Description
    MapOverlay(service:String|MapService, opt_overlayOpts:MapOverlayOptions) Creates an Map Overlay using url of the map service and optional MapOverlayOptions.
  • service (required) is url of the underline MapService or the MapService itself.
  • opt_overlayOpts (optional) is an instance of MapOverlayOptions.
  • Methods

    Methods Return Value Description
    draw() None The API invokes a separate draw() method on the overlay whenever it needs to draw the overlay on the map (including when first added). Implement this method to draw or update the overlay. This method is called after onAdd() and when the position from projection.fromLatLngToPixel() would return a new value for a given LatLng. This can happen on change of zoom, center, or map type. It is not necessarily called on drag or resize. See OverlayView.draw.
    getMapService() MapService Gets Image Opacity. return opacity between 0-1.
    getOpacity() Number Gets Image Opacity. return opacity between 0-1.
    hide() None Hide the overlay
    isHidden() Boolean Check if the overlay is visible, and within zoomzoom range and current map bounds intersects with it's fullbounds.
    onAdd() None Handler when overlay is added. Interface method. This will be called after setMap(map) is called.
    onRemove() None
    refresh() None Refresh the map image in current view port.
    setOpacity(opacity:Number) None Sets Image Opacity. parameter opacity between 0-1.
    show() None Makes the overlay visible.

    Events

    Events Arguments Description
    drawend None This event is fired after the the drawing request was returned by server.
    drawstart None This event is fired before the the drawing request was sent to server.

    class MapOverlayOptions

    Instance of this class are used in the opt_ovelayOpts argument to the constructor of the MapOverlay class. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    exportOptions ExportMapOptions See ExportMapOptions
    map google.maps.Map map to attach to.
    maxResolution Number max zoom level.
    minResolution Number min zoom level.
    name String name assigned to this MapOverlay
    opacity Number Opacity of map image from 0.0 (invisible) to 1.0 (opaque) The default value is 1.0.

    class MapService

    This class (gmaps.ags.MapService) is the core class for all map service operations. It represents an ArcGIS Server map service that offer access to map and layer content

    Constructor

    Constructor Description
    MapService(url:String) Creates a MapService objects that can be used by UI components.
    • url (required) is the URL of the map servive, e.g. http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer.
        Note the spatial reference of the map service must already exists in the spatialReferences if actual coordinates transformation is needed.

    Properties

    Properties Type Description
    copyrightText String copyrightText
    description String description
    documentInfo Object Object with the folloing properties: Title, Author,Comments,Subject,Category,Keywords
    fullExtent Envelope fullExtent, see Envelope
    initialExtent Envelope initialExtent, see Envelope
    layers Array(Layer) array of Layers.
    loaded Boolean if map service meta data is loaded.
    mapName String map frame Name inside the map document
    serviceDescription String serviceDescription
    singleFusedMapCache Boolean if map cache is singleFused
    spatialReference SpatialReference spatialReference
    supportedImageFormatTypes String supportedImageFormatTypes, comma delimited list.
    tables Array(Layer) array of Tables.
    tileInfo TileInfo See TileInfo
    timeInfo TimeInfo see TimeInfo
    units String unit
    url String map service URL

    Methods

    Methods Return Value Description
    exportMap(params:ExportMapOptions, callback:Function, errback:Function) None Export an image with given parameters. For more info see Export Operation.
    The params is an instance of ExportMapOptions. The following properties will be set automatically if not specified:...
    The callback is the callback function with argument of an instance of MapImage.
    find(opts:FindOptions, callback:Function, errback:Function) None Find features using the FindOptions and process FindResults using the callback function. For more info see Find Operation.
    getInitialBounds() None
    getLayer(nameOrId:String|Number) Layer Get a map layer by it's name(String) or id (Number), return Layer.
    getLayerDefs() Object Get the layer definitions.
    getVisibleLayerIds() Number[] get a list of visible layer's Ids
    identify(params:IdentifyOptions, callback:Function, errback:Function) None Identify features on a particular Geographic location, using IdentifyOptions and process IdentifyResults using the callback function. For more info see Identify Operation.
    queryLayer(layerNameOrId:Number|String, params:QueryOptions, callback:Function, errback:Function) None Query a layer with given id or name using the QueryOptions and process ResultSet using the callback function. See Layer. For more info see Query Layer Operation.

    Events

    Events Arguments Description
    load service:MapService This event is fired when the service and it's service info is loaded.

    class MapType

    This class (gmaps.ags.MapType) extends the Google Maps API's GMapType. It holds a list of TileLayers.

    Because all tileLayers are loaded asynchronously, and currently the core API does not have method to refresh tiles on demand, if you do not load the default Google maps, you should either 1) add to map after it STR.load event is fired, or) trigger an map type change to force refresh. See Issue 279

    Note: all tiled layer in the same map type must use same spatial reference and tile scheme.

    Constructor

    Constructor Description
    MapType(tileLayers:(Array.<TileLayer>|String), opt_typeOpts:MapTypeOptions) Creates a MapType, with a array of TileLayers, or a single URL as shortcut.

    Methods

    Methods Return Value Description
    getOpacity() None
    getTile(tileCoord:Point, zoom:Number, ownerDocument:) Node Get a tile for given tile coordinates Returns a tile for the given tile coordinate (x, y) and zoom level. This tile will be appended to the given ownerDocument.
    releaseTile(node:Node) None Release tile and cleanup
    setOpacity(op:) None

    class MapTypeOptions

    Instance of this class are used in the opt_typeOpts argument to the constructor of the MapType class. See google.maps.MapType. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    alt String Alt text to display when this MapType's button is hovered over in the MapTypeControl. Optional.
    map google.maps.Map The map instance. Can be useful for copyright info. May not need if API provides access to map instance later.
    maxZoom Number The maximum zoom level for the map when displaying this MapType. Required for base MapTypes, ignored for overlay MapTypes.
    minZoom Number The minimum zoom level for the map when displaying this MapType. Optional; defaults to 0.
    name String map type name
    projection Projection an instance of Projection.
    radius Number Radius of the planet for the map, in meters. Optional; defaults to Earth's equatorial radius of 6378137 meters.
    tileSize Size The dimensions of each tile. Required.

    class NetworkService

    NetworkService

    Properties

    Properties Type Description
    closestFacilityLayers String[]
    routeLayers String[]
    serviceAreaLayers String[]
    serviceDescription String

    Events

    Events Arguments Description
    load None This event is fired when the service and it's service info is loaded.

    class OverlayOptions

    Instance of this classes that specify how the geometry features returned by ArcGIS server should be rendered in the browser. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    markerOptions google.maps.MarkerOptions style option for points.
    polygonOptions google.maps.PolygonOptions style option for polygons http://code.google.com/apis/maps/documentation/javascript/reference.html#PolygonOptions
    polylineOptions google.maps.PolylineOptions style option for polylines. http://code.google.com/apis/maps/documentation/javascript/reference.html#PolylineOptions
    strokeColor String The stroke color in HTML hex style, ie. "#FFAA00"
    strokeOpacity Number The stroke opacity between 0.0 and 1.0
    strokeWeight Number The stroke width in pixels.
    zIndex Number The zIndex compared to other overlays.
    {icon} String|MarkerImage Icon for the foreground
    {shadow} String|MarkerImage Shadow image

    class Projection

    This class (gmaps.ags.Projection) implements a custom google.maps.Projection from the core Google Maps API. It carries a real SpatialReference object to convert LatLng from/to map coordinates, and tiling scheme informations to convert map coordinates from/to pixel coordinates.

    Constructor

    Constructor Description
    Projection(tileInfo:TileInfo) Creates an ArcGIS Map Tiling Reference System.
    • tileInfo tiling information. An instance of TileInfo
    Applications normally do not create instances of this class directly.

    Methods

    Methods Return Value Description
    fromLatLngToPoint(gLatLng:LatLng, opt_point:Point) Point See google.maps.Projection.
    fromPointToLatLng(pixel:Point, opt_nowrap:Boolean) LatLng See google.maps.Projection.
    getScale(zoom:Number) Number Get the scale at given level;

    class ProjectOptions

    This class represent the parameters needed in an project operation for a GeometryService. There is no constructor, use JavaScript object literal.
    For more info see Project Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    geometries Array.|Array. Array of google.maps.LatLng, Polyline, Polygon, or ESRI Geometry format to project.
    geometryType GeometryType esriGeometryPoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope
    inSpatialReference SpatialReference The well-known ID of or the spatial reference of the input geometries
    outSpatialReference SpatialReference The well-known ID of or the spatial reference of the out geometries

    class ProjectResults

    This class represent the parameters needed in an project operation for a GeometryService. There is no constructor, use JavaScript object literal.
    For more info see Project Operation.

    Properties

    Properties Type Description
    geometries Array.OverlayView|Array.Object Array of google.maps.LatLng, Polyline, Polygon, or ESRI Geometry format to project.

    class QueryOptions

    This class represent the parameters needed in an query operation for a Layer. There is no constructor, use JavaScript object literal.
    For more info see Query Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    Boolean [returnIdsOnly] If true, the response only includes an array of object IDs. Otherwise the response is a feature set. The default is false.
    geometry OverlayView|OverlayView[] The geometry to apply as the spatial filter.
    Number [maxAllowableOffset] This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the query operation
    objectIds Int[] The object IDs of this layer / table to be queried
    outFields String[] The list of fields to be included in the returned resultset.
    OverlayOptions [overlayOptions] See OverlayOptions
    returnGeometry Boolean If true, If true, the resultset will include the geometries associated with each result. The default value is true.
    spatialRelationship SpatialRelationship The spatial relationship to be applied on the input geometry while performing the query. The supported spatial relationships include intersects, contains, envelope intersects, within, etc. The default spatial relationship is intersects. See SpatialRelationship
    String[] [outFields] The list of fields to be included in the returned resultset. This list is a comma delimited list of field names.
    text String A literal search text. If the layer has a display field associated with it, the server searches for this text in this field. This parameter is a short hand for a where clause of: where [displayField]like '%[text]%'. The text is case sensitive. This parameter is ignored if the where parameter is specified.
    where String A where clause for the query filter. Any legal SQL where clause operating on the fields in the layer is allowed.

    class QueryRelatedRecordsParameters

    This class represent the parameters needed in an query related records operation for a Layer. There is no constructor, use JavaScript object literal.
    For more info see Query Related Records Operation.

    Properties

    Properties Type Description
    definitionExpression String The definition expression to be applied to the related table / layer. From the list of objectIds, only those records that conform to this expression will be returned.
    f String The response format. html | json | kmz . The default value is json.
    Number [maxAllowableOffset] This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the query operation
    objectIds Int|Int The object IDs of this layer / table to be queried
    outSR Number The well-known ID of the spatial reference of the output geometries
    relatioshipId Int The ID of the relationship to be queried
    returnGeometry Boolean If true, If true, the resultset will include the geometries associated with each result. The default value is true.
    String, [outFields] The list of fields to be included in the returned resultset. This list is a comma delimited list of field names.

    class RelatedRecord

    This class represent the result of an query related records operation for a Layer. There is no constructor, use JavaScript object literal.
    For more info see Query Operation.

    Properties

    Properties Type Description
    objectId int objectid of original record
    relatedRecords Array list of Features.

    class RelatedRecords

    This class represent the results of an query related records operation for a Layer. There is no constructor, use JavaScript object literal.
    For more info see Query Operation.

    Properties

    Properties Type Description
    displayFieldName String display Field Name for layer
    geometryType String esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolygon | esriGeometryPolyline
    relatedRecordGroups Array list of related records
    spatialReference Object spatial Reference wkid info only

    class ResultSet

    This class represent the results of an query operation for a Layer. There is no constructor, use JavaScript object literal.
    For more info see Query Operation.

    Properties

    Properties Type Description
    displayFieldName String display Field Name for layer
    features Feature[] result as array of Feature
    fieldAliases Object Field Name's Aliases. key is field name, value is alias.
    geometryType GemetryType esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolygon | esriGeometryPolyline
    objectIdFieldName String objectIdFieldName when returnIdsOnly=true
    objectIds int[] objectIds when returnIdsOnly=true

    class ReverseGeocodeOptions

    This class represent the parameters needed in a reverseGeocode operation on a GeocodeService. There is no constructor, use JavaScript object literal.
    For more info see Reverse Geocode Operation. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    distance Number The distance in meters from the given location within which a matching address should be searched.
    location google.maps.LatLng an object literal of LatLng.

    class ReverseGeocodeResult

    This class represent one entry in the results of a find address operation for a GeocodeService. There is no constructor, use JavaScript object literal.
    For more info see Reverse Geocode Operation.

    Properties

    Properties Type Description
    address Object matched address, object literal with name-value address parts. e.g.: { "Street" : "771 TUNNEL AVE", "Zone" : "94005" }
    location google.maps.LatLng matched location

    class RouteOptions

    intance that specify how a route should be solved. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    barriers google.maps.LatLng[]|Marker[]
    findBestSequence Boolean If true, the solver should resequence the route in the optimal order. The default is as defined in the network layer.
    preserveFirstStop Boolean If true, the solver should resequence the route in the optimal order. The default is as defined in the network layer.
    preserveLastStop Boolean If true, the solver should resequence the route in the optimal order. The default is as defined in the network layer.
    returnDirections Boolean If true, directions will be generated and returned with the analysis results. Default is true
    returnRoutes Boolean If true, routes will be returned with the analysis results. Default is true.
    stops google.maps.LatLng[]|Marker[]

    class RouteResults

    intance that specify the results of the solve operation.

    Properties

    Properties Type Description
    stops google.maps.LatLng[]

    class RouteTask

    This class (gmaps.ags.RouteTask) represent a Network Layer resource deployed in a NetWorkService. It can solve a route based on stops, barrier

    Constructor

    Constructor Description
    RouteTask(url:String) Create a route task with the URL of the routing server resource.

    Methods

    Methods Return Value Description
    solve(opt_Route:RouteOptions, callback:Function, errback:Function) None Solve a route based on inputs such as stops and barriers. Result of type RouteResults is passed to Function callback, and error of type Error is passed to Function errback.

    class SpatialReference

    This class (gmaps.ags.SpatialReference) is for coordinate systems that converts value between geographic and real-world coordinates. The following classes extend this class: Geographic, SphereMercator, LambertConformalConic, and TransverseMercator.

    Constructor

    Constructor Description
    SpatialReference(params:Object) Create A Generic Spatial Reference Object The params passed in constructor is a javascript object literal and depends on the type of Coordinate System to construct.

    Properties

    Properties Type Description
    wkid Number well-known coodinate system id (EPSG code)
    wkt String well-known coodinate system text

    Methods

    Methods Return Value Description
    forward(lnglat:Number[]) Number[] Convert Lat Lng to real-world coordinates. Note both input and output are array of [x,y], although their values in different units.
    getCircumference() Number Get the map the periodicity in x-direction, in map units NOT pixels
    reverse(coords:Number[]) Number[] Convert real-world coordinates to Lat Lng. Note both input and output are are array of [x,y], although their values are different.
    toJSON() To JSON String
    register(wkid/wkt:Number|String, wktOrSR:Object) SpatialReference static method. Call with Syntax SpatialReference.register(..). Add A Spatial Reference to the internal collection of Spatial References. the wktOrSR parameter can be String format of "well-known text" of the Spatial Reference, or an instance of SpatialReference.
  • If passes in String WKT format, to be consistent, it should use the same format as listed in ESRI documentation. For example, add NC State Plane NAD83 as String:
    SpatialReference.register(2264,'PROJCS["NAD_1983_StatePlane_North_Carolina_FIPS_3200_Feet", GEOGCS["GCS_North_American_1983", DATUM["D_North_American_1983", SPHEROID["GRS_1980",6378137.0,298.257222101]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic"], PARAMETER["False_Easting",2000000.002616666], PARAMETER["False_Northing",0.0], PARAMETER["Central_Meridian",-79.0], PARAMETER["Standard_Parallel_1",34.33333333333334], PARAMETER["Standard_Parallel_2",36.16666666666666], PARAMETER["Latitude_Of_Origin",33.75], UNIT["Foot_US",0.3048006096012192]]');
    Note: only Lambert Conformal Conic and Transverse Mercator Projection based Spatial References are supported if added via WKT String.
  • If passes in an instance of SpatialReference, it can be one of the built in classes, or a class that extends SpatialReference. For example, add NC State Plane NAD83 as SR:
    SpatialReferences.register(2264: new LambertConformalConic({ wkid: 2264, semi_major: 6378137.0, inverse_flattening: 298.257222101, standard_parallel_1: 34.33333333333334, standard_parallel_2: 36.16666666666666, central_meridian: -79.0, latitude_of_origin: 33.75, 'false_easting': 2000000.002616666, 'false_northing': 0, unit: 0.3048006096012192 });
  • class SpatialRelationship

    This is actually a list of constants that represent spatial relationship types.

    Properties

    Properties Type Description
    CONTAINS String esriSpatialRelContains
    CROSSES String esriSpatialRelCrosses
    ENVELOPE_INTERSECTS String esriSpatialRelEnvelopeIntersects
    INDEX_INTERSECTS String esriSpatialRelIndexIntersects
    INTERSECTS String esriSpatialRelIntersects
    OVERLAPS String esriSpatialRelOverlaps
    TOUCHES String esriSpatialRelTouches
    WITHIN String esriSpatialRelWithin

    class SphereMercator

    This class (gmaps.ags.SphereMercator) is the Projection Default Google Maps uses. It is a special form of Mercator. This class extends SpatialReference.

    Constructor

    Constructor Description
    SphereMercator(params:Object) Creates a Spatial Reference based on Sphere Mercator Projection. The params passed in constructor should have the following properties:
    -wkid: wkid
    -semi_major: ellipsoidal semi-major axis
    -unit: meters per unit
    -central_meridian: lamdaF, longitude of the false origin (with respect to the prime meridian)

    e.g. The "Web Mercator" used in ArcGIS Server:
    var web_mercator = new SphereMercator({wkid: 102113, semi_major:6378137.0, central_meridian:0, unit: 1 });

    Methods

    Methods Return Value Description
    forward(lnglat:Number[]) Number[] See SpatialReference
    getCircumference() Number See SpatialReference
    reverse(coords:Number[]) Number[] See SpatialReference

    class TileInfo

    This class contains information about map tile infornation for a cached map service.
    There is no constructor for this class.

    Properties

    Properties Type Description
    cols Number tile cols size, e.g. 512, must be same as rows
    compressionQuality Number JPEG only.0-100.
    dpi Number dot per inch for map tiles.
    format String PNG8 | PNG24 | PNG32 | GIF | JPEG
    lods LOD[] Array of Level of Details. See LOD
    origin Point origin of tile system of type
    rows Number tile row size, e.g. 512, must be same as cols
    spatialReference SpatialReference spatial reference. wkid info only.

    class TileLayer

    This class (gmaps.ags.TileLayer) provides access to a cached ArcGIS Server map service. There is no GTileLayer class in Google Maps API V3, but this class is kept to allow finer control of zoom levels for each individual tile sets within a map type, such as zoom level range and opacity.
    This class can be used in MapType

    Constructor

    Constructor Description
    TileLayer(service:MapService, opt_layerOpts:TileLayerOptions) Creates a tile layer from a cached by ArcGIS map service.
    service (required) is the underline MapService
    opt_layerOpts (optional) is an instance of TileLayerOptions.

    Methods

    Methods Return Value Description
    getMapService() MapService get the underline Map Service
    getOpacity() Number get the opacity (0-1) of the tile layer
    setOpacity(op:Number) None set Opacity

    class TileLayerOptions

    Instances of this class are used in the opt_layerOpts argument to the constructor of the TileLayer class. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.

    Properties

    Properties Type Description
    hosts String host pattern of tile servers if they are numbered. Most browser has default restrictions on how many concurrent connections can be made to a single host. One technique to workaround this is to create multiple hosts and rotate them when loading tiles. The syntax is prefix[numberOfHosts]suffix, for example, "mt[4].google.com" means rotate hosts in mt0.google.com, mt1.google.com, mt2.google.com, mt3.google.com (4 hosts).
    maxZoom Number max zoom level.
    minZoom Number min zoom level.
    opacity Number opacity (0-1).

    class TransverseMercator

    This class (gmaps.ags.TransverseMercator) represents a Spatial Reference System based on Transverse Mercator Projection This class extends SpatialReference.

    Constructor

    Constructor Description
    TransverseMercator(params:Object) Create a Transverse Mercator Projection. The params passed in constructor should contain the following properties:

    -wkid: well-known id
    -semi_major: ellipsoidal semi-major axis in meters
    -unit: meters per unit
    -inverse_flattening: inverse of flattening of the ellipsoid where 1/f = a/(a - b)
    -Scale Factor: scale factor at origin
    -latitude_of_origin: phiF, latitude of the false origin
    -central_meridian: lamdaF, longitude of the false origin (with respect to the prime meridian)
    -false_easting: FE, false easting, the Eastings value assigned to the natural origin
    -false_northing: FN, false northing, the Northings value assigned to the natural origin

    e.g. Georgia West State Plane NAD83 Feet:
    var gawsp83 = new gmaps.ags.TransverseMercator({wkid: 102667, semi_major:6378137.0, inverse_flattening:298.257222101,central_meridian:-84.16666666666667, latitude_of_origin: 30.0, scale_factor:0.9999,'false_easting':2296583.333333333, 'false_northing':0, unit: 0.3048006096012192});

    Methods

    Methods Return Value Description
    forward(lnglat:Number[]) Number[] see SpatialReference
    getCircumference() Number see SpatialReference
    reverse(coords:Number[]) Number[] see SpatialReference

    namespace Util

    A set of utilities ((gmaps.gis.Util) for commonly used functions.

    Static Methods

    Static Methods Return Value Description
    addToMap(map:google.maps.Map, overlays:Array.<OverlayView>) None Add a list of overlays to map
    getJSON(url:String, params:Object, callbackName:String, callbackFn:Function) String Make Cross Domain Calls. This function returns the script ID which can be used to track the requests. parameters:
    • url: url of server resource
    • params: an object with name,value pairs. value must be string
    • callbackName: Callback parameter name the server is expecting.e.g:'callback'
    • callbackFn: the actual callback function.
    removeFromMap(overlays:Array.<OverlayView>, clearArray:Boolean) None Add a list of overlays to map

    Events

    Events Arguments Description
    jsonpend scriptID:String This event is fired after a REST JSONP response was returned by server.
    jsonpstart scriptID:String This event is fired before a REST request sent to server.