Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can you leverage an ArcGIS geometry service in Esri Leaflet? #1145

Closed
jgravois opened this issue Mar 21, 2019 · 0 comments
Closed

can you leverage an ArcGIS geometry service in Esri Leaflet? #1145

jgravois opened this issue Mar 21, 2019 · 0 comments

Comments

@jgravois
Copy link
Contributor

a clientside library like turf.js is usually a better option, but you can also make calls to geometry services.

the only catch is that you need to convert back and forth between GeoJSON and Esri flavored JSON on your own.

// https://developers.arcgis.com/rest/services-reference/convex-hull.htm
  L.esri.request(`http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/convexHull`, {
    geometries: {
      geometryType: "esriGeometryPoint",
      geometries: arcgisPoints
    },
    sr: 4326
  }, function(err, response) {
    L.geoJSON(L.esri.Util.arcgisToGeoJSON(response)).addTo(map)
  })

https://jsbin.com/tupunux/edit?html,output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant