Skip to content

Instantly share code, notes, and snippets.

@strk
Created September 18, 2013 12:05
Show Gist options
  • Save strk/6608224 to your computer and use it in GitHub Desktop.
Save strk/6608224 to your computer and use it in GitHub Desktop.
https://strk.cartodb.com/tiles/layergroup/662381ebb78b01d284a9bf18bcb74324:0/{z}/{x}/{y}.png?cache_policy=persist
@risicle
Copy link

risicle commented Sep 20, 2013

Hi strk,

Do you have an updated version of this that will work briefly so I can get a screenshot of our final hack including the overlay to illustrate a blog post I'm going to make about this week's hackathon?

robert.

@strk
Copy link
Author

strk commented Sep 22, 2013

I told you a more stable solution was needed :)

Maybe this:
https://strk.cartodb.com/tiles/layergroup/f0ffdaf7c1ed91904d37137f6fdc87f6:0/{z}/{x}/{y}.png?cache_policy=persist
if you're quick enough before it expires ...

@strk
Copy link
Author

strk commented Sep 22, 2013

For the record: you can obtain a "token" to put after "layergroup" component by specifying full configuration in a request to layergroup. Here's an example which produces the map I just pasted:

http://strk.cartodb.com/tiles/layergroup?config=%7B%22version%22%3A%221.0.1%22%2C%22stat_tag%22%3A%226ab75916-205a-11e3-975d-5404a6a69006%22%2C%22layers%22%3A%5B%7B%22type%22%3A%22cartodb%22%2C%22options%22%3A%7B%22sql%22%3A%22select%20*%20from%20roads2011%22%2C%22cartocss%22%3A%22%2F**%20choropleth%20visualization%20*%2F%5Cn%5Cn%23roads2011%7B%5Cn%20%20line-color%3A%20%23FF6600%3B%5Cn%20%20line-opacity%3A%201%3B%5Cn%20%20line-width%3A%203%3B%5Cn%20%20polygon-opacity%3A%200%3B%5Cn%7D%5Cn%23roads2011%20%5B%20rno2%20%3C%3D%20135.73219%5D%20%7B%5Cn%20%20%20line-color%3A%20%23B10026%3B%5Cn%7D%5Cn%23roads2011%20%5B%20rno2%20%3C%3D%2050.31549%5D%20%7B%5Cn%20%20%20line-color%3A%20%23E31A1C%3B%5Cn%7D%5Cn%23roads2011%20%5B%20rno2%20%3C%3D%2040.70651%5D%20%7B%5Cn%20%20%20line-color%3A%20%23FC4E2A%3B%5Cn%7D%5Cn%23roads2011%20%5B%20rno2%20%3C%3D%2035.72746%5D%20%7B%5Cn%20%20%20line-color%3A%20%23FD8D3C%3B%5Cn%7D%5Cn%23roads2011%20%5B%20rno2%20%3C%3D%2032.05346%5D%20%7B%5Cn%20%20%20line-color%3A%20%23FEB24C%3B%5Cn%7D%5Cn%23roads2011%20%5B%20rno2%20%3C%3D%2028.72005%5D%20%7B%5Cn%20%20%20line-color%3A%20%23FED976%3B%5Cn%7D%5Cn%23roads2011%20%5B%20rno2%20%3C%3D%2024.35304%5D%20%7B%5Cn%20%20%20line-color%3A%20%23FFFFB2%3B%5Cn%7D%22%2C%22cartocss_version%22%3A%222.1.1%22%2C%22interactivity%22%3A%5B%22cartodb_id%22%5D%7D%7D%5D%7D

You can use POST instead of GET, if you want. The request contains an SQL query and a CartoCSS which you can tweak with the style you prefer. It will return a token for use to get tiles.

@risicle
Copy link

risicle commented Sep 23, 2013

That's pretty damn cool - I've been having a play with cartodb myself. Impressive stuff. Bit of a bulky interface though.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment