0

Having some GeoTIFFs, which I would like to display georeferenced over a TMS (in an impossible way to download the GeoTIFF, like another WMS or TMS). Is that possible?

Note: Currently I use Mapbox with react (react-mapbox-gl), I would prefer to solve it that way, but other methods can count as well (e.g. using PostgreSQL or GDAL).

0

This question is probably beyond me as I don't completely understand it.

But I have old maps that I georeferenced and exported using QGIS as tiles which I serve on AWS.

I'm using Leaflet which is what Mapbox is based on. I think the following gives a flavor of what I did. I do also have some Mapbox and use the npm module which includes Leaflet.

var woods1908url = "https://<myRepository>.s3.amazonaws.com/tiles/1908woods/{z}/{x}/{y}.png"
var osmUrl    = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
var woods1908 = L.tileLayer(woods1908url, { maxZoom:17 })
var osmMap    = L.tileLayer(osmUrl)
var baseLayers = {"<span style='color: orange'>OSM Street</span>" : osmMap,
  …,
}
var overlayLayers = {"<span style='color: blue'>1908 Wood</span>" : woods1908,
  …}
map = L.map('map', {zoomDelta: 0.25, zoomSnap: 0.25  }).setView([34.05, -118.25], 13);
L.control.layers(null, baseLayers, {collapsed: false}).addTo(map); 

| improve this answer | |
  • Can you tell which QGIS method have you used to create the tile PNGs? Maybe there is a GDAL alternative for that (or it's a GDAL call). So the overlay was simply over the base layer (without white/black areas)? I suppose have to be a corresponding Mapbox method for that. – pnz Jul 11 at 9:16
  • My notes say I used QTiles plugin. QGIS is a free and now easy installation (used to have some complexities especially for macOS). gis.stackexchange.com/questions/14087/… says "For QGIS 3.8 or greater, generating tiles is built in - you can find it in the Processing tool box as Generate XYZ tiles (Directory) and Generate XYZ tiles (MBTiles)." Don't know anything about GDAL except that it's used by QGIS. (Can't fit the entire answer) – Greg Jul 11 at 16:20
  • If by B/W areas you mean blank areas within the rectangle, I remember making them transparent using probably Photoshop. Those images were probably TIFFs which much of this software is happier with. I had many false starts on getting the settings right to keep the clear clear. Check out stark-cove-20051.herokuapp.com/overview and click on say "1908 Wood" to see the clear areas. BTW the site is slightly broken as I'm in the middle of updating it. You may have to select the basemap and overlay map more than once. – Greg Jul 11 at 16:27
  • Actually that's the problem I have to use a development service, where I can't run software (e.g. QGIS), only Python packages. Or I can use PostgreSQL as well. – pnz Jul 11 at 20:33
  • @pnz Sounds like you have some serious constraints. You can't upload anything? Can you look at how these things are implemented in QGIS and see if they are using PostgresQL or GDAL. Assume it would have to be GDAL as that doesn't seem like anything a database would do. gdal.org/drivers/raster/mbtiles.html. But I – Greg Jul 12 at 1:47
0

Mapbox has a product called Mapbox Studio, which you can upload a GeoTIFF. They will process and host your GeoTIFF as a layer/source that you can add to any map using Mapbox GL JS.

Code example below:

                map.addLayer({
                        id: `raster-layer-RGB-${tilesetId}`,
                        type: 'raster',
                        source: {
                            type: 'raster',
                            tiles: [`https://api.mapbox.com/v4/${tilesetId}/{z}/{x}/{y}.png?access_token=YOUR_MAPBOX_ACCESS_TOKEN`],
                    }
                }, 'tunnel-oneway-arrow-blue');

** tilesetId is the ID generated by the Mapbox Studio when you upload a GeoTIFF.

| improve this answer | |

Your Answer

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

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