Hi Jody,

Thank you for the reply. I ran some queries and while I did find some
invalid geometries, after correcting them I have found that the issue is
with empty geometries (MULTIPOLYGON EMPTY or MULTIPOLYGON(EMPTY) in this
table) which I believe should be valid. I also ran into a similar issue on
another table with 4-dimensional geometries (MULTILINESTRING ZM) which
should also be valid according to PostGIS.

The error output in the 4-dimensional geometry case is:

java.lang.IllegalArgumentException: Invalid output dimension (must be 2 or
3)
at org.geotools.geometry.jts.WKTWriter2.<init>(WKTWriter2.java:158)
at
org.geotools.data.postgis.PostGISDialect.encodeGeometryValue(PostGISDialect.java:1329)
at org.geotools.jdbc.JDBCDataStore.insertSQL(JDBCDataStore.java:4397)
at org.geotools.jdbc.JDBCDataStore.insertNonPS(JDBCDataStore.java:2030)
at org.geotools.jdbc.JDBCDataStore.insert(JDBCDataStore.java:1852)
at
org.geotools.jdbc.JDBCInsertFeatureWriter.flush(JDBCInsertFeatureWriter.java:130)
at
org.geotools.jdbc.JDBCInsertFeatureWriter.write(JDBCInsertFeatureWriter.java:102)
at
org.geotools.data.InProcessLockingManager$1.write(InProcessLockingManager.java:302)
at
org.geotools.data.store.ContentFeatureStore.addFeature(ContentFeatureStore.java:295)
at
org.geotools.data.store.ContentFeatureStore.addFeatures(ContentFeatureStore.java:250)
at org.geoserver.importer.Importer.copyFromFeatureSource(Importer.java:1716)
at org.geoserver.importer.Importer.loadIntoDataStore(Importer.java:1469)
at org.geoserver.importer.Importer.doIndirectImport(Importer.java:1209)
at org.geoserver.importer.Importer.run(Importer.java:1015)
at org.geoserver.importer.Importer.runInternal(Importer.java:975)
at org.geoserver.importer.Importer$3.callInternal(Importer.java:1055)
at org.geoserver.importer.Importer$3.callInternal(Importer.java:1047)
at
org.geoserver.importer.Importer$SecurityContextCopyingJob.call(Importer.java:1091)
at org.geoserver.importer.job.Job.call(Job.java:16)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

On Tue, Jun 7, 2022 at 3:09 AM Jody Garnett <jody.garn...@gmail.com> wrote:

> Can you run a few queries to confirm tha the data (in the tables that is
> having a problem) is valid? It really looks like an invalid geometry is
> tripping you up.
>
> The stack trace shows it trying to read linear ring, and being directed to
> read past the end of the available coordinates. So check for any polygons
> that only have two points (for example).
>
> Jody
>
> On Mon, Jun 6, 2022 at 4:18 PM Jonathan D <jonathanr...@gmail.com> wrote:
>
>> Hello,
>>
>> I am trying to use the Geoserver Importer extension to mass import all
>> the tables I have in a PostGIS database into separate layers, and am
>> running into an error on certain layers. I am using gdal/ogr2ogr to convert
>> and import an Esri GDB file into a PostGIS database (using ogr2ogr's
>> convert_to_linear and promote_to_multi options), and then are using the
>> Geoserver Importer extension to import from that PostGIS database. The
>> error I am getting on several layers is:
>>
>> java.lang.RuntimeException: org.geotools.data.DataSourceException: An
>> exception occurred while parsing WKB data
>> at
>> org.geotools.jdbc.JDBCFeatureReader.readNextFeature(JDBCFeatureReader.java:389)
>> at org.geotools.jdbc.JDBCFeatureReader.hasNext(JDBCFeatureReader.java:332)
>> at
>> org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.hasNext(ContentFeatureCollection.java:145)
>> at
>> org.geotools.feature.collection.DecoratingFeatureIterator.hasNext(DecoratingFeatureIterator.java:42)
>> at
>> org.geoserver.importer.ImportTransformFeatureCollection$CancelableFeatureIterator.hasNext(ImportTransformFeatureCollection.java:163)
>> at
>> org.geotools.feature.collection.DecoratingFeatureIterator.hasNext(DecoratingFeatureIterator.java:42)
>> at
>> org.geotools.data.store.ContentFeatureStore.addFeatures(ContentFeatureStore.java:248)
>> at
>> org.geoserver.importer.Importer.copyFromFeatureSource(Importer.java:1716)
>> at org.geoserver.importer.Importer.loadIntoDataStore(Importer.java:1469)
>> at org.geoserver.importer.Importer.doIndirectImport(Importer.java:1209)
>> at org.geoserver.importer.Importer.run(Importer.java:1015)
>> at org.geoserver.importer.Importer.runInternal(Importer.java:975)
>> at org.geoserver.importer.Importer$3.callInternal(Importer.java:1055)
>> at org.geoserver.importer.Importer$3.callInternal(Importer.java:1047)
>> at
>> org.geoserver.importer.Importer$SecurityContextCopyingJob.call(Importer.java:1091)
>> at org.geoserver.importer.job.Job.call(Job.java:16)
>> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>> at
>> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>> at
>> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>> at java.base/java.lang.Thread.run(Thread.java:829)
>> Caused by: org.geotools.data.DataSourceException: An exception occurred
>> while parsing WKB data
>> at
>> org.geotools.data.postgis.WKBAttributeIO.wkb2Geometry(WKBAttributeIO.java:88)
>> at org.geotools.data.postgis.WKBAttributeIO.read(WKBAttributeIO.java:116)
>> at
>> org.geotools.data.postgis.PostGISDialect.decodeGeometryValue(PostGISDialect.java:350)
>> at
>> org.geotools.data.postgis.PostGISPSDialect.decodeGeometryValue(PostGISPSDialect.java:83)
>> at
>> org.geotools.jdbc.JDBCFeatureReader.readNextFeature(JDBCFeatureReader.java:381)
>> ... 19 more
>> Caused by: org.locationtech.jts.io.ParseException: Attempt to read past
>> end of input
>> at
>> org.locationtech.jts.io.ByteOrderDataInStream.read(ByteOrderDataInStream.java:142)
>> at
>> org.locationtech.jts.io.ByteOrderDataInStream.readInt(ByteOrderDataInStream.java:107)
>> at org.geotools.geometry.jts.WKBReader.readLinearRing(WKBReader.java:292)
>> at org.geotools.geometry.jts.WKBReader.readPolygon(WKBReader.java:302)
>> at org.geotools.geometry.jts.WKBReader.readGeometry(WKBReader.java:219)
>> at org.geotools.geometry.jts.WKBReader.readGeometry(WKBReader.java:204)
>> at
>> org.geotools.geometry.jts.WKBReader.readMultiPolygon(WKBReader.java:383)
>> at org.geotools.geometry.jts.WKBReader.readGeometry(WKBReader.java:230)
>> at org.geotools.geometry.jts.WKBReader.readGeometry(WKBReader.java:204)
>> at org.geotools.geometry.jts.WKBReader.read(WKBReader.java:170)
>> at
>> org.geotools.data.postgis.WKBAttributeIO.wkb2Geometry(WKBAttributeIO.java:86)
>> ... 23 more
>> _______________________________________________
>> Geoserver-users mailing list
>>
>> Please make sure you read the following two resources before posting to
>> this list:
>> - Earning your support instead of buying it, but Ian Turton:
>> http://www.ianturton.com/talks/foss4g.html#/
>> - The GeoServer user list posting guidelines:
>> http://geoserver.org/comm/userlist-guidelines.html
>>
>> If you want to request a feature or an improvement, also see this:
>> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>>
>>
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
> --
> --
> Jody Garnett
>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to