Convert a .png file to a GeoTIFF while knowing the boundings The 2019 Stack Overflow Developer Survey Results Are InConvert PNG to GeoTiff using GDALImageMagick's convert program changes PNG file format so that color/alpha info doesn't survive GDALRead Elevation from 1/3 Arc-Second NED .tif or .imgConvert PNG to GeoTiff using GDALgdal2tiles tile origin differences using Windows/OSGeo4W and Linux/GDALMaking a shapefile or kml tiles from a file that says it has no GCPLeaflet displaying oddly curved TMS tilesSplitting and converting a large tif files into multiple .hgt filesconvert tiff to UInt16 PNG turns blackconvert png with alpha channel to GeoTiffConvert Sentinel GeoTIFF file to JPEG image
Is an up-to-date browser secure on an out-of-date OS?
Feature engineering suggestion required
"as much details as you can remember"
Where to refill my bottle in India?
When should I buy a clipper card after flying to OAK?
Is there a symbol for a right arrow with a square in the middle?
Deal with toxic manager when you can't quit
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
Is this app Icon Browser Safe/Legit?
How are circuits which use complex ICs normally simulated?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Multiply Two Integer Polynomials
Can one be advised by a professor who is very far away?
Shouldn't "much" here be used instead of "more"?
Return to UK after having been refused entry years ago
Are there any other methods to apply to solving simultaneous equations?
What is the most effective way of iterating a std::vector and why?
Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?
What is the meaning of the verb "bear" in this context?
Are spiders unable to hurt humans, especially very small spiders?
If a Druid sees an animal’s corpse, can they Wild Shape into that animal?
Apparent duplicates between Haynes service instructions and MOT
Do these rules for Critical Successes and Critical Failures seem fair?
Convert a .png file to a GeoTIFF while knowing the boundings
The 2019 Stack Overflow Developer Survey Results Are InConvert PNG to GeoTiff using GDALImageMagick's convert program changes PNG file format so that color/alpha info doesn't survive GDALRead Elevation from 1/3 Arc-Second NED .tif or .imgConvert PNG to GeoTiff using GDALgdal2tiles tile origin differences using Windows/OSGeo4W and Linux/GDALMaking a shapefile or kml tiles from a file that says it has no GCPLeaflet displaying oddly curved TMS tilesSplitting and converting a large tif files into multiple .hgt filesconvert tiff to UInt16 PNG turns blackconvert png with alpha channel to GeoTiffConvert Sentinel GeoTIFF file to JPEG image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
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?
gdal geotiff-tiff convert gdal-translate gdal2tiles
|
show 1 more comment
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?
gdal geotiff-tiff convert gdal-translate gdal2tiles
1
your axes are the wrong way round - try to change the -a_srs to epsg:4326
– Ian Turton♦
Apr 5 at 14:35
Thank you for helping me, Ian! If the new command you proposed is : gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr 48.506161 -1.714582 48.477861 -1.742703 myfile.png output.tif, then I got exactly the same result - or is there anything else I must do?
– F3L1X79
Apr 5 at 14:45
1
I'd try dal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
– Ian Turton♦
Apr 5 at 14:55
Amazing, thank you so much. Too bad, I was so close for the good result... Do you think I should delete the question?
– F3L1X79
Apr 5 at 15:01
1
This time the source data is explicit and defines the meaning of coordinatesne: lat: 48.506161, lng: -1.714582
but user should also know that GDAL is always taking coordinates in order longitude-latitude or easting-northing.
– user30184
Apr 5 at 16:57
|
show 1 more comment
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?
gdal geotiff-tiff convert gdal-translate gdal2tiles
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?
gdal geotiff-tiff convert gdal-translate gdal2tiles
gdal geotiff-tiff convert gdal-translate gdal2tiles
edited Apr 5 at 17:14
Vince
14.8k32849
14.8k32849
asked Apr 5 at 14:25
F3L1X79F3L1X79
1329
1329
1
your axes are the wrong way round - try to change the -a_srs to epsg:4326
– Ian Turton♦
Apr 5 at 14:35
Thank you for helping me, Ian! If the new command you proposed is : gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr 48.506161 -1.714582 48.477861 -1.742703 myfile.png output.tif, then I got exactly the same result - or is there anything else I must do?
– F3L1X79
Apr 5 at 14:45
1
I'd try dal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
– Ian Turton♦
Apr 5 at 14:55
Amazing, thank you so much. Too bad, I was so close for the good result... Do you think I should delete the question?
– F3L1X79
Apr 5 at 15:01
1
This time the source data is explicit and defines the meaning of coordinatesne: lat: 48.506161, lng: -1.714582
but user should also know that GDAL is always taking coordinates in order longitude-latitude or easting-northing.
– user30184
Apr 5 at 16:57
|
show 1 more comment
1
your axes are the wrong way round - try to change the -a_srs to epsg:4326
– Ian Turton♦
Apr 5 at 14:35
Thank you for helping me, Ian! If the new command you proposed is : gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr 48.506161 -1.714582 48.477861 -1.742703 myfile.png output.tif, then I got exactly the same result - or is there anything else I must do?
– F3L1X79
Apr 5 at 14:45
1
I'd try dal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
– Ian Turton♦
Apr 5 at 14:55
Amazing, thank you so much. Too bad, I was so close for the good result... Do you think I should delete the question?
– F3L1X79
Apr 5 at 15:01
1
This time the source data is explicit and defines the meaning of coordinatesne: lat: 48.506161, lng: -1.714582
but user should also know that GDAL is always taking coordinates in order longitude-latitude or easting-northing.
– user30184
Apr 5 at 16:57
1
1
your axes are the wrong way round - try to change the -a_srs to epsg:4326
– Ian Turton♦
Apr 5 at 14:35
your axes are the wrong way round - try to change the -a_srs to epsg:4326
– Ian Turton♦
Apr 5 at 14:35
Thank you for helping me, Ian! If the new command you proposed is : gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr 48.506161 -1.714582 48.477861 -1.742703 myfile.png output.tif, then I got exactly the same result - or is there anything else I must do?
– F3L1X79
Apr 5 at 14:45
Thank you for helping me, Ian! If the new command you proposed is : gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr 48.506161 -1.714582 48.477861 -1.742703 myfile.png output.tif, then I got exactly the same result - or is there anything else I must do?
– F3L1X79
Apr 5 at 14:45
1
1
I'd try dal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
– Ian Turton♦
Apr 5 at 14:55
I'd try dal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
– Ian Turton♦
Apr 5 at 14:55
Amazing, thank you so much. Too bad, I was so close for the good result... Do you think I should delete the question?
– F3L1X79
Apr 5 at 15:01
Amazing, thank you so much. Too bad, I was so close for the good result... Do you think I should delete the question?
– F3L1X79
Apr 5 at 15:01
1
1
This time the source data is explicit and defines the meaning of coordinates
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.– user30184
Apr 5 at 16:57
This time the source data is explicit and defines the meaning of coordinates
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.– user30184
Apr 5 at 16:57
|
show 1 more comment
1 Answer
1
active
oldest
votes
The fact that your map appears at Madagascar and not France is the clue here. It means that your axes are swapped (Madagascar is about as far south as France is West). So you need to switch round the order of the coordinates in your bounding box (and I would use the shorter EPSG:4326 instead of the proj4 string).
So your command becomes
gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317910%2fconvert-a-png-file-to-a-geotiff-while-knowing-the-boundings%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The fact that your map appears at Madagascar and not France is the clue here. It means that your axes are swapped (Madagascar is about as far south as France is West). So you need to switch round the order of the coordinates in your bounding box (and I would use the shorter EPSG:4326 instead of the proj4 string).
So your command becomes
gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
add a comment |
The fact that your map appears at Madagascar and not France is the clue here. It means that your axes are swapped (Madagascar is about as far south as France is West). So you need to switch round the order of the coordinates in your bounding box (and I would use the shorter EPSG:4326 instead of the proj4 string).
So your command becomes
gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
add a comment |
The fact that your map appears at Madagascar and not France is the clue here. It means that your axes are swapped (Madagascar is about as far south as France is West). So you need to switch round the order of the coordinates in your bounding box (and I would use the shorter EPSG:4326 instead of the proj4 string).
So your command becomes
gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
The fact that your map appears at Madagascar and not France is the clue here. It means that your axes are swapped (Madagascar is about as far south as France is West). So you need to switch round the order of the coordinates in your bounding box (and I would use the shorter EPSG:4326 instead of the proj4 string).
So your command becomes
gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
answered Apr 5 at 15:27
Ian Turton♦Ian Turton
50.2k548118
50.2k548118
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317910%2fconvert-a-png-file-to-a-geotiff-while-knowing-the-boundings%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
your axes are the wrong way round - try to change the -a_srs to epsg:4326
– Ian Turton♦
Apr 5 at 14:35
Thank you for helping me, Ian! If the new command you proposed is : gdal_translate -of GTiff -a_srs EPSG:4326 -a_ullr 48.506161 -1.714582 48.477861 -1.742703 myfile.png output.tif, then I got exactly the same result - or is there anything else I must do?
– F3L1X79
Apr 5 at 14:45
1
I'd try dal_translate -of GTiff -a_srs EPSG:4326 -a_ullr -1.714582 48.506161 -1.742703 48.477861 myfile.png output.tif
– Ian Turton♦
Apr 5 at 14:55
Amazing, thank you so much. Too bad, I was so close for the good result... Do you think I should delete the question?
– F3L1X79
Apr 5 at 15:01
1
This time the source data is explicit and defines the meaning of coordinates
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.– user30184
Apr 5 at 16:57