geopackage
v1.0.2
Published
GeoPackage NodeJS binding
Downloads
250
Readme
OGC GeoPackage NodeJS binding
This library was designed to use the same MBTiles SQLite tile structure.
Install
$ npm install --save geopackage
Usage
const GeoPackage = require('geopackage')
const gpkg = new GeoPackage('geopackage.gpkg')
// Read Image Buffer
const image = fs.readFileSync('world.png'))
// Save Image to Tile
gpkg.save([0, 0, 0], image).then(status => {
console.log(status)
})
Features
| Name | Description | | ------------------- | :---------------------------------- | | update | Update Metadata | | save | Save buffer data to individual Tile | | delete | Delete individual Tile | | tables | Build SQL Tables | | findOne | Finds one Tile and returns buffer |
NodeJS Support
Windows, MacOSX, Linux & Electron
- ~4.X~
- ~5.X~
- 6.X
- 7.X (not supported by Electron yet)
API
index
GeoPackage
Parameters
uri
string Path to GeoPacakge
Examples
const gpkg = new GeoPackage('example.gpkg')
//=gpkg
Returns GeoPackage GeoPackage
tables
Build SQL tables
Examples
gpkg.tables()
.then(status => console.log(status))
Returns Promise<boolean> true when SQL tables are built
update
Update Metadata
Parameters
metadata
Metadata Metadata according to MBTiles spec 1.1.0 (optional, default{}
)
Examples
const metadata = {
description: 'Example Description',
maxzoom: 3
}
gpkg.update(metadata)
.then(metadata => console.log(metadata))
Returns Promise<Metadata> Metadata
save
Save buffer data to individual Tile
Parameters
tile
Tile Tile [x, y, z]image
Buffer Tile image
Examples
gpkg.save([x, y, z], buffer)
.then(status => console.log(status))
delete
Delete individual Tile
Parameters
tile
Tile Tile [x, y, z]
Examples
gpkg.delete([x, y, z])
.then(status => console.log(status))
findOne
Finds one Tile and returns Buffer
Parameters
tile
Tile Tile [x, y, z]
Examples
gpkg.findOne([x, y, z])
.then(image => console.log(image))