I have a PostGIS database with a very large amount of geometries (circles), most of them overlapping. I'm trying to come up with a way to find the nearest point (from your current location) that is not within any of these circles.

Is this possible with a direct query?

So far I thought of a fishnet approach of 1x1 km cells that check for overlap with any of these circles. This works, but is not very accurate.


Since you are using a PostGIS database, you could use the st_closestpoint function. One argument would be your current location, the other one your inverted circle geometries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.