0.1.1 • Published 10 years ago

mysql2geojson v0.1.1

Weekly downloads
1
License
CC0
Repository
github
Last release
10 years ago

MySQL2GeoJSON

A Node.js module for returning MySQL query results as usable GeoJSON or TopoJSON objects. Ideally paired with node-mysql.

Installation

npm install mysql2geojson

Example Usage
var mysql2geojson = require("mysql2geojson");

// MySQL query...

mysql2geojson.parse({
	"data": data,
	"format": "geojson",
	"callback": function(error, result) {
		if (error) {
		   console.log(error);
		}
		// This will log a valid GeoJSON object
		console.log(result)
	}
});

API

parse(params)

params is an object that contains the following keys:

  • data (required) - Results from a MySQL query. Geometry must be selected AsWKT.
  • format - can be either "geojson" or "topojson". Default is "geojson".
  • geometry - name of column that contains geometry. Default is "geometry".
  • callback(error, result) (required) - a function with two parameters: an error, and a result object

License

CC0