[gdal-dev] Fwd: Gdal - multipolygon - geometry errors instead holes

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Tue Oct 29 03:31:10 PDT 2019


Hi,

Your case is a bit hard to analyze with end users tools, probably low level
study about how the shapefile driver or GEOS works is needed.

The problematic geometry is a rather big multipolygon and it can be found
with ogrinfo 

ogrinfo -dialect sqlite -sql "select *, ST_IsValidReason(geometry) from
original where st_isvalid(geometry)=0" original.shp

The geometry is the Nested Shells case.

I opened the same shapefile with OpenJUMP and it shows that certain
multipolygon part with a hole. The QA tool, that is based on JTS does not
show topology errors. I saved the layer into a) shapefile and b) into JUMP
jml format with OpenJUMP and repeated the test with ogrinfo and
IsValidReason. The shapefile seems to contain an invalid geometry while jml
file not.

It seems that the shapefile driver has some issue with reading that
geometry. OpenJUMP considers that the geometry is OK both when reading and
writing.

I deleted manually parts from the multipolygon by utilizing the Select Parts
tool of OpenJUMP and managed to shrink the error into this shapefile
http://latuviitta.org/downloads/just_error.zip that contains only this one
geometry

MULTIPOLYGON ((( -504655.0000000044 -1116885.8500000022, -504655.0000000044
-1116887.8499999985, -504653.0000000006 -1116887.8499999985,
-504653.0000000006 -1116889.8500000024, -504651.0000000043
-1116889.8500000024, -504651.0000000043 -1116891.8499999987,
-504641.00000000035 -1116891.8499999987, -504641.00000000035
-1116893.8500000024, -504637.00000000023 -1116893.8500000024,
-504637.00000000023 -1116895.8499999987, -504635.00000000396
-1116895.8499999987, -504635.00000000396 -1116897.8500000024,
-504633.0000000002 -1116897.8500000024, -504633.0000000002
-1116899.8499999987, -504629.00000000006 -1116899.8499999987,
-504629.00000000006 -1116901.8500000027, -504625 -1116901.8500000027,
-504625 -1116903.849999999, -504623.00000000367 -1116903.849999999,
-504623.00000000367 -1116905.8500000027, -504616.99999999977
-1116905.8500000027, -504616.99999999977 -1116907.849999999,
-504615.0000000035 -1116907.849999999, -504615.0000000035
-1116909.8500000027, -504611.0000000034 -1116909.8500000027,
-504611.0000000034 -1116911.8499999992, -504609.0000000071
-1116911.8499999992, -504609.0000000071 -1116913.850000003,
-504607.0000000033 -1116913.850000003, -504607.0000000033
-1116915.8499999992, -504605.000000007 -1116915.8499999992,
-504605.000000007 -1116917.850000003, -504607.0000000033 -1116917.850000003,
-504607.0000000033 -1116925.8500000031, -504609.0000000071
-1116925.8500000031, -504609.0000000071 -1116927.8499999994,
-504613.0000000072 -1116927.8499999994, -504613.0000000072
-1116929.8500000031, -504616.99999999977 -1116929.8500000031,
-504616.99999999977 -1116931.8499999996, -504620.9999999999
-1116931.8499999996, -504620.9999999999 -1116933.8500000034, -504625
-1116933.8500000034, -504625 -1116935.8499999996, -504629.00000000006
-1116935.8499999996, -504629.00000000006 -1116937.8500000034,
-504633.0000000002 -1116937.8500000034, -504633.0000000002
-1116939.8499999996, -504637.00000000023 -1116939.8499999996,
-504637.00000000023 -1116941.8500000036, -504641.00000000035
-1116941.8500000036, -504641.00000000035 -1116943.8499999999,
-504645.0000000004 -1116943.8499999999, -504645.0000000004
-1116945.8500000036, -504649.0000000005 -1116945.8500000036,
-504649.0000000005 -1116947.8499999999, -504653.0000000006
-1116947.8499999999, -504653.0000000006 -1116949.8500000036,
-504657.0000000007 -1116949.8500000036, -504657.0000000007
-1116951.8499999999, -504661.0000000008 -1116951.8499999999,
-504661.0000000008 -1116953.8500000038, -504665.0000000009
-1116953.8500000038, -504665.0000000009 -1116955.85, -504667.00000000466
-1116955.85, -504667.00000000466 -1116953.8500000038, -504671.0000000048
-1116953.8500000038, -504671.0000000048 -1116955.85, -504675.00000000483
-1116955.85, -504675.00000000483 -1116957.8500000038, -504679.00000000495
-1116957.8500000038, -504679.00000000495 -1116959.85, -504685.00000000134
-1116959.85, -504685.00000000134 -1116951.8499999999, -504687.0000000051
-1116951.8499999999, -504687.0000000051 -1116939.8499999996,
-504689.0000000014 -1116939.8499999996, -504689.0000000014
-1116931.8499999996, -504691.0000000052 -1116931.8499999996,
-504691.0000000052 -1116923.8499999994, -504697.00000000163
-1116923.8499999994, -504697.00000000163 -1116921.8500000031,
-504695.0000000053 -1116921.8500000031, -504695.0000000053
-1116919.8499999992, -504693.0000000015 -1116919.8499999992,
-504693.0000000015 -1116913.850000003, -504691.0000000052
-1116913.850000003, -504691.0000000052 -1116911.8499999992,
-504689.0000000014 -1116911.8499999992, -504689.0000000014
-1116909.8500000027, -504687.0000000051 -1116909.8500000027,
-504687.0000000051 -1116905.8500000027, -504685.00000000134
-1116905.8500000027, -504685.00000000134 -1116903.849999999,
-504681.0000000012 -1116903.849999999, -504681.0000000012
-1116901.8500000027, -504679.00000000495 -1116901.8500000027,
-504679.00000000495 -1116899.8499999987, -504677.00000000116
-1116899.8499999987, -504677.00000000116 -1116897.8500000024,
-504675.00000000483 -1116897.8500000024, -504675.00000000483
-1116895.8499999987, -504673.00000000105 -1116895.8499999987,
-504673.00000000105 -1116893.8500000024, -504671.0000000048
-1116893.8500000024, -504671.0000000048 -1116891.8499999987,
-504667.00000000466 -1116891.8499999987, -504667.00000000466
-1116889.8500000024, -504665.0000000009 -1116889.8500000024,
-504665.0000000009 -1116887.8499999985, -504663.0000000046
-1116887.8499999985, -504663.0000000046 -1116885.8500000022,
-504655.0000000044 -1116885.8500000022 )), (( -504639.000000004
-1117208.2426935502, -504644.9999583359 -1117209.850155481,
-504645.0000000004 -1117207.8499999982, -504651.0000000043
-1117207.8499999982, -504651.0000000043 -1117203.8499999982,
-504653.0000000006 -1117203.8499999982, -504653.0000000006
-1117201.850000002, -504657.0000000007 -1117201.850000002,
-504657.0000000007 -1117203.8499999982, -504659.0000000045
-1117203.8499999982, -504659.0000000045 -1117201.850000002,
-504665.0000000009 -1117201.850000002, -504665.0000000009
-1117197.8500000017, -504663.0000000046 -1117197.8500000017,
-504663.0000000046 -1117195.849999998, -504661.0000000008
-1117195.849999998, -504661.0000000008 -1117193.8500000017,
-504659.0000000045 -1117193.8500000017, -504659.0000000045
-1117191.849999998, -504657.0000000007 -1117191.849999998,
-504657.0000000007 -1117189.8500000015, -504655.0000000044
-1117189.8500000015, -504655.0000000044 -1117185.8500000015,
-504657.0000000007 -1117185.8500000015, -504657.0000000007
-1117183.8499999978, -504655.0000000044 -1117183.8499999978,
-504655.0000000044 -1117179.8499999975, -504653.0000000006
-1117179.8499999975, -504653.0000000006 -1117181.8500000015,
-504647.0000000042 -1117181.8500000015, -504647.0000000042
-1117177.8500000013, -504645.0000000004 -1117177.8500000013,
-504645.0000000004 -1117175.8499999975, -504643.00000000413
-1117175.8499999975, -504643.00000000413 -1117177.8500000013,
-504641.00000000035 -1117177.8500000013, -504641.00000000035
-1117179.8499999975, -504637.00000000023 -1117179.8499999975,
-504637.00000000023 -1117183.8499999978, -504635.00000000396
-1117183.8499999978, -504635.00000000396 -1117187.8499999978,
-504631.00000000384 -1117187.8499999978, -504631.00000000384
-1117189.8500000015, -504633.0000000002 -1117189.8500000015,
-504633.0000000002 -1117193.8500000017, -504627.0000000038
-1117193.8500000017, -504627.0000000038 -1117199.849999998,
-504629.00000000006 -1117199.849999998, -504629.00000000006
-1117201.850000002, -504627.0000000038 -1117201.850000002,
-504627.0000000038 -1117203.8499999982, -504631.00000000384
-1117203.8499999982, -504631.00000000384 -1117205.850000002,
-504637.00000000023 -1117205.850000002, -504637.00000000023
-1117207.8499999982, -504639.000000004 -1117207.8499999982,
-504639.000000004 -1117208.2426935502 ), ( -504633.0000000002
-1117201.850000002, -504633.0000000002 -1117199.849999998,
-504635.00000000396 -1117199.849999998, -504635.00000000396
-1117201.850000002, -504633.0000000002 -1117201.850000002 )))


Let's see if the case in now simple enough so that some developer can tell
us why the just_error shapefile is reported to have nested shells.

-Jukka Rahkonen-





Pepa Beneš wrote
> HI,
> 
> I recieved one shapefile. Gdal / Grass / QGIS finds two geometry errors in
> it. Other GIS SW (ArcMap, MapInfo (via Universal translator or opening shp
> natively)) theay can't see this geometries as errors. Instead errors they
> can see regular multipolygons with holes there. Author of this shp wants
> to
> see holes there too = in his opinion there are correct data only.
> 
> Please, write me, how to work with such geometries in gdal / grass / QGIS
> /
> geos world to see holes too, instead errors?
> 
> In geometry_problem.zip
> <https://drive.google.com/file/d/1oRJQVKYDkZji-GLmobov995m9vF00vwf>
> there
> are:
> 
> geometry_problem.qgz .. vizualization in QGIS
> 
> original.shp .. original data prepared in ESRI
> original_esri.png .. original.shp seen in ArcMap (With holes. Author of
> shp
> wants have holes there.)
> 
> original_errors.shp .. geometry errors prepared by "QGIS Desktop 3.8.3
> with
> GRASS 7.6.1"
> original_qgis.png .. original.shp seen in QGIS
> 
> MI/original_to_MI_by_UN.tab .. original.shp translated from shp to tab by
> MapInfo - UniversalTranslator (tried defferent versions with the same
> results).
> 
> Thanks
> Pepa Beneš
> 
> _______________________________________________
> gdal-dev mailing list

> gdal-dev at .osgeo

> https://lists.osgeo.org/mailman/listinfo/gdal-dev





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list