0

I have a large set of raster tiles (.png's), each corresponding to a 1x1km square aligned to the OSGB National Grid (e.g: SU-50-50.png).

These locations are well-defined, but the files themselves aren't georeferenced (other than by virtue of the naming scheme).

My end goal is to have them in a single SQLITE database in the OSMAnd format, however it seems like the easiest approach would be to get them into MBTiles first (since it's a more supported format), and convert from there.

My understanding is that the files I have are in the OSGB projection, and so it seems to me that the images themselves will need to be transformed, as well as mapping from the National Grid units to the coordinate scheme used by MBTiles, and finally putting them into the database itself.

Is there an existing tool or method I can use to achieve this? I am fairly confident in the steps, but I have a sense that coding it all myself would be going at it the hard way.

1 Answer 1

1

My first step would be to construct a "world file" for each of them from the name of the file (search "image world file georeference" or similar). Then make a GDAL VRT as a "mosaic" of them all. That gives you one GDAL "image" (actually a virtual raster) that you can feed to any other GDAL-compatible code for making whatever tiles you need to construct. This would be in OSGB coordinate system (EPSG code 27700)

Then transformations to whatever you need your final output in (eg web Mercator, EPSG 3857) could be done by GDAL (but would degrade the image quality).

2
  • OS tiles usually come with a world file but no projection file - blog.ianturton.com/geotools,/projections,/itches/2017/10/20/…
    – Ian Turton
    Commented Aug 17, 2023 at 10:18
  • 2
    Hard to know exactly what to do without some more info on the OP's data - I started this answer as a comment since it was never going to be a complete "simply run this script" answer.
    – Spacedman
    Commented Aug 17, 2023 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.