In GeoServer 2.15.2 I can "publish" an entire layer from a GeoPackage. No issues there, works great.

However, If I attempt to "Configure a new SQL view..." using that same layer in the GeoPackage (or any layer from any GeoPackage), GeoServer fails to recognize "geom" as the geometry column. In the "Edit SQL view" screen, the "type" for "geom" is listed as "BigDecimal".

What I would like to do via the "SQL View" is to publish a layer from a GeoPackage and use a SQL query to scope the results (cannot do this if I just publish the entire GeoPackage layer).

Note: As I mentioned, GeoServer does indeed recognize "geom" when you "publish" the entire GeoPackage layer . . . it can successfully identify the geometry type and SRID. This fails when trying to "Configure a new SQL view...".

Update: GeoServer does not prevent me from creating/saving a SQL View layer using a GeoPackage as the "Store". However, it is useless because the geometry type and SRID are unknown (and the Bounding Boxes are populated with invalid data). However, if I manually edit the "featuretype.xml" file for the layer and populate it with the correct values, I can at least view it via "Layer Preview".

New contributor
Bruce Loth is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Can you share more info, like the structure of the original table, the SQL view you're setting up, and the full stack trace of the output? – Andrea Aime Aug 14 at 19:36
  • There is no stack trace and issue occurs if there is one column (attribute) or 100 in the table (layer). I am creating the GeoPackage file and the layers in it using QGIS 3.4.9. GeoServer 2.15.2 correctly identifies the geometry column ("geom") and geometry type when publishing an entire layer. However, if I "Create new SQL view" instead and select "Guess geometry type and srid" and click "refresh", GeoServer lists the "type" for "geom" as "BigDecimal" (the correct value should be "Polygon", "Point", etc). – Bruce Loth Aug 14 at 21:02
  • Also should note that "SQL Views" work fine in this version of GeoServer when using a different "Store" such as Oracle. Fails when the "Store" is a GeoPackage. – Bruce Loth Aug 14 at 21:09

Your Answer

Bruce Loth is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.