Select to view content in your preferred language

What's the easiest/best way to check if a point is located within a map layer using the REST API?

1440
5
Jump to solution
02-02-2018 08:26 AM
DanielDunn
Emerging Contributor

Hi, GIS ignorant here, so I may not be using the correct terms (but hoping to change that). 

I have a lat/long point that I geocoded using the REST API. How do I check to see if this point exists within the boundary of a map layer using the REST API?

For example, I would like to check if any point x, y is located on this map of a Town's jurisdictional limits: CorporateData/JurisdictionalLimits (MapServer) 

Could I use a query? If so, what would I query? I simply need a true/false for whether it exists within the boundaries of the map.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Daniel,

   This would work:

https://gisweb.townofchapelhill.org/arcgis/rest/services/CorporateData/JurisdictionalLimits/MapServer/0/query?geometry=geometry%3D-104%2C35.6&geometryType=esriGeometryPoint&spatialRel=esriSpatialRelIntersects&returnGeometry=false&outSR=102100&returnIdsOnly=false&returnCountOnly=true&f=json

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Emeritus

Daniel,

   This would work:

https://gisweb.townofchapelhill.org/arcgis/rest/services/CorporateData/JurisdictionalLimits/MapServer/0/query?geometry=geometry%3D-104%2C35.6&geometryType=esriGeometryPoint&spatialRel=esriSpatialRelIntersects&returnGeometry=false&outSR=102100&returnIdsOnly=false&returnCountOnly=true&f=json
DanielDunn
Emerging Contributor

Thanks Robert!  In that example, after what param should I put the x, y coordinates?

When I try a known lat, long within the boundary, it returns a 0 count:

https://gisweb.townofchapelhill.org/arcgis/rest/services/CorporateData/JurisdictionalLimits/MapServe...
0 Kudos
DanielDunn
Emerging Contributor

I guess that's what I get for copying and pasting from Google Maps! Thank you Robert. This is immensely helpful.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Daniel,

  Google uses lat, lon(y,x) and esri expects x,y.