Created
July 6, 2022 17:58
-
-
Save ThomasG77/0cc87a1ca00b8df4c9a96a679d74241e to your computer and use it in GitHub Desktop.
Fix QPV validity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://sig.ville.gouv.fr/Atlas/qp-politiquedelaville-shp.zip | |
unzip qp-politiquedelaville-shp.zip | |
ogrinfo QP_METROPOLEOUTREMER_WGS84_EPSG4326.shp -dialect SQLite -sql "SELECT count(*) FROM \"QP_METROPOLEOUTREMER_WGS84_EPSG4326\" WHERE NOT IsValid(geometry)" | |
ogr2ogr out.shp QP_METROPOLEOUTREMER_WGS84_EPSG4326.shp -dialect SQLite -sql "SELECT \"CODE_QP\", \"NOM_QP\", \"COMMUNE_QP\", CASE WHEN NOT IsValid(geometry) THEN ST_MakeValid(geometry) ELSE geometry END AS geometry FROM \"QP_METROPOLEOUTREMER_WGS84_EPSG4326\"" | |
ogrinfo out.shp -dialect SQLite -sql "SELECT count(*) FROM out WHERE NOT IsValid(geometry)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment