Disclaimer: I've already found this link Convert PNG to GeoTiff using GDAL - but it was of no help.
Actually I've got a .png
file of a hand-drawn map (I also got it in the .svg
format in case this may help).
I currently know the exact boundings of this file:
{
ne: { lat: 48.506161, lng: -1.714582 },
sw: { lat: 48.477861, lng: -1.742703 }
}
It's located in the north of France.
So here's the command I tried so far with gdal_translate
:
gdal_translate -of GTiff -a_srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
-a_ullr 48.506161 -1.714582 48.477861 -1.742703 myfile.png output.tif
My final goal is to serve this file under a tiles system (x/y/z.png
) for Leaflet or OpenLayers.
So I used gdal2tiles
to convert the output.tif file:
sudo gdal2tiles.py -p mercator output.tif result/
But my problem is that the generated tiles are geolocated in the north of Madagascar instead of France. Any clue on this?
ne: { lat: 48.506161, lng: -1.714582 }
but user should also know that GDAL is always taking coordinates in order longitude-latitude or easting-northing.