Yes, it's a little different for the spherical (Lon/Lat) case. For those formulas, check out Ed Williams' Aviation Formulary website at http://williams.best.vwh.net/avform.htm. What you're looking for is determining waypoint locations, i think.
- Bill Thoen shane_china wrote: > > Bill Thoen wrote: > >> shane_china wrote: >> >>> In openlayers, >>> I have a straight line with two endpoints. How could I get a point on the >>> line with given distance to one endpoint? Thank you. >>> >>> >> You can find a point anywhere on a line by using a ratio calculation. >> Start with the distance to your point divided by the total distance of >> your line, then your new X coordinate = the difference between the X >> coordinates of the endpoints times the ratio (plus the X coordinate of >> the starting line endpoint. For example, if your endpoints are at >> coordinates (X0, Y0) and (X1,Y1) then the Cartesian distance is >> >> D = sqrt((X1-X0)*(X1-X0) + (Y1-Y0)*(Y1-Y0)) >> >> Then if the ratio between this and the distance to your point is d, your >> new point's coordinates will be: >> >> X= X0+(X1-X0)*d/D >> Y=Y0+(Y1-Y0)*d/D >> > > So thank you for your answer. Your advise is in X-Y coodinates. Does this > method also apply to lon lat coodinates? Our earth is a ball, so is it > different? > I haven't demonstrate it yet. > _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
