-2

I am trying to write a function which will return if a point is inside a Polygon or not using CosmosDB SQL API

I have tried to write a SQL statement, however that didnt work, so now I would like to use linq to someone write something.

I have Polygon and a point and would like to return a true or false answer.

There has got to be a Linq answer to this

bobD
  • 89
  • 1
  • 8

1 Answers1

-1

While I had initially been trying to do a select on all documents with a location inside a particular polygon using the ST_WITHIN function within CosmosDB - I realised I needed to check an in memory Location against the Polygon (also in memory), not select data from CosmosDB based on the geolocation parameters.

I however carried on trying to use the ST_WITHIN function in CosmosDB passing it both parameters which was wrong.

Instead I used a (GeoCordinate.NetCore) library to check if the point was within the Polygon.

There was no need to use the CosmobDB geolocation functions at all.

bobD
  • 89
  • 1
  • 8
  • I don't understand your answer. The Cosmos DB API is not just spatial calls; it's an entire document store. Why was "calling the DB layer" a bad idea? You still haven't shown what you attempted to do, so this answer isn't really helpful to the community. Great that you've solved your problem but... without any actual code, or any details of what you finally did, I'd suggest just closing/deleting your original question. – David Makogon Mar 04 '19 at 03:40