I am looking for the st_dwithin postgis source code. I want to learn the way postgis determines whether a given geometry is within a given radius to another geometry.


1 Answer 1


One of the best place to search and explore source code for PostGIS is through the GitHub mirror:


For instance, search ST_DWithin, where you will then search LWGEOM_dwithin, then lwgeom_mindistance2d_tolerance, then lw_dist2d_comp, then lw_dist2d_recursive, and then different versions of lw_dist2d_distribute* functions ...

You can also explore the Doxygen documents for a high-level view of the liblwgeom library, which is part of PostGIS. E.g. for measures.c, which is used by ST_DWithin:

http://postgis.net/docs/doxygen/2.1/d1/dbf/measures_8c.html measures.c

Here's how lwgeom_mindistance2d_tolerance connects with the other components: lwgeom_mindistance2d_tolerance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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