When using a SimpleFeatureStore from a DataStore created by the GeoPkgDataStoreFactory, Z-coordinates are not written to the GeoPackage.
results in a GeoPackage with 2D coordinates.
As far as I have been able to trace it, the reason is that GeoPkgDialect#postCreateTable(...) creates a new FeatureEntry with no way to .setZ(true).
Other SqlDialect implementations seem to expect/respect a Hints.COORDINATE_DIMENSION on the GeometryDescriptor, e.g.
which, while somewhat obscure, seems to be a consistent and robust way of doing it.
It is, in fact, possible to get the GeoPkgDialect to write Z coordinates by manually creating a FeatureEntry and storing it on the feature type's UserData, but this seems more like a quirk than an intended feature, and feels rather brittle.
It seems like it would be fairly easy to let the GeoPkgDialect be configured with the COORDINATE_DIMENSION hint for consistency.
-In an ideal world, the DataStores could be aware of the axes of the CRS, but that is probably non-trivial, and we'd likely need the hint option still.