python - Conversion of miles to latitude and longitude degrees using geopy -
background
i want add model manager function filters queryset based on proximity coordinates. found blog posting code doing precisely want.
code
the snippet below seems make use of geopy functions have since been removed. coarsely narrows down queryset limiting range of latitude , longitude.
# prune down set of locations can check precisely rough_distance = geopy.distance.arc_degrees(arcminutes=geopy.distance.nm(miles=distance)) * 2 queryset = queryset.filter( latitude__range=(latitude - rough_distance, latitude + rough_distance), longitude__range=(longitude - rough_distance, longitude + rough_distance) )
problem
since of used geopy functions have been removed/moved, i'm trying rewrite stanza. however, not understand calculations---barely passed geometry , research has confused me more helped me.
can help? appreciate it.
it looks distance
in miles being converted nautical miles, each equal minute of arc, 1/60th of arc degree each. value doubled, , added , subtracted given latitude , longitude. these 4 values can used form bounding box around coordinates.
you can lookup needed conversion factors on wikipedia. there's relevant article there titled horizontal position representation discusses pros , cons of alternatives longitude , latitude positioning avoid of complexities. in other words, considerations involved replacing latitude , longitude horizontal position representation in calculations.
Comments
Post a Comment