{
"rings": [
[
[
-80.0929469116589,
26.6756462518988
],
[
-80.0924963005446,
26.6756390617361
],
[
-80.0924828894995,
26.6753730253964
],
[
-80.092965687122,
26.675375422123
],
[
-80.0929469116589,
26.6756462518988
]
]
]
}
{
"rings": [
[
[
-80.0929469116589,
26.6756462518988
],
[
-80.092965687122,
26.675375422123
],
[
-80.0924828894995,
26.6753730253964
],
[
-80.0924963005446,
26.6756390617361
],
[
-80.0929469116589,
26.6756462518988
]
]
]
}
ringFeat = ''
qFl = 'https://services1.arcgis.com/sDAPyc2rGRn7vf9B/ArcGIS/rest/services/polySelectionLayer/FeatureServer/0/query'
sql = "OBJECTID=2"
qFlParams = urllib.urlencode({'f': 'json',
'geometryType': 'esriGeometryPolygon',
'geometry': '',
'spatialRel': 'esriSpatialRelIntersects',
'outSR': '4326',
'outFields': 'OBJECTID',
'returnGeometry': 'true',
'where': sql,
'token': token
})
reqFl = urllib2.Request(qFl, qFlParams)
errchk1 = ''
try:
response = urllib2.urlopen(reqFl)
except urllib2.HTTPError, e:
errchk1 = str(e.code)
except urllib2.URLError, e:
errchk1 = str(e.code)
if errchk1 == '':
jsonResult = json.load(response)
appCount = len(jsonResult['features'])
#if you have features, set the ringFeat to use in another query
if appCount > 0:
for feature in jsonResult['features']:
ringFeat = feature['geometry']
#finalringFeat = json.loads(ringFeats)
print json.dumps(ringFeat)
finalRing = json.dumps(ringFeat)
Solved! Go to Solution.
We've determined the issue is with the hosted feature service (a new "Tracker" feature service). ESRI is aware of the issue, closing this thread.
Are the results in the example you give above always the same, in terms of results from first query, or does the ring order for that example vary?
Hi Joshua,
The payload appears to be the same with each request made.
Of note: that is a hosted feature service I simply drew a couple of polygons in and then querying against it. From the result ring I then use as input geometry to query/intersect with another map service (hosted fs points). It selects all of the point features outside of that input ring!
Also: I can simply run the query from the REST query interface, copy the ring coordinates and then paste into the REST query interface of the point service and it gives me the same result. So, I'm questioning if it's even an issue with my python implementation?
Anyway - thanks for any input!
When you drew the polygons, do you recall if you drew them clockwise or counter-clockwise?
I tried both and it didn't seem to matter and get the same result with clockwise / counter-clockwise drawn features.
How about if I send the ring into the Simplify task of the Geometry service? That seems to generate the desired coordinate order of the ring when I run it manually at the REST Geometry service Simplify task. I think I can try a quick test in my .py implementation.
What's odd is the first time I sent the output ring into the Simplify task and used that result as the input geometry in the query, it correctly returned the point features that fell inside of that ring. Now, subsequent attempts (manually at the REST interface) does not perform the same selection result (selecting all points outside of that input simplified ring/geometry).
Head scratcher.
I'm not sure how to proceed with this. I've run some additional tests and the only thing I can think of is that I'm running into some sort of data issue. The point feature service of interest is the source to the new ESRI "Tracker" app, but it's still just recording point features into a regular old hosted feature service.
I have added another hosted point feature service (symbolized with the black stars) and running the same exact query using the polygon as an inputGeometry, it selects 7 point features (which is correct). However, it selects 12 point features from the tracker point feature service (the light green symbols), which is obviously incorrect as there are many more points inside the polygon.
We've determined the issue is with the hosted feature service (a new "Tracker" feature service). ESRI is aware of the issue, closing this thread.
Thanks for sharing what you learned from Esri.