I'm looking for a way to display a Mapbox map in QGis in so it's recognized as a raster layer.
I've already tried this, and I succeeded adding the TMS layer via TileLayer Plugin, using my mapbox url like this: https://a.tiles.mapbox.com/styles/v1/[my_username]/[map_ID]/tiles/256/{z}/{x}/{y}?access_token=[my_access_token]
The problem is, adding a layer in this way is not recognized by QGIS as a raster layer, and I need to perform some raster operations on it.
On the other hand, I tried to create an XML file like this:
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>https://a.tiles.mapbox.com/styles/v1/[my_username]/[map_ID]/tiles/256/${z}/${x}/${y}?access_token=[my_access_token]</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>
but it's not working.
Using the exact same XML with the Google TMS url http://mt.google.com/vt/lyrs=s&x=${x}&y=${y}&z=${z}
works ok.
Am I missing something here?
EDIT
running the command
gdalinfo --debug on mapboxTMS.xml
returns the following output:
GDAL: Auto register C:\OSGEO4~1\bin\gdalplugins\gdal_ECW_JP2ECW.dll using GDALRegister_ECW_JP2ECW.
GDAL: GDALOpen(mapboxTMS.xml, this=0000000002BCEA30) succeeds as WMS.
Driver: WMS/OGC Web Map Service
Files: mapboxTMS.xml
Size is 67108864, 67108864
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4326"]],
PROJECTION["Mercator_1SP"],
PARAMETER["central_meridian",0],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["X",EAST],
AXIS["Y",NORTH],
EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],
AUTHORITY["EPSG","3857"]]
Origin = (-20037508.340000000000000,20037508.340000000000000)
Pixel Size = (0.597164283394814,-0.597164283394814)
Image Structure Metadata:
INTERLEAVE=PIXEL
OGRCT: PROJ >= 4.8.0 features enabled
OGRCT: Using locale-safe proj version
OGRCT: Source: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs
OGRCT: Target: +proj=longlat +ellps=WGS84 +no_defs
Corner Coordinates:
Upper Left (-20037508.340,20037508.340) (180d 0' 0.00"W, 85d 3' 4.06"N)
Lower Left (-20037508.340,-20037508.340) (180d 0' 0.00"W, 85d 3' 4.06"S)
Upper Right (20037508.340,20037508.340) (180d 0' 0.00"E, 85d 3' 4.06"N)
Lower Right (20037508.340,-20037508.340) (180d 0' 0.00"E, 85d 3' 4.06"S)
Center ( 0.0000000, 0.0000000) ( 0d 0' 0.01"E, 0d 0' 0.01"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Overviews: 33554432x33554432, 16777216x16777216, 8388608x8388608, 4194304x4194304, 2097152x2097152, 1048576x1048576, 524288x524288, 262144x262144, 131072x131072, 65536x65536, 32768x32768, 16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 512x512, 256x256
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Overviews: 33554432x33554432, 16777216x16777216, 8388608x8388608, 4194304x4194304, 2097152x2097152, 1048576x1048576, 524288x524288, 262144x262144, 131072x131072, 65536x65536, 32768x32768, 16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 512x512, 256x256
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Overviews: 33554432x33554432, 16777216x16777216, 8388608x8388608, 4194304x4194304, 2097152x2097152, 1048576x1048576, 524288x524288, 262144x262144, 131072x131072, 65536x65536, 32768x32768, 16384x16384, 8192x8192, 4096x4096, 2048x2048, 1024x1024, 512x512, 256x256
GDAL: GDALClose(mapboxTMS.xml, this=0000000002BCEA30)
It doesn't look like there's something wrong with it :/