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.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close