TransWikia.com

Add raster image (GeoTIFF) over a TMS with Mapbox

Geographic Information Systems Asked on March 25, 2021

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).

2 Answers

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); 

Correct answer by Greg on March 25, 2021

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.

Answered by Gabriel do Nascimento on March 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP