5

Given a distance in metres (x) and two coordinate pairs in lat/lon format (which form a line segment), I am trying to find a point x meters from point 1 on the line segment between the two points.

I know that in order to use Shapely for this operation, I need to transform the points. Does it make sense to convert the lat/lon pairs to UTM and then use interpolate? If so, will it work to use metres as the measurement for distance, or will I need to convert that to something else as well?

I'm open to suggestions on the best way to go about using Shapely for this.

Savannah Ostrowski
  • 101
  • 1
  • 1
  • 9
  • this may help you even though its in arcpy https://gis.stackexchange.com/questions/6724/creating-line-of-varying-distance-from-origin-point-using-python-in-arcgis-deskt – ziggy Apr 19 '17 at 20:15

2 Answers2

4

Yes, transform your points to UTM (with pyproj or whatever), make a Shapely LineString from them and then call its interpolate() method with the distance in meters: https://shapely.readthedocs.io/en/stable/manual.html#object.interpolate.

Mike T
  • 42,095
  • 10
  • 126
  • 187
sgillies
  • 9,056
  • 1
  • 33
  • 41
3

you can use GeographicLib, check out the examples here. This answer was inspired by this one.

It will get you more accurate values than Cartesian interpolation (using UTM coordinates), and also you won't have to deal with the case of each point (point 1 and point 2) belonging to different UTM zones.

josue.0
  • 131
  • 3