9

A friend and I are currently creating a pretty straight forward LINQ to ESRI library that sends HTTP queries to an ArcGIS MapServer and then parses the JSON response appropriately.

Everything is currently working beautifully except one thing; multiple Where statements. This seems like a simple syntax issue, but I can't seem to get it working, or find out if it's supported. I'm trying to do something like this.

Doesn't Work:

MapServer/22/query?where=MY_FIELD='Whatever'&where=MY_OTHER_FIELD='Whatever'&f=json

Does Work:

MapServer/22/query?where=MY_FIELD='Whatever'&f=json

Also Works:

MapServer/22/query?where=MY_OTHER_FIELD='Whatever'&f=json

I have tried several different syntax versions, but can't seem to get a multiple Where statement to work. This is my primary source for breaking down these queries. If anyone knows the syntax to do this, or knows the source that says it's not possible.

1
  • 1
    LINQ to ESRI sounds like a great idea, let us know how it goes. Mar 1, 2011 at 6:30

1 Answer 1

8

Stick to a single where parameter in your query string. Here's an example of a where clause hitting multiple fields: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/MapServer/0/query?geometryType=esriGeometryPoint&spatialRel=esriSpatialRelIntersects&where=address%3D%27875+HOWARD+ST%27+or+objectid%3D193510&returnIdsOnly=false&returnGeometry=true&outFields=%27status,objectid%27&f=html

2
  • 2
    +1 The doc says the where arg can be "Any legal SQL where clause operating on the fields in the layer is allowed." though I suspect there are legal SQL where clauses that aren't supported. Feb 28, 2011 at 23:38
  • I can see that happening, since ESRI does not support some clauses on simple IQueryFilters... Mar 1, 2011 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.