Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

Export image through command line? #1024

Closed
ikmolbo opened this issue Nov 16, 2014 · 7 comments
Closed

Export image through command line? #1024

ikmolbo opened this issue Nov 16, 2014 · 7 comments

Comments

@ikmolbo
Copy link

ikmolbo commented Nov 16, 2014

I've just discovered MapBox Studio and its excellent hi-res image export function. But is it possible to achieve the same via the command line (so that I can export an image without using the GUI)?

I'd really appreciate an example.

Many thanks,

@camilleanne
Copy link
Contributor

@wriggle

Yes -- this is possible. The Download button in the export pane is is a link to the Mapbox Studio endpoint that delivers the image. As long as Mapbox Studio is running, you can hit the endpoint from either the browser or the terminal.

There are actually two endpoints -- one takes WSEN coordinates and generates pixel dimensions from that, the other takes a center point and width & height in pixels and determines the geographic boundaries from that.

URI format:
WSEN: http://localhost:3000/static/{zoom}/{west},{south},{east},{north}@{scale}x.{format}?id={tmstyle}
Center with pixel dimensions: http://localhost:3000/static/{zoom},{x},{y}/{px}x{py}@{scale}x.{format}?id={tmstyle}

Note on scale: 1 is standard screen resolution (256x256px tiles), 2 is retina (512x512px tiles) and so on..., scale should be a round number when multiplied by 256, otherwise you'll get weird lines where the tiles are stitched together.

@wboykinm
Copy link

AWESOME

@wheredoesyourmindgo
Copy link

What should I plug into that {tmstyle} parameter? I tried "username.map_id" and "map_id" but i get the following msg in my browser.

Error: Invalid style protocol

My url looks like:
http://localhost:3000/static/18/-120.1734,39.2812,-120.1659,[email protected]?id=my-awesome-username.abc12345

@camilleanne
Copy link
Contributor

@wheredoesyourmindgo what that {tmstyle} parameter should be is a lot less clear if you are using the packaged version of Mapbox Studio because the url bar isn't visible in the desktop version, but if you're building Mapbox Studio from github you'll see your tmstyle in the navigation bar of your browser:

screen shot 2015-01-14 at 4 55 39 pm

if you're using the packaged version of Mapbox Studio you can construct the tmstyle by concatenating tmstyle:// + {the absolute location of your style}

@wheredoesyourmindgo
Copy link

Awesome += 1; //thanks!

@maximeCony
Copy link

@camilleanne I need to add directions to the static maps. Do you know how I should proceed to add geojson support?

@armoucar
Copy link

armoucar commented Dec 8, 2015

Awesome += 1; //thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants