A Rijksdriehoekscoördinaat is used by the Dutch cadastre. Since all cadastre geo-data is not according the WGS84-standard, you need to convert a Rijksdriehoekscoördinaat (RD) to latitude / longitude values, for use in Google maps for example.
You can convert them with this function PHP-function
function rd2wgs ($x, $y)
{
// Calculate WGS84 coördinates
$dX = ($x - 155000) * pow(10, - 5);
$dY = ($y - 463000) * pow(10, - 5);
$SomN = (3235.65389 * $dY) + (- 32.58297 * pow($dX, 2)) + (- 0.2475 *
pow($dY, 2)) + (- 0.84978 * pow($dX, 2) *
$dY) + (- 0.0655 * pow($dY, 3)) + (- 0.01709 *
pow($dX, 2) * pow($dY, 2)) + (- 0.00738 *
$dX) + (0.0053 * pow($dX, 4)) + (- 0.00039 *
pow($dX, 2) * pow($dY, 3)) + (0.00033 * pow(
$dX, 4) * $dY) + (- 0.00012 *
$dX * $dY);
$SomE = (5260.52916 * $dX) + (105.94684 * $dX * $dY) + (2.45656 *
$dX * pow($dY, 2)) + (- 0.81885 * pow(
$dX, 3)) + (0.05594 *
$dX * pow($dY, 3)) + (- 0.05607 * pow(
$dX, 3) * $dY) + (0.01199 *
$dY) + (- 0.00256 * pow($dX, 3) * pow(
$dY, 2)) + (0.00128 *
$dX * pow($dY, 4)) + (0.00022 * pow($dY,
2)) + (- 0.00022 * pow(
$dX, 2)) + (0.00026 *
pow($dX, 5));
$Latitude = 52.15517 + ($SomN / 3600);
$Longitude = 5.387206 + ($SomE / 3600);
return array(
'latitude' => $Latitude ,
'longitude' => $Longitude);
}
Input are the RD $x and $y coördinates. Output is an array with latitude & longitude
This is really useful, thanks for posting it!
Does the programmer or anybody knows how accurate this function is?
The algorithm is based on the steps written in the wikipedia page.
I tested it in real life and was it was accurate enough for my application.
there’s a bug in the script (calculation of $SomN).
$dX ^ 2 should be pow($dX, 2)
proper code would be:
$SomN = (3235.65389 * $dY) + (- 32.58297 * pow($dX, 2)) + (- 0.2475 *
pow($dY, 2)) + (- 0.84978 * pow($dX, 2) *
$dY) + (- 0.0655 * pow($dY, 3)) + (- 0.01709 *
pow($dX, 2) * pow($dY, 2)) + (- 0.00738 *
$dX) + (0.0053 * pow($dX, 4)) + (- 0.00039 *
pow($dX, 2) * pow($dY, 3)) + (0.00033 * pow($dX, 4) * $dY) + (- 0.00012 * $dX * $dY);
by applying the fix the accuracy would be very high
@Keizer Thanks for the fix. I updated the code in the post.
A very nice posting indeed!
Does anyone also have code for the conversion the other way around?
Thanks,
Siebe