Open a Mapbox map in QGis

2019-05-12 22:45发布

问题:

I'm looking for a way to display one of my Mapbox map in QGis (baselayer edited on mapbox.com & data uploaded from tilemill).

Did someone here already find a way ? Is there a feature or a plugin to do that ?

Thanks for your future answers !

Adrien

回答1:

Yesterday, I found two solutions by myself :

1) the pretty official "TileLayer Plugin" QGis plugin

You'll have to write a TSV file (Tab Separated Values) with, at least, the name, the credits and the URL of your Mapbox map. The URL should look like :

http://a.tiles.mapbox.com/v3/mapboxId.mapId/{z}/{x}/{y}.png

You just have to replace mapboxId and mapId with your ids. See the github repository of the plugin for further informations and values to add to your TSV file (minZoom, maxZoom, etc).

Then, in the "settings" menu of the plugin, link the plugin to the directory of your TSV file ("external layers directory").

Finally, in the "add" menu of the plugin, select your map and click "add".

2) a XML file which is interpreted as a raster

Write a XML file with this code :

<GDAL_WMS>
    <Service name="TMS">
        <ServerUrl>http://a.tiles.mapbox.com/v3/mapboxId.mapId/${z}/${x}/${y}.png</ServerUrl>
    </Service>
    <DataWindow>
        <UpperLeftX>-20037508.34</UpperLeftX>
        <UpperLeftY>20037508.34</UpperLeftY>
        <LowerRightX>20037508.34</LowerRightX>
        <LowerRightY>-20037508.34</LowerRightY>
        <TileLevel>18</TileLevel>
        <TileCountX>1</TileCountX>
        <TileCountY>1</TileCountY>
        <YOrigin>top</YOrigin>
    </DataWindow>
    <Projection>EPSG:3857</Projection>
    <BlockSizeX>256</BlockSizeX>
    <BlockSizeY>256</BlockSizeY>
    <BandsCount>3</BandsCount>
    <Cache />
</GDAL_WMS>

Once again, replace the ids with yours. Then, open the file in QGis as a raster.



标签: mapbox qgis