Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I currently want to check if 2 given GEOSGeometry objects of type Point are within 100m of each other. (length flexible) Looking at previous asked questions on this topic, most of the answers were totally not specific and even worse sent the author to other frameworks.

My goal is to stay with GEOS / GDAL (geo django) to solve this problem.

The current code I use:

from django.contrib.gis.geos import Point, GEOSGeometry
pnt = GEOSGeometry('SRID=4326;POINT(40.396764 -3.68042)')
pnt2 = GEOSGeometry('SRID=4326;POINT( 48.835797 2.329102  )')
pnt.distance(pnt2) * 100

Found on gis.SO.

It is very difficult for me to confirm that this code works, because I would have to check the distances between to points and check the results against each other.

The main goal is to take 2 points and get the distance in meters based on the WGS84 projection and the GEOS or GDAL framework

share|improve this question
1  
It isn't clear what you are looking for here. Can you edit your question to explain why what you have isn't what you need? Are you worried about enumerating all the point combinations? Do you just want a "distance" function that takes two points? Do you just need to extend this to bounding box checks to make it faster? More details will probably help deal with your specific issue. –  BradHards Mar 18 '13 at 3:10
    
The main goal is to take 2 points and get the distance in meters based on the WGS84 projection and the GEOS or GDAL framework. –  daemonfire300 Mar 18 '13 at 12:04
    
Is the problem that you're getting the distance in degrees and want metres? If so, can you just project the points to an appropriate UTM zone first, or take the great circle distance? –  BradHards Mar 18 '13 at 21:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.