# Lat/Lon point transformation/offset on arbitrary segment

I'm looking for something very similar to those stack exchange GIS questions: Algorithm for offsetting a latitude/longitude by some amount of meters, How to convert (geodetic pose + cartesian offset) to geodetic position, Increment GPS coordinates by a certain distance given in meters [duplicate] and Quick way to determine if facing a given lat/lon pair with a heading, but I cannot get my head around to combine them for my specific question:

The most relevant would be the first one, but it refers to a specific vector/heading offset. What I'm looking for is a way to calculate an offset of some meters (less than 200 meters) for a point A, on the segment defined by this point A and another point B, having less than 1km of distance between them.

How can I apply the first answer of SE GIS with a calculation of heading (like the one in the last answer) in order to transpose point A for 100 meters in the direction of B?

• Unless you're near the poles, for a distance this small, could you assume linearity instead of creating a great circle from A to B? If not, my github.com/barrycarter/bcapps/blob/master/bclib.pl#L3407 does what you want, but is overkill for short distances. – barrycarter May 11 '17 at 16:30
• Thanks a lot. Actually I wouldn't mind having precision even if it's an overkill. To be honest I cannot completely understand your code but I guess it's a version of the one I've finally used : movable-type.co.uk/scripts/latlong.html . If you don't mind I'll answer my question by providing the link. – foxTox May 11 '17 at 17:24
• Don't mind, go for it. – barrycarter May 11 '17 at 17:26