ArcGIS Rest API - Query(Feature Service/Layer) - Spatial Query Not Working

1223
6
Jump to solution
03-16-2021 04:59 AM
Careen_Jonathan
New Contributor II

Hey,

 

I'm looking to pull up the records of any survey123 reports that fall within 100m of a certain location. I can't seem to get the query to work. I insert a location that has one record less than a meter away and the query returns nothing. It isn't a public feature service but here's a screenshot of what I've entered:

Careen_Jonathan_0-1615895883393.png

I've also flipped the coordinates around and still no luck.

 

Thanks,

Jon

0 Kudos
1 Solution

Accepted Solutions
Careen_Jonathan
New Contributor II

Hey Jake, 

I got it to work, I originally jumped straight to using Within but when I did that sample service you had there I left it on Intersects and got a count of 2. When I changed it to Within it came back with no records. So I switched mine to Intersects and worked fine. I should have gave it a go without looking too far into it first lol. Thanks for all the help!

View solution in original post

0 Kudos
6 Replies
JakeSkinner
Esri Esteemed Contributor

Hi @Careen_Jonathan , what is the coordinate system of your service?  The coordinates you are specifying are WGS 84.  However, these will default to whatever your coordinate system of your service is in.  Try specifying 4326 for the Input  Spatial Reference parameter.

Careen_Jonathan
New Contributor II

Hey @JakeSkinner, I forgot to fill that in in the screenshot but I do have that filled and also ended up getting no results.

0 Kudos
JakeSkinner
Esri Esteemed Contributor

1.  What is the coordinate system of the service?  Have you tried using the same coordinate type (i.e. meters)?

2.  What is the geometry type of the service? i.e. polygon  If you are working with polygons or lines, have you tried changing the Spatial Relationship to Intersects?

Careen_Jonathan
New Contributor II

1. Careen_Jonathan_0-1615903315351.png

I'm gonna try a different coordinate system here now to see if that works.

 

2. It's just a point layer. I did some searching around and found that the within works for points.

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Here is a service you can test with:

https://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/FeatureServer/0/query

Input Geometry:  -100.3858152,38.4981439

Spatial Reference:  4326

Distance:  2000

Units:  Meters

This should return 2 points.

Careen_Jonathan
New Contributor II

Hey Jake, 

I got it to work, I originally jumped straight to using Within but when I did that sample service you had there I left it on Intersects and got a count of 2. When I changed it to Within it came back with no records. So I switched mine to Intersects and worked fine. I should have gave it a go without looking too far into it first lol. Thanks for all the help!

0 Kudos