Open a Mapbox map in QGis

强颜欢笑 提交于 2019-12-07 13:06:46

问题


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.



来源:https://stackoverflow.com/questions/22321251/open-a-mapbox-map-in-qgis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!