Converting "Lambert 1 Nord" data into "Spacial Reference"

110 views Asked by At

I have a CSV files with "Lambert 1 Nord" data and have to translate them into "Spacial Reference" to use them.

For informations, here are a couple of informations given by the file :

Est : "997776,67"
Nord : "112121,30"

I use this script to do the conversion :

<?php
include_once("../src/proj4php/proj4php.php");

$proj4 = new Proj4php();
$source = new Proj4phpProj('EPSG:27561',$proj4);
$destination = new Proj4phpProj('EPSG:4326', $proj4);

$fichier = csv_to_array('testcsv.csv', ';');

$x=$fichier[0]["Est"]; //"997776,67"
$y=$fichier[0]["Nord"]; //"112121,30"

$point = new proj4phpPoint($x, $y);

$final = $proj4->transform($source, $destination, $point);

var_dump($final);

function csv_to_array($filename='', $delimiter=',')
{
    if(!file_exists($filename) || !is_readable($filename))
        return FALSE;

    $header = NULL;
    $data = array();
    if (($handle = fopen($filename, 'r')) !== FALSE)
    {
        while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
        {
            if(!$header)
                $header = $row;
            else
                $data[] = array_combine($header, $row);
        }
        fclose($handle);
    }
    return $data;
}
?>

The result is far away from the real position (in France). I'm sure the data are in "Lambert 1 Nord" at the beginning.

Thx in advance

1

There are 1 answers

0
Xavier W. On BEST ANSWER

I made a misstake, double values are false. The good values are :

Est : "997776.67"
Nord : "112121.30"