0.0.26 • Published 3 years ago

geotabuladb v0.0.26

Weekly downloads
3
License
BSD-2-Clause
Repository
github
Last release
3 years ago

Welcome to the geotabuladb!

GeoTabulaDB is a library to get geojson files from queries to different geodatabases. Currently, geotabuladb supports MySQL and PostgreSQL. The resulting geojson can have only geometry or geometry plus all properties or a subset of properties from the database.

Usage
Create a folder to hold the project and initialize it.

$ mkdir my_project
$ cd my_proyect
$ npm init

Install the library from npm

$ npm install geotabuladb

Example

var geo = require('geotabuladb');
geo.setCredentials({
    type: 'mysql',
    host: 'localhost',
    user: 'USER',
    password: 'PASSWORD',
    database: 'DATABASE_NAME'
});
geo.connectToDb();
geo.geoQuery({
	geometry : 'COLUMN_WITH_GEOMETRY',
	tableName : 'TABLE_NAME',
	properties : 'all'
}, function(json) {
	console.log(json);
});

Credentials
To create a connection, first a user must set the credentials. The method setCredentials() receives as parameter an object with the following keys:

  • type: type of database. ('mysql', postgis')
  • host: address of the host
  • user: user
  • password: password for the user
  • database: database name

Queries
There are two types of queries:

GeoQuery

The method geoQuery(queryParams, callback) receives an object and a callback function:

  • queryParams tableName: name of the table inside the database geometry: name of the column that has the geometry * properties: the properties that will be added to the geojson ('none', 'all', array). If an array is provided, the geojson will have only the properties set inside the array
  • callback: function to be called when the query returns

Query

The method query(queryParams, callback) receives an object and a callback function:

  • queryParams tableName: name of the table inside the database where: limit: How many rows are going to be retrieved properties: How are the properties going to be created ('all', array with properties' names)
0.0.26

3 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago