Simple example demonstrating how to use node-mapnik to generate Mapbox format vector tiles on the fly from a PostGIS data source, using TypeScript.
- node-mapnik dependencies
- Postgres database with PostGIS installed, pre-populated with geospatial data
Create a file .env
and add the following:
DB_HOST=... // e.g. <mypostgreshost.com>
DB_PORT=...
DB_NAME=...
DB_USER=...
DB_PASSWORD=...
(or manually set these as environment variables)
Modify EXAMPLE_TABLE_QUERY
in constants.ts
to pull in the data that you require.
The results set must contain a column of type geometry
.
npm install
npm start