rest spatial query issue

2584
2
09-24-2013 04:00 AM
GuidoStein
New Contributor III
I am working on some python code to do a semi-spatial join using the new geometry options in the rest end points. I can't seem to figure out why my final query won't work.

I think that it's event statistic json that I push:

event_statistics = json.dumps([
            {
                "statisticType": "count",
                "onStatisticField": event_aggr_field,
                "outStatisticFieldName": event_aggr_field + '_count'
            }
        ])


The entire code is on github here.

Any ideas?
0 Kudos
2 Replies
GuidoStein
New Contributor III
ok, so one part of my issue is that the documentation suggested that they only took arrays of json, and really, when it's a single statistic field it wants a non-array of json.

But now, using the web interface, it still does not work:
http://secmaps.dublin.oh.us/arcgis/rest/services/Misc_Data/MapServer/33/query?where=0%3D0&text=&obje...

any ideas??
0 Kudos
Nicholas-Furness
Esri Regular Contributor
Hi Guido,

One thing to note is that the layer service in question doesn't have "support statistics" enabled. See the first Note on the outStatistics section of the doco and see the service definition here.

Secondly, in your web interface example above, you are not encapsulating your outStatistics value as an array. You should wrap it in []:
[{
  "statisticType": "count",
  "onStatisticField": "Status",
  "outStatisticFieldName": "StatusCount"
}]


Perhaps you can get Brandon to enable statistics on the service and then you should be good to go.

Let me know if that helps. However, I feel the error message could be a lot better and I'll see if I can log an issue with the right team.

Nick.
0 Kudos