question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid geometries after export/import

See original GitHub issue

Context

The dataset with all geometries as valid generates, a different number of, invalid geometries when importing it depending on the export format.

Steps to Reproduce

  1. Go to https://team.carto.com/u/saleiva/tables/chicago_census_tracts/public?redirected=true
  2. Export:
  1. Import all of them.
  2. Run the queries:
  • SELECT count(*) FROM chicago_census_tracts_csv where st_isvalidreason(the_geom) != 'Valid Geometry'
  • SELECT count(*) FROM chicago_census_tracts_shp where st_isvalidreason(the_geom) != 'Valid Geometry'
  • SELECT count(*) FROM chicago_census_tracts_gpkg where st_isvalidreason(the_geom) != 'Valid Geometry'

Current Result

Tables count for invalid geometries:

  • chicago_census_tracts_csv: 0
  • chicago_census_tracts_shp: 3
  • chicago_census_tracts_gpkg: 36

Expected result

I would expect to have all geometries as valid, independently of the export format.

Additional info

Using QGIS Geometry Checker Plugin I wasn’t able to detect invalid geometries from step 2 files. However, I was able to detect invalid geometries after exporting again the imported gpkg dataset at step 3.

cc @javisantana

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:53 (51 by maintainers)

github_iconTop GitHub Comments

1reaction
rafatowercommented, Jan 19, 2017

I ran the following regression tests as well:

  • Import a non-trivial .carto file: OK
  • Duplicate a dataset (and add new data to it): OK
  • Create a table from a SQL query: OK
  • Create a sync table: OK
  • Force sync: OK
  • raster import: OK
  • Create a table with ogr2ogr 2.1.2+svn.37167-precise1: OK

Ready for production.

1reaction
jgoizuetacommented, Jan 11, 2017

For the record, here’s a snippet showing how I got to debug our test case:

First, compile GDAL with debug symbols and open the resulting ogr2ogr with gdb:

wget http://download.osgeo.org/gdal/2.1.1/gdal-2.1.1.tar.gz
tar -xzf gdal-2.1.1.tar.gz
cd gdal-2.1.1
./configure --without-ld-shared --disable-shared --enable-static --with-ogdi=no --with-spatialite=yes --enable-debug
make
export GDAL_DATA=$(pwd)/data
gdb apps/ogr2ogr

Now we can set breakpoints as needed and execute the conversion of our test case:

b ogrct.cpp:859
...
r -f PostgreSQL PG:"host=localhost port=5432 user={DBUSER} dbname={DBNAME} password={PASSWORD}"  -t_srs EPSG:4326  pntexp.gpkg  -nln pnt_imp_dbg
...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Invalid Geometries (QGIS3) - QGIS Tutorials and Tips
When working with vector data layers, you may encounter geometry errors. These errors often become part of your data after running ...
Read more >
Invalid Geometry - Slide2 Documentation - Rocscience
When importing geometry into Slide2, you are guided through a validation step. The geometry validation tool identifies 5 categories of possible problems: Near- ......
Read more >
Error exporting data from a feature class to shapefile
It appears as though you have some invalid geometries within your Oracle ... in order to migrate the data or even export /...
Read more >
CAD Data Import and Export Overview
IGES (Modeling: Import/Export > Import > 3D Files > IGES). Versions up to 5.3. This file format contains accurate descriptions of structure surfaces....
Read more >
STL export/import loss of detail | Alibre Forum
I wanted to import a part geometry to ParaView, a data analysis and visualization application. But after import of STL file the geometry...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found