user20500338
user20500338

Reputation: 11

how to add 500meters to a lat and long in Python

If this is the initial

Latitude:  13.050249
Longitude:  77.462143

how to increment the lat and long by 500m and get the new pixel/grid's coordinates?

Upvotes: 0

Views: 411

Answers (1)

DataFramed
DataFramed

Reputation: 1631

Here is a function to it you can pass the x and y to get lat and long.

from math import cos
from math import radians
def meters_2_lat_lon(m, orig_lat):
    lat = m/111111
    lon = m/(111111 * cos(radians(orig_lat)))
    return lat, lon

Upvotes: 1

Related Questions