NodeJS API Server for serving GeoJSON from Postgres or MySQL spatial tables https://sql2geojson.herokuapp.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sudipto a96974831c nr config 1 year ago
example layer control expanded 1 year ago
.gitignore initial commit 1 year ago
LICENSE 0.2.0 1 year ago
README.md update doc 1 year ago
index.html schema support for postgres 1 year ago
install.bat batch files cleanup 1 year ago
newrelic.js nr config 1 year ago
node.msi initial commit 1 year ago
package-lock.json nr config 1 year ago
package.json nr config 1 year ago
run.bat batch files cleanup 1 year ago
server.js nr config 1 year ago
update.bat initial commit 1 year ago

README.md

SQL2GeoJSON API Server

NodeJS API server for serving GeoJSON from Postgres or MySQL spatial tables.

Example Deployment on Heroku

Quick Start

Configuration

You must have NodeJS installed on your system.

You should ideally have PostgreSQL v9.4+ or MySQL v5.7+ as the queries used use certain functions such as jsonb_build_object() and jsonb_agg() for Postgres and JSON_OBJECT() and JSON_ARRAYAGG() for MySQL.

Running the app

Clone this repository and execute run.bat.

run.bat

# you will be prompted for the connection details
# add ?ssl=true to the DB Nameif your db server
# requires SSL

> npm start

Server listening on port 5000 # port can be changed on line 7 or 334 of server.js

For a working example, import the inscluded ESRI shapefiles into your geodatabase.

Note: Postgres uses geom as the geometry column while MySQL seems to use shape column for the same. If you have your spatial data on geom in a MySQL database, do the following edit in server.js

// line 269 and 278 of server.js
    ...
    // change shape to your spatial column (eg geom)
    'geometry', ST_AsGeoJSON(shape),
    ...

Author

Sudipto Ghosh

Portfolio: sudipto.ghosh.pro

This app is provided under the MIT License.