L.esri.Services.MapService
Inherits from L.esri.Service
L.esri.Services.MapService
is an abstraction interacting with Map Services running on ArcGIS Online and ArcGIS server that allows you to make requests to the API, as well as query and identify features on the service.
Constructor
Constructor | Description |
---|---|
new L.esri.Services.MapService( L.esri.Services.mapService( |
The url parameter is the URL to the ArcGIS Server or ArcGIS Online map service you would like to consume. |
Options
L.esri.Services.MapService
accepts all L.esri.Services.Service
options.
Events
L.esri.Services.MapService
fires all L.esri.Services.service
events.
Methods
Method | Returns | Description |
---|---|---|
query() |
this |
Returns a new L.esri.Tasks.Query object that can be used to query this service.
|
identify() |
this |
Returns a new L.esri.Tasks.Identify object that can be used to identify features contained within this service.
|
find() |
this |
Returns a new L.esri.Tasks.Find object that can be used to find features by text.
|
Example
Identify task
var map = new L.Map('map').setView([ 45.543, -122.621 ], 5);
var service = L.esri.Services.mapService('http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer');
service.identify()
.on(map)
.at([45.543, -122.621])
.layers('visible:1')
.run(function(error, featureCollection, response){
console.log("UTC Offset: " + featureCollection.features[0].properties.ZONE);
});
Find task
var service = L.esri.Services.mapService('http://services.nationalmap.gov/arcgis/rest/services/govunits/MapServer');
service.find()
.layers('18')
.searchText('Colorado')
.searchFields('GNIS_NAME')
.run(function(error, featureCollection, response){
console.log('Found GNIS ID: ' + featureCollection.features[0].properties.GNIS_ID + ' for the state of ' + featureCollection.features[0].properties.STATE_NAME);
});
Esri Leaflet is a project from the Esri PDX R&D Center and the Esri Community