I have a .json file of points to put on a Leaflet map and I have used the proj4js to convert them from the EPSG 3946 projection into the WGS84 EPSG 4326 one. All worked, but the points are not located where they should be: they are about 8 degrees latitude more towards south and a little bit more towards east. The same points look fine on QGIS, they place where they should be.
This is the .js script :
var pTransfo;
$.getJSON('transfo.json',function(data){
proj4.defs("EPSG:3946", "+proj=lcc +lat_1=43 +lat_2=49 +lat_0=46.5 +lon_0=6 +x_0=1700000 +y_0=6200000 +datum=RGF93 +units=m +no_defs +towgs84=0,0,0");
var fromProj = proj4('EPSG:3946');
var toProj = proj4('EPSG:4326');
function convertCoordinates(coordinates) {
var convertedCoords = proj4(fromProj, toProj, [coordinates[0], coordinates[1]]);
console.log('Coordonnées originales :', coordinates);
console.log('Coordonnées converties :', convertedCoords);
return [convertedCoords[0], convertedCoords[1]];
}
data.features.forEach(function(feature) {
if (feature.geometry.type === "Point") {
feature.geometry.coordinates = convertCoordinates(feature.geometry.coordinates);
}
});
And I have already added this line in the html : after the jquery and leaflet line.
Why this delay of location ?
Thank you!