Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@acrossthecloud/dbgeo

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acrossthecloud/dbgeo

A Node.js module for converting database queries to GeoJSON and TopoJSON

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dbgeo

Convert database query results to GeoJSON or TopoJSON. Inspired by Bryan McBride's PHP-Database-GeoJSON. Works with your database of choice - ideally paired with node-mysql, node-postgres, or mongodb. It is a more flexible version of postgeo and mysql2geojson (both deprecated).

Installation
npm install dbgeo
Example Usage
var dbgeo = require('dbgeo')

// Query a database...

dbgeo.parse(data, {
  outputFormat: 'geojson'
}, function(error, result) {
  // This will log a valid GeoJSON FeatureCollection
  console.log(result)  
});

See test/test.js for more examples.

API

.parse(data, options, callback)

data (required)

An array of objects, usually results from a database query.

options (optional)

Configuration object that can contain the following keys:

argumentdescriptionvaluesdefault value
geometryTypeFormat of input geometrywkb, wkt, geojson, llwkb
geometryColumnName of column that contains geometry. If input geometry type is "ll", this is an array in the format ['longitude', 'latitude']Any stringgeom
outputFormatDesired output formatgeojson, topojsongeojson
precisionTrim the coordinate precision of the output to a given number of digits using geojson-precisionAny integernull (will not trim precision)
quantizationValue for quantization process, typically specified as powers of ten, see topojson.quantizeAny integer greater than onenull (no quantization)
callback (required)

A function with two parameters: an error, and a result object.

Examples can be found in test/test.js.

.defaults{}

The default options for .parse(). You can set these before using .parse() if you plan to use the same options continuously.

License

CC0

Keywords

FAQs

Package last updated on 07 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc