Skip to content

jericks/GeoPackageServer

Repository files navigation

Github Action

GeoPackage Server

Serve your GeoPackage database on the web.

Build

./gradlew build

Run tests

./gradlew test

Run end to end tests

./gradlew -Dwebdriver.chrome.driver=/Your/Path/To/chromedriver e2e

Run

java -jar geopackageserver-0.3.0.jar --file=data.gpkg --readOnly=true

or if you are building the project:

java -jar build/libs/geopackageserver-0.3.0.jar --file=data.gpkg --readOnly=true

and browse to http://localhost:8080:

Home Page

alt tag

Tile Page

alt tag

Layer Page

alt tag

Tile Examples

Get a List of Tile Layers

curl http://localhost:8080/tiles

Inspect Tile Layer Metadata

curl http://localhost:8080/tiles/world/pyramid
http://localhost:8080/tiles/world/tile/counts

Create QGIS/GDAL Layer File for Tile Layer

curl -o layer.xml http://localhost:8080/tiles/world/gdal && qgis layer.xml

alt tag

Download Tiles

curl -o tile_0_0_0.png http://localhost:8080/tiles/world/tile/0/0/0
curl -o tile_1_0_0.png http://localhost:8080/tiles/world/tile/1/0/0

Download Raster

curl -o us.png http://localhost:8080/tiles/world/raster/400/400/-156.533203,3.688855,-50.712891,56.800878

Create a new Tile Layer

curl -H "Content-Type: application/json" -X POST -d 'Mercator' http://localhost:8080/tiles/world_light

Delete a Tile Layer

curl -X DELETE http://localhost:8080/tiles/world_light

Add/Update a Tile

curl -F "file=@tile.png" http://localhost:8080/tiles/world/tile/5/0/0
curl -o tile_5_0_0.png http://localhost:8080/tiles/world/tile/5/0/0

Delete a Tile

curl -X DELETE http://localhost:8080/tiles/world/tile/5/0/0

Layer Examples

Get a List of Layers

curl http://localhost:8080/layers

Inspect Layer Metadata

curl http://localhost:8080/layers/countries/schema
curl http://localhost:8080/layers/countries/count
curl http://localhost:8080/layers/countries/bounds

View Features

curl http://localhost:8080/layers/countries/features.json
curl -o countries.csv http://localhost:8080/layers/countries/features.csv

View Feature Vector Tiles

curl http://localhost:8080/layers/countries/tile/json/3/2/1
curl http://localhost:8080/layers/countries//tile/pbf/2/1/1

Create a new Layer

curl -H "Content-Type: application/json" -X POST -d '{"name":"random","projection": "EPSG:4326","geometry": "geom","fields":[{"name":"geom","type":"Point","projection":"EPSG:4326"},{"name":"pid","type":"int"}]}' http://localhost:8080/layers/random

Delete a Layer

curl -X DELETE http://localhost:8080/layers/random

Update a Layer

curl -X PUT -d field=pid -d value=1 -d cql=ALL http://localhost:8080/layers/random

Add a Feature

curl -H "Content-Type: application/json" -X POST -d '{"type":"Feature","geometry":{"type":"Point","coordinates":[1,2]},"properties":{"pid":1}}' http://localhost:8080/layers/random/feature
curl -H "Content-Type: application/json" -X POST -d '{"type":"Feature","geometry":{"type":"Point","coordinates":[2,3]},"properties":{"pid":2}}' http://localhost:8080/layers/random/feature
curl -H "Content-Type: application/json" -X POST -d '{"type":"Feature","geometry":{"type":"Point","coordinates":[3,4]},"properties":{"pid":3}}' http://localhost:8080/layers/random/feature
curl -H "Content-Type: application/json" -X POST -d '{"type":"Feature","geometry":{"type":"Point","coordinates":[5,6]},"properties":{"pid":4}}' http://localhost:8080/layers/random/feature
curl -H "Content-Type: application/json" -X POST -d '{"type":"Feature","geometry":{"type":"Point","coordinates":[7,8]},"properties":{"pid":5}}' http://localhost:8080/layers/random/feature

Delete a Feature

curl -X DELETE http://localhost:8080/layers/random/feature/random.1

Delete Features

curl -X DELETE http://localhost:8080/layers/random/feature?cql=pid%3E2

Create QGIS/GDAL Layer File for Vector Layer

curl -o layer.xml http://localhost:8080/layers/countries/gdal && qgis layer.xml

alt tag

List all styles

curl http://localhost:8080/style

List all styles for a layer

curl http://localhost:8080/style/countries

Get a style

curl http://localhost:8080/style/countries/countries

Add a style

curl -F "file=@countries.sld" http://localhost:8080/style/countries/countries

Remove a style

curl -X DELETE http://localhost:8080/style/countries/countries