I'm trying to extract centroids from polygons. I have already done it on Linux Fedora, MAC OS-X shell. The result was good.

Now I need to run the same command on UBUNTU shell, but it returns the following error:

ogr2ogr -dsco "SPATIALITE=YES" -sql "SELECT ST_Centroid(geometry), * FROM poly" -dialect sqlite centroids.shp filtered_result.shp

Warning 6: driver ESRI Shapefile does not support creation option SPATIALITE ERROR 6: The SQLite driver needs to be compiled to support the SQLite SQL dialect

I have already installed SQlite as following:

  • wget Page on sqlite.org
  • tar xvfz sqlite-autoconf-3190200.tar.gz
  • cd sqlite-autoconf-3190200
  • ./configure
  • make
  • make install

What is the problem? How can I fix it?

  • 1
    Shapefile driver does not support anything like -dsco spatialite=yes. Take it out. The other problem is that you must first compile SQLite and Spatialite and then GDAL with those two if you want to use ST_Centroid. – user30184 Jun 5 '17 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.