Best way to search a point across several polygons

Posted by user1474341 on Stack Overflow See other posts from Stack Overflow or by user1474341
Published on 2012-06-22T09:11:18Z Indexed on 2012/06/22 9:16 UTC
Read the original article Hit count: 159

Filed under:
|
|

I have a requirement whereby I need to match a given point (lat,lon) against several polygons to decide if there is a match.

The easiest way would be to iterative over each polygon and apply the point-in-polygon check algorithm, but that is prohibitively expensive.

The next optimization that I did was to define a bounding rectangle for each polygon (upper bound, lower bound) and iteratively check the point against the bounding box (fewer comparisons as against checking all the points in the polygon).

Is there any other optimization possible? Would a spatial index on the bound rectangle points or a geohash help ?

Any guidance would be greatly appreciated. Thanks!

© Stack Overflow or respective owner

Related posts about geolocation

Related posts about gis