[Geoserver-devel] directories of shapefiles datastores can clash with the gs-flatgeobuf extension

Hello,

Reading the JIRA bugtracker, I was not sure if this could deserve an issue or not, so I prefer mentioning it onto the mailing list instead (at least, to start with). We had an issue with Geoserver (a custom version provided with the geOrchestra project) recently, when this one was configured to use “directories of shapefiles” datastores along with the gs-flatgeobuf extension.

On one of our setups, we were making use of “directory of shapefiles” datastores, and sometimes we weren’t able to visualize the underlying layers from this datastore but the issue was not systematic. Debugging a bit, we noticed that sometimes the datastore was created a a FlatGeobufDatastore object (when it was failing), and sometimes a ShapefileDatastore instead (when working).

Debugging a bit further, we figured out that this call in GS:
https://github.com/geoserver/geoserver/blob/main/src/main/src/main/java/org/vfny/geoserver/util/DataStoreUtils.java#L92 returns an unsorted collection, so sometimes the Shapefile factory will come first, if we were lucky, but the layer will fail if the other datastorefactory appears first.

From our point of view, the issue is that the canProcess() method on the FlatGeoBuf factory will return true in case of a directory, but won’t check if the format is actually about shapefiles (I can’t recall the params object content from my debugging session, but I am pretty sure there was something about shapefiles):
https://github.com/geotools/geotools/blob/main/modules/unsupported/flatgeobuf/src/main/java/org/geotools/data/flatgeobuf/FlatGeobufDataStoreFactory.java#L96

Hope that this could help others encountering the same issue, let us know if this deserves a bug report and/or if we can help fixing it in any ways, we decided to remove the flatgeobuf extension, as the format was actually not needed.

Best regards,

···

Pierre Mauduit

Ingénieur développement

Camptocamp France SAS 18 rue du Lac Saint André Savoie Technolac - Bâtiment Le Dauphin F-73370 Le Bourget du Lac Tel. +33 (0)4 58 48 20 24 Fax +33(0)4 58 48 20 10 www.camptocamp.com

Hi Pierre,
yes I believe this is worth reporting a bug.

On how to solve it, eh, there are multiple avenues:

  • Make sure that GeoServer remembers the factory chosen, and gives it precedence among the stores that can handle the parameter map
  • Have FlatGeoBuf implement a DBTYPE like parameter, which is used as a discriminator for factories, and it’s normally hidden from users… the ShapefileDirectoryFactory is equally at fault for just requiring a directory BTW, but it has been available for so long that changing it would affect too many existing installations.
    Cheers

Andrea

···

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

Hi again,

yes I believe this is worth reporting a bug.

Ok, I will do.

  • Have FlatGeoBuf implement a DBTYPE like parameter, which is used as a discriminator for factories, and it’s normally hidden from users… the ShapefileDirectoryFactory is equally at fault for just requiring a directory BTW, but it has been available for so long that changing it would affect too many existing installations.

is it worth creating an issue on geotools as well, then ?

Regards,

– Pierre

Give we have two possible fixing avenues, I would start with the GeoServer one and let whoever takes care of it to choose an appropriate path

Cheers
Andrea

···

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail