2

I am using GeoServer 2.18.0 along with PostgreSQL database.

My most of the data is coming from the database. Certain table name starts with special character like "%", few table names contains "&" in between as layer name.

Services using database tables : WMS, WFS & CSW

Is there any layer naming convention document available for GeoServer? So that I will follow best practices.

Found following :

http://osgeo-org.1560.x6.nabble.com/Re-Geoserver-devel-wms-getCapabilities-special-characters-td5160099.html

https://docs.geoserver.org/latest/en/api/#1.0.0/layers.yaml

Styling WMS layers in GeoServer with fields using "%" character

2
  • 1
    Some OGC standards are strict with allowed names, some accept almost anything. Names that start with an ASCII letter and contain only ASCII letters, numbers, and underscores are very safe. Having & in a layer name may work but is certainly a risk. Url encoding may easily fail with something like ...&LAYER=foo&bar&STYLES=....
    – user30184
    Commented Apr 1, 2021 at 12:52
  • I am not sure about period (.) in layer name because the latest ogc features api versions are throwing errors on that. Is this by design or is this a bug? Example: Name any layer with dot, and try accessing through: http://localhost/geoserver/ogc/features/test.period Observe the error - notice everything after period is missing {"code":"InvalidParameterValue","description":"Unknown collection test"} However using slash at the end does seem to work http://localhost/geoserver/ogc/features/test.period/ Commented Jan 26, 2023 at 11:32

1 Answer 1

4

As this link says your layer name must be capable of being expressed as an XML QName. So a WFS typeName must start with either a letter or underscore (_) and may contain only letters, digits, underscores (_), hyphens (-), and periods (.). A WFS typeName which begins with a number is invalid, as well as names with colons in any place in the body of the name because colon is reserved for the namespace in the xsd:QName

So I would avoid % and & if you want to be able to use your layer in a WFS. Though to be honest I'm surprised that PostGIS is happy with them in table names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.