Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cartodb/torque-gen
Export Torque tiles from local Postgres tables or your CartoDB account
https://github.com/cartodb/torque-gen
Last synced: 6 days ago
JSON representation
Export Torque tiles from local Postgres tables or your CartoDB account
- Host: GitHub
- URL: https://github.com/cartodb/torque-gen
- Owner: CartoDB
- Created: 2015-09-28T08:59:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-29T14:39:52.000Z (about 9 years ago)
- Last Synced: 2024-04-09T20:58:26.745Z (7 months ago)
- Language: Python
- Homepage:
- Size: 133 KB
- Stars: 5
- Watchers: 8
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## torque-gen
### Description
The torque.py script lets you export [Torque tilecubes](https://github.com/CartoDB/tilecubes) to static files for storage and use. This script can be useful for storage and backup of your Torque visualizations as well as using the Torque library offline or where the CartoDB backend isn't needed.
### Installation
Just run `make` to install all dependencies.
### Usage
Below are a list of parameters shared for both datasources (CartoDB and Postgis):
| Option | Short | type | Description |
|-----------|:-----------|:-----------|:----------|
| --aggregation | -a | string | SQL aggregation function to calculate each pixel **value** |
| --ordering | -o | string | The name of the column (either number or date) that orders your data |
| --is_time | -q | string | Default True, set to false if your ordering column is not temporal |
| --steps | -s | integer | The number of ordered steps in your tile cubes |
| --resolution | -r | integer | The width and height dimensions of each pixel |
| --zoom | -z | string | The zoom extents to generate tiles |
| --dir | -d | string | Optional. The directory to store your output |
| --verbose | -v | none | Optional. Verbose log output |#### CartoDB data source
##### Example
```bash
python torque.py cartodb -u andrew -t all_week -a 'count(*)' -o time
-s 2 -r 4 -z 0-1 -d tiles -v
```##### Options
| Option | Short | type | Description |
|-----------|:-----------|:-----------|:----------|
| --user | -u | string | Name of the account where the tiles are generated |
| --table | -t | string | Name of the table where the Torque data is hosted |
| --api_key | -k | string | Optional. Your account api_key if the table is set to **private** |#### PostGIS data source
#####Example
```bash
python torque.py postgis -u andrew -t all_week -a 'count(*)' -o time
-s 2 -r 4 -z 0-1 -w "ST_Transform(the_geom, 3857)" --pg_host localhost
--pg_db postgresql --pg_user postgresql -d tiles
```| Option | Short | type | Description |
|-----------|:-----------|:-----------|:----------|
| --pg_host | | string | Hostname of your PostgreSQL database |
| --pg_db | | string | PostgreSQL database name |
| --pg_user | | string | PostgreSQL username |
| --webmercator | -w | string | Either a column containing your webmercator geometry or a quoted SQL statement to transform a geometry on the fly to webmercator. |### Storage
A each Torque tile is a small JSON document that matches the dimensions of a map tile in webmercator. Just like web tiles, Torque tiles are stored in a nested folder structure that follows the organization ```{zoom level}/{x coordinate}/{y coordinate}.json.torque```.
### Authors
* Andrew W. Hill ([email protected])
* Andy Eschbacher ([email protected])
* Raúl Ochoa ([email protected])
* Francisco Dans ([email protected])