1
votes

I have one collection which contains polygons and one collection which contains point locations, and I would like to see which locations are in each polygon and tag the locations with the ID of the polygon.

To accomplish this, I thought I'd implement a stored procedure in the polygon collection which retrieves all polygons and then for each polygon call a stored procedure in the location collection. The second procedure would take polygon ID and polygon coordinates as input and use the ST_WITHIN method to check which locations are within the polygon.

Is it possible to solve it this way and is it a good way?

1

1 Answers

2
votes

You cannot call a stored procedure across collection boundaries. You'd need to either:

  • Retrieve your polygons via first stored procedure, returning them to your app tier, and from your app tier, call the other stored procedure
  • Combine your polygon data and point location data into the same collection, and then run your point-location queries from your first stored procedure