mongoDB Problem with geospartial query

60 views
Skip to first unread message

Sebastian Rauer

unread,
Oct 24, 2016, 5:06:25 PM10/24/16
to mongodb-user
Hi,

i have a problem to intersect a geojson prolygon. I have one object i am not able to query.

Here is a link to a ZIP File. In the ZIP File, you find the document and a query.

Why i cant find this document?

The javascript library 'tutf-intersection' tells, that my document intersects the query polygon.

I think I'm doing something wrong. What?

Best regards,
Sebastian Rauer

Kevin Adistambha

unread,
Dec 1, 2016, 6:46:06 PM12/1/16
to mongodb-user

Hi Sebastian,

It’s been some time since you posted this question. have you managed to solve this?

The javascript library ‘tutf-intersection’ tells, that my document intersects the query polygon.

I believe this may be caused by turf-intersect assuming that the polygons are mapped onto a flat 2D plane (e.g. a table), and $geoIntersect uses 3D spherical geometry (i.e. it takes into account the curvature of the earth). Specifically, from https://docs.mongodb.com/manual/reference/operator/query/geoIntersects/, $geoIntersects “… includes cases where the data and the specified object share an edge.”

The two polygons may share an edge on a 2D plane, but when mapped to a 3D spherical surface, those edges do not touch anymore. Therefore, I think the issue is caused by the difference between a flat 2D plane vs. a curved 3D plane.

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages