MapPLZ-Node
MapPLZ is a framework to make mapping quick and easy in your favorite language.
Getting started
MapPLZ consumes many many types of geodata. It can process data for a script or dump it into a database.
Adding some data:
var MapPLZ = MapPLZ;var mapstore = ; // add pointsmapstore;mapstore;mapstore; // assure items are added using callbacksmapstore;mapstore; // add linesmapstore; // add polygonsmapstore; // GeoJSON objects or stringsmapstore;mapstore; // add propertiesmapstore; mapstore; // also: WKT, CSV strings, and MapPLZ codemapstore;mapstore; mapcode = "map\n";mapcode += " marker\n";mapcode += " [40, -70]\n";mapcode += " plz\n";mapcode += "plz\n";mapstore;
Each feature is returned as a MapItem, which is easy to retrieve data from.
mapstore; { ptlat == 40 pt == '{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-70, 40] }}' linetype == "line" linepath == 40 -70 50 20 linepropertiescolor == "red" pt; line;}
Queries
You don't need a database to query data with MapPLZ, but you're able to use Postgres/PostGIS or MongoDB for faster, more accurate queries. As of version 1, this library no longer supports RethinkDB.
MapPLZ simplifies geodata management and queries:
mapstore;mapstore;mapstore;mapstore; // with PostGISmapstore;mapstore; // with any setup other than PostGISmapstore;mapstore;
Setting up PostGIS
const pg = ;const MapPLZ = ; var mapstore = ;var connString = "postgres://postgres:@localhost/travis_postgis"; var client = connString;client;
Setting up MongoDB
var MongoClient = MongoClient;var MapPLZ = ; var mapstore = ;var connString = "mongodb://localhost:27017/sample"; MongoClient;
Interactive Maps
Export as an interactive HTML/JS map
mapstore;
Dependencies
All are installed when you run npm install mapplz
- coffee-script (MIT license)
- geolib (MIT license)
- node-postgres (BSD license)
- node-mongodb-native (Apache license)
- fast-csv (MIT license)
License
Free BSD License