Coordinate2Location

Top  Previous  Next

Function Coordinate2Location(const XLongV,YLatV: double; var link: integer; var percent: double; var side: integer; var dist,XLongNew,YLatNew: double): integer;

 

Finds the nearest location based on a set of coordinates. A location is a position along a link. This is described as a percentage (0 <= percent <= 1) along the link ID.

 

The side of the link is also returned in relation to direction of digitization: Right (0) or Left (1).

 

The air distance and coordinates of the location is returned in dist and XLongNew & YLatNew.

 

You will get error -30 if you supply a set of lat/long values not within valid range, i.e. -90..90 and -180..180.

 

There is quite some calculation work involved in this function, so you should consider to cache the results (store the location in an array/database), if the same coordinates are otherwise supplied over and over. This can have a significant impact on total calculation time.

 

Typical errors when using this function is using (0,0) as input or swapping coordinates. Both will slow down the calculations and return wrong results.

 

See also Location2Coordinate, Coordinate2LocationSimple.

 

Possible error codes: -10 -30 -40 -43 -44 -46 -62

Versions: Standard Pro

ActiveX / VCL / CLX component: RWnetBase