I need to find a LineString at a distance in meters from a line with coordinates in Lat/Lon. I am trying this approach based on what i found in this question https://stackoverflow.com/questions/23697374/calculate-polygon-area-in-planar-units-e-g-square-meters-in-shapely

from mpl_toolkits.basemap import Basemap
from shapely.geometry import Point, LineString
point1 = (8.83, 45.69)
point2 = (8.86, 45.71)
distance = 10000 #meters
m = Basemap(projection='sinu',lon_0=0,resolution='c')
xi_seg = LineString([m(point1[0],point1[1]),m(point2[0],point2[1])])
lcoords_s = xi_seg.parallel_offset(distance, 'left').coords[0]
lcoords_s_4326 = Point(m(lcoords_s[0],lcoords_s[1],inverse = True))

The resulting coordinates of the Point lcoords_s_4326 are (45.75149569876954, 8.745680842264079). However, i checked on QGIS and the distance between point1 and lcoords_s_4326 is lower than 10'000 meters. Any thought on how to get a distance of 10'000 meters from one point to the other? I am working with data in every part of the planet and not just in this specific region

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.