2011-09-05 07:00:41 +08:00
|
|
|
Windshaft-CartoDB
|
|
|
|
==================
|
|
|
|
|
2013-09-13 00:09:18 +08:00
|
|
|
[![Build Status](https://travis-ci.org/CartoDB/Windshaft-cartodb.png)](http://travis-ci.org/CartoDB/Windshaft-cartodb)
|
2012-07-09 19:21:19 +08:00
|
|
|
|
2013-12-17 00:17:55 +08:00
|
|
|
This is the CartoDB map tiler. It extends Windshaft with some extra
|
2012-03-15 18:37:25 +08:00
|
|
|
functionality and custom filters for authentication
|
2011-09-05 07:17:39 +08:00
|
|
|
|
2013-12-17 00:17:55 +08:00
|
|
|
* reads dbname from subdomain and cartodb redis for pretty tile urls
|
2012-10-04 18:39:26 +08:00
|
|
|
* configures windshaft to publish ``cartodb_id`` as the interactivity layer
|
2011-10-08 01:31:45 +08:00
|
|
|
* gets the default geometry type from the cartodb redis store
|
2013-12-17 00:17:55 +08:00
|
|
|
* allows tiles to be styled individually
|
2011-12-13 02:02:10 +08:00
|
|
|
* provides a link to varnish high speed cache
|
2011-10-08 01:31:45 +08:00
|
|
|
* provides a infowindow endpoint for windshaft
|
2013-12-17 00:17:55 +08:00
|
|
|
* provides a ``map_metadata`` endpoint for windshaft
|
2011-09-05 07:17:39 +08:00
|
|
|
|
2012-07-24 17:43:25 +08:00
|
|
|
Requirements
|
|
|
|
------------
|
|
|
|
|
|
|
|
[core]
|
2013-09-13 00:09:18 +08:00
|
|
|
- node-0.8.x+
|
2012-07-24 22:09:27 +08:00
|
|
|
- PostgreSQL-8.3+
|
|
|
|
- PostGIS-1.5.0+
|
|
|
|
- Redis 2.2.0+ (http://www.redis.io)
|
|
|
|
- Mapnik 2.0 or 2.1
|
|
|
|
|
2012-07-24 17:43:25 +08:00
|
|
|
[for cache control]
|
|
|
|
- CartoDB-SQL-API 1.0.0+
|
2013-12-17 00:17:55 +08:00
|
|
|
- CartoDB 0.9.5+ (for ``CDB_QueryTables``)
|
2012-07-24 17:43:25 +08:00
|
|
|
- Varnish (https://www.varnish-cache.org)
|
|
|
|
|
2012-07-23 21:02:52 +08:00
|
|
|
Configure
|
|
|
|
---------
|
|
|
|
|
|
|
|
Create the config/environments/<env>.js files (there are .example files
|
|
|
|
to start from). You can optionally use the ./configure script for this,
|
|
|
|
see ```./configure --help``` to see available options.
|
|
|
|
|
|
|
|
Look at lib/cartodb/server_options.js for more on config
|
|
|
|
|
|
|
|
Build/install
|
|
|
|
-------------
|
|
|
|
|
|
|
|
To fetch and build all node-based dependencies, run:
|
2012-03-15 19:08:50 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
```
|
|
|
|
git clone
|
|
|
|
npm install
|
2012-03-15 19:08:50 +08:00
|
|
|
```
|
|
|
|
|
2012-04-04 21:17:07 +08:00
|
|
|
Note that the ```npm install``` step will populate the node_modules/
|
|
|
|
directory with modules, some of which being compiled on demand. If you
|
|
|
|
happen to have startup errors you may need to force rebuilding those
|
|
|
|
modules. At any time just wipe out the node_modules/ directory and run
|
|
|
|
```npm install``` again.
|
|
|
|
|
2012-03-15 19:08:50 +08:00
|
|
|
|
|
|
|
Run
|
|
|
|
---
|
|
|
|
|
|
|
|
```
|
2012-07-20 23:31:10 +08:00
|
|
|
node app.js <env>
|
2011-09-05 07:17:39 +08:00
|
|
|
```
|
|
|
|
|
2012-07-20 23:31:10 +08:00
|
|
|
Where <env> is the name of a configuration file under config/environments/.
|
|
|
|
|
|
|
|
Note that caches are kept in redis. If you're not seeing what you expect
|
|
|
|
there may be out-of-sync records in there.
|
2012-04-18 18:09:43 +08:00
|
|
|
Take a look: http://redis.io/commands
|
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
|
|
|
|
URLs
|
|
|
|
----
|
|
|
|
|
|
|
|
**TILES**
|
2011-09-05 07:36:31 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
[GET] subdomain.cartodb.com/tiles/:table_name/:z/:x/:y.[png|png8|grid.json]
|
|
|
|
|
|
|
|
Args:
|
2011-09-05 07:36:31 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
* sql - plain SQL arguments
|
|
|
|
* interactivity - specify the column to use in UTFGrid
|
2012-10-24 15:40:05 +08:00
|
|
|
* cache_buster - Specify an identifier for the internal tile cache.
|
|
|
|
Requesting tiles with the same cache_buster value may
|
|
|
|
result in being served a cached version of the tile
|
|
|
|
(even when requesting a tile for the first time, as tiles
|
|
|
|
can be prepared in advance)
|
|
|
|
* cache_policy - Set to "persist" to have the server send an Cache-Control
|
|
|
|
header requesting caching devices to keep the response
|
|
|
|
cached as much as possible. This is best used with a
|
|
|
|
timestamp value in cache_buster for manual control of
|
|
|
|
updates.
|
2011-09-05 07:17:39 +08:00
|
|
|
* geom_type - override the cartodb default
|
2011-12-13 02:02:10 +08:00
|
|
|
* style - override the default map style with Carto
|
2011-09-05 07:17:39 +08:00
|
|
|
|
2011-09-05 07:36:59 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
**STYLE**
|
2011-09-05 07:36:31 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
[GET/POST] subdomain.cartodb.com/tiles/:table_name/style
|
|
|
|
|
|
|
|
Args:
|
2011-09-05 07:36:31 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
* style - the style in CartoCSS you want to set
|
2012-11-14 20:45:11 +08:00
|
|
|
* style_version - the version of the style for POST
|
|
|
|
* style_convert - request conversion to target version (both POST and GET)
|
2011-09-05 07:17:39 +08:00
|
|
|
|
2011-09-05 07:36:59 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
**INFOWINDOW**
|
2011-09-05 07:36:31 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
[GET] subdomain.cartodb.com/tiles/:table_name/infowindow
|
|
|
|
|
|
|
|
Args:
|
2011-09-05 07:36:31 +08:00
|
|
|
|
2011-09-05 07:17:39 +08:00
|
|
|
* infowindow - returns contents of infowindow from CartoDB.
|
|
|
|
|
|
|
|
|
2011-10-08 01:31:45 +08:00
|
|
|
**MAP METADATA**
|
|
|
|
|
|
|
|
[GET] subdomain.cartodb.com/tiles/:table_name/map_metadata
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
|
|
|
* infowindow - returns contents of infowindow from CartoDB.
|
|
|
|
|
|
|
|
|
2012-03-15 18:37:25 +08:00
|
|
|
All GET requests are wrappable with JSONP using callback argument,
|
|
|
|
including the UTFGrid map tile call.
|