0

I'm trying to make a very simple map of North Korea using SRTM elevation data from EarthExplorer, which starts life as 1-second GeoTIFF tiles, and a basic border shapefile from NaturalEarth. Ultimately I need to load this into D3 and GeoTiff.js for an interactive Web version, which is unfortunately not as seamless as using QGIS. This isn't a D3/JavaScript question so much as a foundational question about how GeoTIFFs work and how to get them into lat/lng coordinates in order to behave like shapefiles.

I started by stitching the SRTM files into one large GTiff, which wasn't a problem:

gdal_merge.py -o ../north_korea.tif -n -32767 *.tif

QGIS has no problem matching the merged TIF to the shapefile (hideous pink here is just for contrast):

enter image description here

Unfortunately, when the browser tries to load a much smaller GeoTIFF with the same projection (["EPSG","4326"]) from gdalinfo as the original tiles, it gets very confused and maps a little, inverted PRK inside the larger one:

enter image description here

How does QGIS etc. manage to correctly translate pixel position in a GeoTIFF to lat/lng, using the file's metadata, such that it can be displayed in any projection? Whatever that magical power is, it's not currently happening in the browser version, which I can figure out much faster if I understand why it works in QGIS with no help from me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.