0.0.26 • Published 2 years ago

geotabuladb v0.0.26

Weekly downloads
3
License
BSD-2-Clause
Repository
github
Last release
2 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

2 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago