Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bensheldon/nodetiles-311dailybriefing
Database backed map tile/UTFGrid renderer.
https://github.com/bensheldon/nodetiles-311dailybriefing
Last synced: about 1 month ago
JSON representation
Database backed map tile/UTFGrid renderer.
- Host: GitHub
- URL: https://github.com/bensheldon/nodetiles-311dailybriefing
- Owner: bensheldon
- Created: 2012-05-03T17:14:11.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-05-03T17:17:55.000Z (over 12 years ago)
- Last Synced: 2024-05-02T06:08:36.188Z (7 months ago)
- Language: JavaScript
- Size: 18 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
NodeTile: Occupy Map
====================_This is a proof-of-concept map of Occupy sites based on data from [Chris Herwig's CartoSyling/Occupy Streets project](https://github.com/kleinjos/carto-styling/tree/master/occupy-streets)._
This is a dirty hack to do server-side map tile rendering using geojson/shapefiles. Map tiles are rendered using node-canvas--a [special version](https://github.com/bensheldon/node-canvas-heroku) that includes a pre-compiled Cairo binary that works on Heroku--and requested via a standard leaflet map. This demo currently renders Baltimore neighbrhoods.
Big THANKS to [Tom Carden](https://github.com/RandomEtc) whose [original gist](https://gist.github.com/668577) inspired this project. He also has other very [useful](https://github.com/RandomEtc/nodemap) [projects](https://github.com/RandomEtc/shapefile-js).
Installation on Heroku
----------------------1. Clone it
2. Within the directory, `heroku create --stack cedar`
3. Setup your heroku environment variables for node-canvas-heroku
$ heroku config:add LD_PRELOAD='/app/node_modules/canvas/cairo/libcairo.so /app/node_modules/canvas/lib/libpixman-1.so.0 /app/node_modules/canvas/lib/libfreetype.so.6' --app$ heroku config:add LD_LIBRARY_PATH=/app/node_modules/canvas/cairo --app
IMPORTANT: replace the `` at the end of each command with your Heroku app's name, e.g. 'furious-sparrow-2089'
4. `git push heroku master`
5. Rejoice / Open an issue that these instructions are inadequateLocal Development
-----------------For local development, you need to install node-canvas manually and from the normal source (NOT node-canvas-heroku): npm install` node-canvas`. Then just run `node app.js`.
How it works / How to modify it
-------------------------------This application renders PNG map tiles as well as UTFGrid interaction tiles from static geojson files (though it would be relatively trivial to load geojson from a live database instead). Those geojson are loaded into the `Layers` list along with some basic style settings. When a specific tile is requested, a new canvas is created and the Layers, then Features are stepped through and drawn to a canvas, which is then streamed back to the requesting client as a PNG. UTFGrids are rendered in much the same way: they are drawn as a raster where each feature is assigned a unique RGB value; the resulting raster is then read out to create a UTFGrid.
Shapefiles
----------Within the `/geodata` directory are GEOjson files from the [datasf.of](https://data.sfgov.org/) (transformed via ogr2ogr).
* San Francisco Shorelines
* San Francisco Street Centerlines
* San Francisco Parks
* San Francisco Parcels (is huge and crashes Heroku when loaded; >500MB memory)And some others, including world outlines from [Natural Earth](http://www.naturalearthdata.com/).
Contact
-------Email me at [email protected] or open an issue.