timwis / soda-geoservices

Query Esri Geoservices using a SODA2-style API
MIT License
7 stars 0 forks source link

Support within_polygon #7

Closed timwis closed 8 years ago

timwis commented 8 years ago

SODA2 supports within_polygon() (docs). Example query:

$where=within_polygon(location, 'MULTIPOLYGON (((-87.637714 41.887275, -87.613681 41.886892, -87.625526 41.871555, -87.637714 41.887275)))')

Should this use Geoservice's Multipoint or Polygon query?

Example Multipoint:

{
  "points" : [[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832]],
  "spatialReference" : {"wkid" : 4326}
}

Example Polygon:

{
  "rings" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832],
              [-97.06138,32.837]],[[-97.06326,32.759],[-97.06298,32.755],[-97.06153,32.749],
              [-97.06326,32.759]]],
  "spatialReference" : {"wkid" : 4326}
}

Aesthetically, it looks more like Multipoint, but considering it's standard WKT (MULTIPOLYGON), Polygon may be the direct translation.

timwis commented 8 years ago

@ajturner, any suggestions?

timwis commented 8 years ago

@chelm may know too?

ajturner commented 8 years ago

I'm not entirely sure - but by nomenclature I would presume that POLYGON is the right query, and the SODA Doc example only has a single polygon of the multipolygon. Kind of like a one-element array.

chelm commented 8 years ago

Polygon!

timwis commented 8 years ago

Okay, thanks guys!