need help calculating point between two coordinates.

Dave Angel davea at ieee.org
Thu Aug 13 20:06:56 EDT 2009


PeteDK wrote:
> Hi there
>
> I'am working on a route comparison tool for carpools.
>
> The route comparison is based on 'steps' retrieved from google maps
> GDirection. These steps vary in length and i use the coordinates at
> the beginning of each "step". However, sometimes the distance of these
> steps is too long(ex. driving 30-40 km. on the freeway). Therefore i
> would like to calculate/find the coordinate located in between two
> given coordinates.
> Lets say one step starts at:
> 56.043185,9.922714
> and ends at:
> 56.234287,9.864521
>
> I would then like to calculate the point right in the middle of these
> coordinates.
>
> I use the haversine form to calculate the distance between
> coordinates, but im not sure whether or not this can be used for the
> same purpose.
> http://www.mpi.nl/world/persons/private ... versine.py
>
> I apologize if this thread has been posted the wrong place:)
>
> any help is greatly appreciated!
>
> kind regards.
>
> Pete
>
>   
For the distances you're talking about, those coordinates are very close 
to linear.  So to find the midpoint, just average the coordinates.  You 
might be off by half a km, but roads bend more than that.

DaveA




More information about the Python-list mailing list