++ed by:
Eugene van der Pijll
and 1 contributors

# NAME

Geo::Coordinates::RDNAP - convert to/from Dutch RDNAP coordinate system

# SYNOPSIS

``````  use Geo::Coordinates::RDNAP qw/from_rd to_rd dd dms/;

# RD coordinates and height in meters
my (\$lat, \$lon, \$h) = from_rd( 150_000, 480_000, -2.75 );

printf "%d %d' %.2f\" %d %d' %.2f\"", dms(\$lat, \$lon);

lat/lon coordinates in degrees; height in meters
my (\$x, \$y, \$h) = to_rd( 52.75, 6.80, 10 );

# equivalent: to_rd( deg(52,45,0, 6,48,0), 10 );``````

# DESCRIPTION

This module converts between two coordinate systems: RD-NAP and ETRS89. ETRS89 is a geodesic frame of reference used in Europe, which is approximately equal to the international reference frame WGS84. GPS data. Coordinates in ETRS89 are given in degrees (latitude and longitude) and meters (height above the reference ellipsoid).

RD-NAP (or "Amersfoort datum") is a Dutch coordinate system, consisting of the X and Y coordinates of the Rijksdriehoekmeting, used e.g. in topographical maps, and a Z coordinate which is the height above Normaal Amsterdams Peil, the mean sea level at Amsterdam. X, Y, and Z are all expressed in meters (this is a change compared to the previous versions of this module!)

These transformations should only be used for locations in or close to the Netherlands.

See http://www.rdnap.nl/ for a description of the RD-NAP system; especially http://www.rdnap.nl/download/rdnaptrans.pdf for the formulas used in this module.

## Precision

This module implements an approximated transformation, which should be accurate to about 25 cm in X and Y, and about 1 meter in the vertical direction, for all locations in the Netherlands. The full transformation, called RDNAPTRANS, is NOT implemented in this module. It takes into account small deviations, measured at more than 5000 points in the Netherlands.

Coordinates in ETRS89 deviate from WGS84 and ITRS because the former is coupled to the Eurasian plate, which drifts a few cm per year compared to other plates. The current (2006) difference between these coordinate systems is in the order of 40 cm.

## Disclaimer

Although this module implements conversion to/from the RD-NAP coordinate system, it is not a product of RDNAP, the cooperation between the Kadaster and Rijkwaterstaat, which maintains this coordinate system.

RDNAPTRANS is a trademark, presumably by Kadaster and/or Rijkswaterstaat. This module is not an implementation of RDNAPTRANS. For the official transformation software, visit http://www.rdnap.nl.

# FUNCTIONS

from_rd( \$x, \$y, \$h )

Converts coordinates in the RD-NAP coordinate system to geographical coordinates. The input are the X and Y coordinates in the RD system, given in meters, and optionally the height above NAP in meters.

This should only be used for points in or close to the Netherlands. For this area, X should roughly be between 0 and 300_000, and Y between 300_000 and 650_000.

The output is a list of three numbers: latitude and longitude in degrees, according to the ETRS89 coordinate system, and height above the ETRS89 reference geoid, in meters.

to_rd( \$lat, \$lon, \$h )

Converts geegraphical coordinates to coordinates in the RD-NAP coordinate system. The input are the latituse and longitude in degrees, and optionally the height above the ETRS89 reference geoid in meters.

This should only be used for points in or close to the Netherlands.

The output is a list of three numbers: X and Y in the RD system in meters, and the height above NAP in meters.

deg

Helper function to convert degrees/minutes/seconds to decimal degrees. Works only for positive latitude and longitude.

dms

Helper function to convert decimal degrees to degrees/minutes/seconds. Works only for positive latitude and longitude. The returned degrees and minutes are integers; the returned number of seconds can be fractional.

When rounding the number of seconds, remember that it wraps at 60 (and so does the number of minutes). One easy way (but perhaps not the fastest) of taking this into account is the following piece of code:

``````    (\$d, \$m, \$s) = dms(\$degrees);
\$s = int(\$s + 0.5);
(\$d, \$m, \$s) = map {sprintf "%.0f"} dms(deg(\$d, \$m, \$s));``````

None known.

# AUTHOR

Eugene van der Pijll `<pijll@cpan.org>`

Copyright (c) 2006 Eugene van der Pijll. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.