Skip to content

Commit

Permalink
Merge pull request #36 from PDOK/config
Browse files Browse the repository at this point in the history
Config
  • Loading branch information
arbakker committed Jun 24, 2021
2 parents d9604d7 + 53fe630 commit c0a743b
Show file tree
Hide file tree
Showing 21 changed files with 250 additions and 620 deletions.
43 changes: 13 additions & 30 deletions README.md
Expand Up @@ -37,53 +37,36 @@ docker build -t pdok/goaf:latest .
The geopacakge provider is a minimal config for GeoPackages that tend to be relative small e.g. < 3 GB.

```docker
docker run --rm -v `pwd`/example:/example -e PROVIDER='gpkg' -e PATH_GPKG='/example/addresses.gpkg' -e ENDPOINT='http://localhost:8080' -p 8080:8080 pdok/goaf:latest
docker run --rm -v `pwd`/example:/example -c /example/config-addresses-gpkg-minimal.yaml -p 8080:8080 pdok/goaf:latest
```

## PostGis

More elaborate config optimised performance for huge db (10M+ records/collection)
More elaborate config optimised performance for huge db (10M+ features/collection)

```docker
docker run -v `pwd`/example:/example -e CONNECTION='postgres://{user}:{password}@{host}:{port}/{database}?sslmode=disable' -e PROVIDER='postgis' -e PATH_CONFIG='/example/config_postgis.yaml' -e ENDPOINT='http://localhost:8080' -p 8080:8080 pdok/goaf:latest
docker run -v `pwd`/example:/example -c /example/config-addresses-postgis-localhost.yaml' -p 8080:8080 pdok/goaf:latest
```

example table
### Example table

```sql
CREATE TABLE bgt_wfs3_v1.bak
CREATE TABLE addresses.addresses
(
_id text COLLATE pg_catalog."default" NOT NULL,
_version text COLLATE pg_catalog."default",
fid text COLLATE pg_catalog."default" NOT NULL,
offsetid bigint NOT NULL,
properties jsonb,
_geom geometry,
_bbox geometry,
_offset_id bigint NOT NULL DEFAULT nextval('bgt_wfs3_v1.bak__offset_id_seq'::regclass),
_created timestamp without time zone,
CONSTRAINT bak_pkey PRIMARY KEY (_id)
geom geometry,
bbox geometry,

CONSTRAINT addresses_addresses_pk PRIMARY KEY (fid)
)
WITH (
OIDS = FALSE
)
```

used parameters:

```go
bindHost := flag.String("s", envString("BIND_HOST", "0.0.0.0"), "server internal bind address, default; 0.0.0.0")
bindPort := flag.Int("p", envInt("BIND_PORT",8080), "server internal bind address, default; 8080")

serviceEndpoint := flag.String("endpoint", envString("ENDPOINT","http://localhost:8080"), "server endpoint for proxy reasons, default; http://localhost:8080")
serviceSpecPath := flag.String("spec", envString("SERVICE_SPEC_PATH","spec/oaf.yml"), "swagger openapi spec")
defaultReturnLimit := flag.Int("limit", envInt("LIMIT",100), "limit, default: 100")
maxReturnLimit := flag.Int("limitmax", envInt("LIMIT_MAX",500), "max limit, default: 1000")
providerName := flag.String("provider", envString("PROVIDER",""), "postgis or gpkg")
gpkgFilePath := flag.String("gpkg", envString("PATH_GPKG",""), "geopackage path")
crsMapFilePath := flag.String("crs", envString("PATH_CRS",""), "crs file path")
configFilePath := flag.String("config", envString("PATH_CONFIG",""), "configfile path")
connectionStr := flag.String("connection", envString("CONNECTION", ""), "configfile path")

featureIdKey := flag.String("featureId", envString("FEATURE_ID",""), "Default feature identification or else first column definition (fid)") //optional for gpkg provider
CREATE INDEX addresses_geom_sidx ON addresses.addresses USING GIST (geom);
CREATE INDEX addresses_offsetid_idx ON addresses.addresses(offsetid);
```

## Generate
Expand Down
3 changes: 3 additions & 0 deletions example/config-addresses-gpkg-minimal.yaml
@@ -0,0 +1,3 @@
datasource:
gpkg:
file: example/addresses.gpkg
8 changes: 8 additions & 0 deletions example/config-addresses-gpkg.yaml
@@ -0,0 +1,8 @@
endpoint: http://localhost:8080
openapi: spec/oaf.json
defaultfeaturelimit: 100
maxfeaturelimit: 500
datasource:
gpkg:
file: example/addresses.gpkg
fid: fid
27 changes: 27 additions & 0 deletions example/config-addresses-postgis-localhost.yaml
@@ -0,0 +1,27 @@
endpoint: http://localhost:8080
openapi: spec/oaf.json
defaultfeaturelimit: 100
maxfeaturelimit: 500
datasource:
postgis:
connection: postgres://docker:docker@localhost:5432/oaf?sslmode=disable
collections:
- schemaname: addresses #database schema name
tablename: addresses #database table/view name
identifier: addresses #collection name in api response
# filter: (l."properties"->'eindRegistratie') is null # extra filtering option is added to where clause
description: INSPIRE Alternative Encoding Addresses #Description of the collection
columns:
geometry: geom #column containing the SFS geometry
# geometryType: POINT # has currently no use
fid: fid #the unique indexed identifier for a given feature
offset: offsetid # extra column to determine next keyset paging, should be numeric, indexed and unique, could be equal to feature id
bbox: bbox #extra column with bounding box selection index for intersects query, simplification and speedup
bbox: [4.709923493810017,53.00079137013467,4.897723983538761,53.18212166845569] # Bounding box of all features can be used to display subset of features
srid: 4326 #the projection of the geometry currently stored in database
# Properties are column names which should be exposed in properties part of the response
jsonb: true
properties:
- properties
bbox: [4.709923493810017,53.00079137013467,4.897723983538761,53.18212166845569]
srid: 4326
25 changes: 25 additions & 0 deletions example/config-addresses-postgis.yaml
@@ -0,0 +1,25 @@
endpoint: http://localhost:8080
openapi: spec/oaf.json
defaultfeaturelimit: 100
maxfeaturelimit: 500
datasource:
postgis:
connection: postgres://docker:docker@postgis:5432/oaf?sslmode=disable
collections:
- schemaname: addresses #database schema name
tablename: addresses #database table/view name
identifier: addresses #collection name in api response
# filter: (l."properties"->'eindRegistratie') is null # extra filtering option is added to where clause
description: INSPIRE Alternative Encoding Addresses #Description of the collection
columns:
geometry: geom #column containing the SFS geometry
# geometryType: POINT # has currently no use
fid: fid #the unique indexed identifier for a given feature
offset: offsetid # extra column to determine next keyset paging, should be numeric, indexed and unique, could be equal to feature id
bbox: bbox #extra column with bounding box selection index for intersects query, simplification and speedup
bbox: [4.709923493810017,53.00079137013467,4.897723983538761,53.18212166845569] # Bounding box of all features can be used to display subset of features
srid: 4326 #the projection of the geometry currently stored in database
# Properties are column names which should be exposed in properties part of the response
jsonb: true
properties:
- properties
20 changes: 0 additions & 20 deletions example/config_postgis.yaml

This file was deleted.

0 comments on commit c0a743b

Please sign in to comment.