You may need to break down the multipolygon into its constituent polygons and store them separately in your database then you can use a query to check which polygon contains the point.
I am not expert but this is my idea :
Example of a polygon :
{
"id": "polygon1",
"type": "Polygon",
"coordinates": [
[
[longitude1, latitude1],
[longitude2, latitude2],
[longitude3, latitude3],
[longitude1, latitude1]
]
]
}
You will need to write a query to check which polygon contains the point.
SELECT c.id
FROM c
WHERE ST_WITHIN({ "type": "Point", "coordinates": [longitude, latitude] }, c)
This how you might perform this query using the Azure Cosmos DB SDK for JavaScript (Try and tell us ! ) :
const { CosmosClient } = require("@azure/cosmos");
const client = new CosmosClient({ endpoint, key });
const database = client.database(databaseId);
const container = database.container(containerId);
const point = {
type: "Point",
coordinates: [longitude, latitude]
};
const query = {
query: "SELECT c.id FROM c WHERE ST_WITHIN(@point, c)",
parameters: [
{ name: "@point", value: point }
]
};
const { resources: results } = await container.items.query(query).fetchAll();
if (results.length > 0) {
console.log("Point is within polygon with id:", results[0].id);
} else {
console.log("Point is not within any polygon");
}