How to to validate geometries using ogr2ogr

I have been trying to dissolve a shapefile with more than 38000 rows. I used query as follows

ogr2ogr -f "ESRI Shapefile" dissolved.shp Barangays.shp -dialect sqlite -sql "select ST_union(Geometry),* from input  GROUP BY concated" 

It gave me error that geometry is invalid because of self-intersecting polygons.

I found out there are 86 features which have invalid geometries using QGIS. I tried Make Valid tool as suggested in this question. But this is also not working, giving error undefined symbol, which I couldn't understand. So I decided to validate using ogr2ogr and after searching through google I tried this query

ogr2ogr -f "ESRI Shapefile" valid_barangays.shp Barangays.shp -dialect sqlite -sql "select Geometry.MakeValid(),* from Barangays" 

It gave me this error

ERROR 1: In ExecuteSQL(): sqlite3_prepare(select Geometry.MakeValid(),* from Barangays):   near "(": syntax error 

Please guide me how should I solve this problem. Thanks in advance.

Edit: I also imported my shapefile using ogr2ogr in phpmyadmin mysql. It saved geomtry column as [geometry some_number B]. I am not able to query. I always give error function not exist.


Category: qgis Time: 2016-07-30 Views: 4

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.228 (s). 12 q(s)