0

I have a a list of points (latitude,longitude), it's a bus path and around this path I have some points (bus stops), the points are not on the path.

I need to project the bus stops points on the path for compute the traveled distance from the beginning of the path for each bus stops. For that I need the know the latitude and longitude for each stops on the path.

I can compute the distance but I can't project the points on the path en get the new latitude-longitude of the bus stops points.

I search for a formula they do that without success...

Someone have an idea, I work with C# 4.0.

Maxime
  • 357
  • 2
  • 10
  • 23

2 Answers2

1

PostGIS has a function called ST_LineLocatePoint from which you can get an exact point using ST_LineInterpolatePoint.

The PostGIS source code is available here

raphael
  • 2,762
  • 5
  • 26
  • 55
0

I would say you need to calculate the minimum distance between the line (bus route) and the point (bus stop). See http://local.wasp.uwa.edu.au/~pbourke/geometry/pointline/

Matt
  • 6,787
  • 11
  • 65
  • 112
  • Thanks it's good start but I have difficulty to figure how I can get the latitude,longitude of the position on the path.. – Maxime Jul 16 '12 at 03:19