[gdal-dev] ogr2ogr overwrite parameter

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Tue Oct 8 12:37:54 PDT 2013


Nicol Hermann <gdal <at> geoworld.de> writes:

> 
> Hello list,
> 
> I am trying to batch load GPX files from a directory into a mysql
> database.
> In order to avoid duplicates I am using the '-overwrite' layer create
> option.
> The following line throw the error message
> 
> ogr2ogr -overwrite -f MYSQL
> 'MYSQL:dbname,host=localhost,user=me,password=' ${file} -lco
> GEOMETRY=AS_XYZ -lco engine=MYSIAM  -sql "SELECT name FROM tracks"
> 
> MySQL error message:The used table type doesn't support SPATIAL indexes
> Description: ALTER TABLE `tracks` ADD SPATIAL INDEX(`SHAPE`)
> 
> although I have also specified the   
> -lco engine=MYSIAM
> 
> parameter.
> Any idea how to change the line to avoid this error?
> 
> If I am changing the parameter to '-append' the import works with the
> downside to have duplicates in if I rerun the script.

This is not exactly an answer to your question, but you -overwrite option
does not overwrite features on the layer but it overwrites the whole layer.
So if you manage you command to work otherwise, in the end you will have
only your last GPX file in the database. Use append instead and delete the
dublicates with SQL afterwards.

-Jukka Rahkonen-

> Thanks 
> Best regards
> Nicol
> 






More information about the gdal-dev mailing list