I'm trying to find information on how best to write metadata into a multilayer GeoPackage so that it can be read into a GeoServer instance.
My chain of treatment would be to:
- Modify layers in an existing GeoPackage using Python with the metadata fields of interest in a GDAL-supported standard.
- Upload this GeoPackage to my GeoServer.
- Serve these layers via a WFS that publishes the existing metadata alongside the layer, accessible via Python, R, etc.
From what I can see, the fields that are potentially supported are those visible in GeoServer Metadata plugin (https://docs.geoserver.org/latest/en/user/community/metadata/user.html) are topic-category
, data-date
, data-language
, and probably more.
As an example, using a development build of Fiona, I can make an empty GeoPackage and write metadata at the layer level:
my_gpkg = Path("~/Desktop/example.gpkg").expanduser()
layers = {
"polygon_example": {
"properties": OrderedDict(
[("text_field", "str"), ("numeric_values", "int"), ("true_false", "int")]
),
"geometry": "Polygon",
},
"line_example": {
"properties": OrderedDict(
[("text_field", "str"), ("numeric_values", "int"), ("true_false", "int")]
),
"geometry": "MultiLineString",
},
}
crs = CRS.from_epsg(4326).to_dict()
for layer_name, schema in layers.items():
with fiona.open(
my_gpkg, "w", driver="GPKG", layer=layer_name, schema=schema, crs=crs
) as gpkg_layer:
tags = {"organization": "GeoPackage Researchers inc.", "description": "My cool dataset"}
gpkg_layer.update_tags(tags)
Reading it out from ogrinfo
, I can see that everything appears to have worked:
(base) ~/Desktop >>> ogrinfo example_new.gpkg polygon_example -mdd default
INFO: Open of `example_new.gpkg'
using driver `GPKG' successful.
Layer name: polygon_example
Metadata:
description=My cool dataset
organization=GeoPackage Researchers inc.
Geometry: Polygon
Feature Count: 0
Layer SRS WKT:
...
Before I continue with this work, I want to know
- What are the metadata fields that are natively supported in GeoServer (if there are specific/conventional fields)? And,
- How can I ensure that they can be read from data streams using OGC standards (WMS/WFS/etc.)?
Best Answer
The GeoServer GeoPKG reader does not support any metadata, in any form, nor there is a way to make general metadata available in data sources available from OGC protocols. The CSW plugin can read from the layer configuration, but not from its data.
There is some limited support for exposing meta-information in the store, which could be read from the GUI while configuring the layer, but it's limited to title, description and keywords. It's a one off copy from the data source to the configuration, then they live a separate life. That said, some development should be done in gt-geopkg to expose them in a suitable way.