Description

This module is the entry point to the GeoPackage API, providing static methods for opening and building GeoPackage files.

Details

Methods


<static> open( gppathOrByteArray [, callback ] ) → {Promise}

Description

In Node, open a GeoPackage file at the given path, or in a browser, load an in-memory GeoPackage from the given byte array.

Parameters
Name Type Attributes Description
gppathOrByteArray String | Uint8Array

path to the GeoPackage file or Uint8Array of GeoPackage bytes

callback geopackageCallback <optional>

called with an Error if one occurred and the open GeoPackage object

Returns

promise that resolves with the open module:geoPackage~GeoPackage object or rejects with an Error

Details

<static> create( gppath [, callback ] ) → {Promise}

Description

In Node, create a GeoPackage file at the given file path, or in a browser, create an in-memory GeoPackage.

Parameters
Name Type Attributes Description
gppath String | geopackageCallback

path of the created GeoPackage file; ignored in the browser

callback geopackageCallback <optional>

called with an Error if one occurred and the open module:geoPackage~GeoPackage object

Returns

promise that resolves with the open module:geoPackage~GeoPackage object or rejects with an Error

Details

<static> createStandardWebMercatorTileTable( geopackage, tableName, contentsBoundingBox, contentsSrsId, tileMatrixSetBoundingBox, tileMatrixSetSrsId, minZoom, maxZoom [, tileSize ] ) → {Promise}

Description

Create the tables and rows necessary to store tiles according to the ubiquitous XYZ web/slippy-map tiles scheme. The extent for the contents table row, contentsBoundingBox, is informational only, and need not match the tile matrix set extent, tileMatrixSetBoundingBox, which should be the precise bounding box used to calculate the tile row and column coordinates of all tiles in the tile set. The two SRS ID parameters, contentsSrsId and tileMatrixSetSrsId, must match, however. See module:tiles/matrixset~TileMatrixSet for more information about how GeoPackage consumers use the bouding boxes for a tile set.

Parameters
Name Type Attributes Description
geopackage module:geoPackage~GeoPackage

the GeoPackage that will store the tiles

tableName string

the name of the table that will store the tiles

contentsBoundingBox BoundingBox

the bounds stored in the gpkg_contents table row for the tile matrix set

contentsSrsId SRSRef

the ID of a spatial reference system; must match tileMatrixSetSrsId

tileMatrixSetBoundingBox BoundingBox

the bounds stored in the gpkg_tile_matrix_set table row

tileMatrixSetSrsId SRSRef

the ID of a spatial reference system for the tile matrix set table; must match contentsSrsId

minZoom number

the zoom level of the lowest resolution tile matrix in the tile matrix set

maxZoom number

the zoom level of the highest resolution tile matrix in the tile matrix set

tileSize number <optional>

the width and height in pixels of the tile images; defaults to 256

Returns

a Promise that resolves with the created module:tiles/matrixset~TileMatrixSet object, or rejects with an Error

Details

make `tileMatrixSetSrsId` optional because it always has to be the same anyway


<static> createFeatureTableWithProperties( geopackage, properties ) → {Promise}

Description

Create a feature table with the properties specified.

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

the geopackage object

properties Array.<Object>

properties to create columns from

Name Type Description
name string

name of the column

dataType string

name of the data type

Returns
Details

<static> createAttributeTableWithProperties( geopackage, properties ) → {Promise}

Description

Create a feature table with the properties specified.

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

the geopackage object

properties Array.<Object>

properties to create columns from

Name Type Description
name string

name of the column

dataType string

name of the data type

Returns
Details

<static> createSimpleAttributesTableWithProperties( geopackage, properties ) → {Promise}

Description

Create a simple attributes table with the properties specified.

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

the geopackage object

properties Array.<Object>

properties to create columns from

Name Type Description
name string

name of the column

dataType string

name of the data type

Returns
Details

<static> createMediaTableWithProperties( geopackage, properties ) → {Promise}

Description

Create a media table with the properties specified. These properties are added to the required columns

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

the geopackage object

properties Array.<Object>

properties to create columns from

Name Type Description
name string

name of the column

dataType string

name of the data type

Returns
Details

<static> addGeoJSONFeatureToGeoPackage( geopackage, feature, tableName )

Description

Adds a GeoJSON feature to the GeoPackage

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

feature object

GeoJSON feature to add

tableName String

name of the table that will store the feature

Details

<static> addGeoJSONFeatureToGeoPackageAndIndex( geopackage, feature, tableName )

Description

Adds a GeoJSON feature to the GeoPackage and updates the FeatureTableIndex extension if it exists

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

feature object

GeoJSON feature to add

tableName String

name of the table that will store the feature

Details

<static> queryForGeoJSONFeaturesInTableFromPath( geoPackagePath, tableName, boundingBox, callback )

Description

Queries for GeoJSON features in a feature tables

Parameters
Name Type Description
geoPackagePath String

path to the GeoPackage file

tableName String

Table name to query

boundingBox BoundingBox

BoundingBox to query

callback function

Caled with err, featureArray

Details

<static> queryForGeoJSONFeaturesInTable( geoPackage, tableName, boundingBox, callback )

Description

Queries for GeoJSON features in a feature tables

Parameters
Name Type Description
geoPackage module:geoPackage~GeoPackage

open GeoPackage object

tableName String

Table name to query

boundingBox BoundingBox

BoundingBox to query

callback function

Caled with err, featureArray

Details

<static> iterateGeoJSONFeaturesInTableWithinBoundingBox( geoPackage, tableName, boundingBox, rowCallback, doneCallback )

Description

Iterates GeoJSON features in a feature table that matches the bounding box

Parameters
Name Type Description
geoPackage module:geoPackage~GeoPackage

open GeoPackage object

tableName String

Table name to query

boundingBox BoundingBox

BoundingBox to query

rowCallback function

Caled with err, and GeoJSON feature

doneCallback function

Caled with err if one occurred

Details

<static> iterateGeoJSONFeaturesFromPathInTableWithinBoundingBox( geoPackagePath, tableName, boundingBox, rowCallback, doneCallback )

Description

Iterates GeoJSON features in a feature table that matches the bounding box

Parameters
Name Type Description
geoPackagePath String

path to the GeoPackage file

tableName String

Table name to query

boundingBox BoundingBox

BoundingBox to query

rowCallback function

Caled with err, and GeoJSON feature

doneCallback function

Caled with err if one occurred

Details

<static> iterateGeoJSONFeaturesFromTable( geopackage, table ) → {Iterator.<module:user/feature/featureRow~FeatureRow>}

Description

Iterate GeoJSON features from table

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

Table name to Iterate

Returns
Details

<static> getFeature( geopackage, table, featureId, callback )

Description

Gets a GeoJSON feature from the table by id

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the table to get the feature from

featureId Number

ID of the feature

callback function

called with an error if one occurred and the GeoJSON feature

Details

<static> getTileFromTable( geopackage, table, zoom, tileRow, tileColumn )

Description

Gets a tile from the specified table

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the table to get the tile from

zoom Number

zoom level of the tile

tileRow Number

row of the tile

tileColumn Number

column of the tile

Details

jsdoc return value


<static> getTilesInBoundingBox( geopackage, table, zoom, west, east, south, north, callback )

Description

Gets the tiles in the EPSG:4326 bounding box

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the tile table

zoom Number

Zoom of the tiles to query for

west Number

EPSG:4326 western boundary

east Number

EPSG:4326 eastern boundary

south Number

EPSG:4326 southern boundary

north Number

EPSG:4326 northern boundary

callback function

called with an error if one occurred and a tiles object describing the tiles

Details

<static> getTilesInBoundingBoxWebZoom( geopackage, table, zoom, west, east, south, north, callback )

Description

Gets the tiles in the EPSG:4326 bounding box

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the tile table

zoom Number

Zoom of the tiles to query for

west Number

EPSG:4326 western boundary

east Number

EPSG:4326 eastern boundary

south Number

EPSG:4326 southern boundary

north Number

EPSG:4326 northern boundary

callback function

called with an error if one occurred and a tiles object describing the tiles

Details

<static> getGeoJSONFeaturesInTile( geopackage, table, west, east, south, north )

Description

Gets the features in the EPSG:4326 bounding box

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the feature table

west Number

EPSG:4326 western boundary

east Number

EPSG:4326 eastern boundary

south Number

EPSG:4326 southern boundary

north Number

EPSG:4326 northern boundary

Details

<static> getVectorTile( geopackage, table, x, y, z ) → {VectorTile}

Description

Gets a mapbox VectorTile for the x y z web mercator tile specified

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

table name

x Number

x tile

y Number

y tile

z Number

web zoom

Returns
Details

<static> getVectorTileProtobuf( geopackage, table, x, y, z ) → {Protobuf}

Description

Gets a protobuf for the x y z web mercator tile specified

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

table name

x Number

x tile

y Number

y tile

z Number

web zoom

Returns
Details

<static> getFeaturesInBoundingBox( geopackage, table, west, east, south, north )

Description

Gets the features in the EPSG:4326 bounding box

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the feature table

west Number

EPSG:4326 western boundary

east Number

EPSG:4326 eastern boundary

south Number

EPSG:4326 southern boundary

north Number

EPSG:4326 northern boundary

Details

<static> getTileFromXYZ( geopackage, table, x, y, z, width, height ) → {Promise}

Description

Gets a tile image for an XYZ tile pyramid location

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the table containing the tiles

x Number

x index of the tile

y Number

y index of the tile

z Number

zoom level of the tile

width Number

width of the resulting tile

height Number

height of the resulting tile

Returns
Details

<static> drawXYZTileInCanvas( geopackage, table, x, y, z, width, height, canvas )

Description

Draws an XYZ tile pyramid location into the provided canvas

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the table containing the tiles

x Number

x index of the tile

y Number

y index of the tile

z Number

zoom level of the tile

width Number

width of the resulting tile

height Number

height of the resulting tile

canvas Canvas

canvas element to draw the tile into

Details

<static> draw4326TileInCanvas( geopackage, table, minLat, minLon, maxLat, maxLon, z, width, height, canvas )

Description

Draws a tile specified by the bounds in EPSG:4326 into the canvas

Parameters
Name Type Description
geopackage module:geoPackage~GeoPackage

open GeoPackage object

table String

name of the table containing the tiles

minLat Number

minimum latitude bounds of tile

minLon Number

minimum longitude bounds of tile

maxLat Number

maximum latitude bounds of tile

maxLon Number

maximum longitude bounds of tile

z Number

zoom level of the tile

width Number

width of the resulting tile

height Number

height of the resulting tile

canvas Canvas

canvas element to draw the tile into

Details