Utilities

Utility methods used internally by Esri Leaflet. These methods are useful for converting data between ArcGIS and Leaflet formats.

MethodReturnsDescription
extentToBounds(<Extent> extent)LatLngBoundsConverts ArcGIS Extent objects to Leaflet LatLngBounds objects.
boundsToExtent(<LatLngBounds>bounds)ExtentConverts Leaflet LatLngBounds objects to ArcGIS Extent objects.
arcgisToGeoJSON(<ArcGIS Geometry>arcgis)arcgisToGeoJSON(<ArcGIS Feature>arcgis)GeoJSONConverts ArcGIS Geometry Objects or ArcGIS Feature Objects to GeoJSON. If you pass a GeoJSON Feature or FeatureCollection you should also pass idAttribute to assign a property from the feature attributes to the ID of the GeoJSON Feature, 'OBJECTID' or 'FID' attributes by default.
geojsonToArcGIS(<GeoJSON>geojson, <String>idAttribute) ObjectConverts GeoJSON objects to ArcGIS Geometry Objects or ArcGIS Feature Objects. If you pass a GeoJSON Feature or FeatureCollection you should also pass idAttribute to assign a property in the output features to represent the features id, 'OBJECTID' by default.
responseToFeatureCollection(<Object>response, <String>idAttribute)FeatureCollectionConverts an API response (returned by identify, query or find API methods) to a GeoJSON FeatureCollection. This is used internally by L.esri.Query, L.esri.IdentifyFeatures and L.esri.Find to convert responses.
cleanUrl(<String>url)StringUsed internally to ensure that URLs have no leading or trailing whitespace and have a leading slash.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.