question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

download from Mapbox endpoint pulls .webp files

See original GitHub issue

Hello, I have been working through your diary example on Tanzania but I want to pull from Mapbox instead as that is closer to what I’ll ultimately be doing. I ran the command:

rs download https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}@2x.webp?access_token=[API_KEY] output_folder_name

But I get back .webp files rather than .png files. I am less experienced with Mapbox/OSM and I’m coming from a deep learning background so I’d prefer to work directly with png (or jpeg) files so I can try some different segmentation models outside of what is available in Robosat (and potentially try to build out some features in the process). Can I change my rs download line in some way to get png/jpeg?

Thanks for building such a great product!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
daniel-j-hcommented, Apr 10, 2019

The .webp URl results in Mapbox sending a webp image file over the wire.

The --ext extension flag results in us saving the image file in the specified format.

We provide the ext flag so we not tied to tile endpoint formats.

0reactions
daniel-j-hcommented, Jun 7, 2020

Slippy Map tiles are geo-referenced by means of their tile ids, i.e. z,x,y in /z/x/y.png. Please reads e.g. the OSM wiki docs on that.

Re. the Mapbox API I don’t know if they have changed anything but in the past it was possible to download webp image tiles.

Good luck.

On June 7, 2020 8:22:37 AM UTC, radoslawkrolikowski notifications@github.com wrote:

Hello. I am not sure if that changed during last year, but the current version of Mapbox Raster API Documentation says that “Tiles that include mapbox.satellite are always delivered as JPEGs, even if the URL specifies PNG”. That can be proven by using gdalinfo example_raster.png that will return:

Driver: JPEG/JPEG JFIF
Files: example_raster.png
Size is 512, 512
Image Structure Metadata:
 COMPRESSION=JPEG
 INTERLEAVE=PIXEL
 SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)
Band 1 Block=512x1 Type=Byte, ColorInterp=Red
 Overviews: 256x256, 128x128
 Image Structure Metadata:
   COMPRESSION=JPEG
Band 2 Block=512x1 Type=Byte, ColorInterp=Green
 Overviews: 256x256, 128x128
 Image Structure Metadata:
   COMPRESSION=JPEG
Band 3 Block=512x1 Type=Byte, ColorInterp=Blue
 Overviews: 256x256, 128x128
 Image Structure Metadata:
   COMPRESSION=JPEG

Moreover, as we can see this image is not geo-referenced (any info about CRS). The same is shown by rasterio crs which returns None. Could anyone please confirm that API returns not geo-referenced rasters?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Static and print maps | Help - Mapbox docs
Static maps are standalone images in PNG format that can be displayed on web and mobile devices without the aid of a mapping...
Read more >
Serving map tiles from SQLite with MBTiles and datasette-tiles
Creating MBTiles files with my download-tiles tool. A sticking point when I started playing with MBTiles was finding example files to work with....
Read more >
AV Detection: Marked as clean - Hybrid Analysis
This report is generated from a file or URL submitted to this webservice on July 29th 2019 07:04:51 (UTC) and action script Default...
Read more >
daniel-j-h's Diary | RoboSat ❤️ Tanzania | OpenStreetMap
I will first walk you through creating a dataset based on drone imagery available on OpenAerialMap and corresponding building masks bootstrapped from ...
Read more >
How to Save a Mapbox GL Web Map Extent as an Image
Based on a need in the community of users, we made the list available as a PDF download, in addition to displaying results...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found