hosted feature layer rest api query error

515
3
Jump to solution
09-09-2021 05:02 AM
ChitraKrishnan
New Contributor III

Hi,

I am trying to get feature details from the hosted feature layer for the lat long values  using below query

latitude: 40.121100

longitude: -76.032700

https://services8.arcgis.com/HPJsu0I9OjNDnQ7I/ArcGIS/rest/services/tl_2020_42_tabblock20/FeatureServ...

getting 

{"error":{"code":400,"message":"Cannot perform query. Invalid query parameters.","details":["'geometry' parameter is invalid"]}}

any help would be greatly appreciated?

Thanks

Chitra

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Notable Contributor

PS - Since you're using a point in lat/lon, don't forget the inSRID parameter as well. Tack this onto your query URL:

&geometryType=esriGeometryPoint&inSR=4326

That will get you an actual result.

- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
KenBuja
MVP Honored Contributor

You didn't include the geometryType in the query. From the documentation:

The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API. In addition to the JSON structures, you can specify the geometry of envelopes and points with a simple comma-separated syntax.

Syntax:

  • JSON structures: geometryType=<geometryType>&geometry={ geometry}
  • Envelope simple syntax: geometryType=esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
  • Point simple syntax: geometryType=esriGeometryPoint&geometry=<x>,<y>

 

Examples:

  • geometryType=esriGeometryEnvelope&geometry={xmin: -104, ymin: 35.6, xmax: -94.32, ymax: 41}
  • geometryType=esriGeometryEnvelope&geometry=-104,35.6,-94.32,41
  • geometryType=esriGeometryPoint&geometry=-104,35.6
jcarlson
MVP Notable Contributor

PS - Since you're using a point in lat/lon, don't forget the inSRID parameter as well. Tack this onto your query URL:

&geometryType=esriGeometryPoint&inSR=4326

That will get you an actual result.

- Josh Carlson
Kendall County GIS
ChitraKrishnan
New Contributor III

that works awesomely after adding inSRID. Thank you very much!!!!

Thank you both.

-Chitra

0 Kudos