I fixed the Natural Earth GeoPKG just by changing the "POLYGON" to
"MULTIPOLYGON" in the GEOPKG_GEOMETRY_COLUMNS table.

QGIS is fine with this, and so is GeoServer (it will convert all the
Polygons to Multipolygon - which is lossless).

Not a great solution, but works fine...

Dave

On Wed, May 13, 2020 at 9:57 AM Jody Garnett <jody.garn...@gmail.com> wrote:

> Andrea I am personally in favour of throwing an exception if the data is
> inconsistent, but I respect that some data is not going to be fixed...
>
> Would a connection parameter work? Or were you thinking a system property
> flag ...
>
> Something like "check_geometry_type": do a pass through the geometry to
> detect this problem and override to MultiPolygon when creating the
> FeatureType.
>
> I considered a flag to force "multi" but that would end up applying to all
> tables even when it is not needed.
> --
> Jody Garnett
>
>
> On Wed, 13 May 2020 at 00:38, Andrea Aime <andrea.a...@geo-solutions.it>
> wrote:
>
>> Goin back to the original mail
>>
>> On Wed, May 13, 2020 at 2:12 AM David Blasby <david.bla...@geocat.net>
>> wrote:
>>
>>>
>>>
>>> Looking at the gpkg_geometry_column tables;
>>> [image: image.png]
>>>
>>> We can see it's marked as "Polygon" (not multipolygon).
>>>
>>> During reading, we get to these lines;
>>>
>>>
>>> https://github.com/geotools/geotools/blob/master/modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCFeatureReader.java#L409
>>> [image: image.png]
>>>
>>> Here, value is a Multipolygon, but the binding is a Polygon.  The
>>> multipolygon is converted to a polygon, leading to the issues above.
>>>
>>
>> This is the however the correct behavior, as consistently expected across
>> all GeoTools.
>>
>>
>>> We could just throw an exception? Dont do the conversion? We could also
>>> (similar to shapefiles) have polygon (and line/point) geopkgs always
>>> represented as the corresponding multi*.  However, that's a bit
>>> aggressive...
>>>
>>
>> See my other mail, I'd add a flag to enable this.
>> I've also asked for confirmation on the GeoPackage list... hasn't shown
>> up in the archives yet, so cannot link it... I'll follow up here with
>> an answer as soon as I get one
>>
>> Cheers
>> Andrea
>>
>> == GeoServer Professional Services from the experts! Visit
>> http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
>> Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
>> (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
>> http://www.geo-solutions.it 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.*
>> _______________________________________________
>> GeoTools-Devel mailing list
>> GeoTools-Devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to