Calculate 4 points X km a point that form a square

108 views Asked by At

This might be answered before, but looking SO or Google I wasn't able to understand much as I am new with LAT/LNG.

What I am trying to find is get 4 points (lat,lng) around a point(lat,lng) which are X km away.

Example

class Point():
    def __init__(lat, lng):
        self.lat = lat
        self.lng = lng


#I have a point.
orginal_point = Point (46.227638, 2.213749)  
# I want to get p1, p2, p3, p4 which forms a square around the actual point.
distance_apart = 100 # in KM
p1_lt = Point(0,0) # Left Top corrnor of saqure
p2_lb = Point(0,0) # Left bottom corrnor of saqure
p3_rt = Point(0,0) # Right Top corrnor of saqure
p4_rb = Point(0,0) # Right bottom corrnor of saqure

# When I have those points. I want to query system to find all the nodes which lies under that square.
cls.objects.filter() # Thinking about how to query.

Any suggestions would be really helpful.

0

There are 0 answers