geopackage
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

OGC GeoPackage NodeJS binding

Build Status npm version MIT licensed Coverage Status

Standard - JavaScript Style Guide

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 {})
    • metadata.description string Description
    • metadata.maxzoom number Maximum zoom level

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))

Returns Promise<boolean>

delete

Delete individual Tile

Parameters

  • tile Tile Tile [x, y, z]

Examples

gpkg.delete([x, y, z])
  .then(status => console.log(status))

Returns Promise<boolean>

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))

Returns Promise<(Buffer | undefined)> Tile Data

Readme

Keywords

Package Sidebar

Install

npm i geopackage

Weekly Downloads

69

Version

1.0.2

License

MIT

Last publish

Collaborators

  • deniscarriere