[gdal-dev] ogr2ogr overwrite parameter

Even Rouault even.rouault at mines-paris.org
Tue Oct 8 13:05:22 PDT 2013


Le mardi 08 octobre 2013 21:37:54, Jukka Rahkonen a écrit :
> 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

This is a typo. Should be : -lco ENGINE=MyISAM

> > 
> > 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.

For append/update without creating duplicates into an existing target layer, 
you can try the 
http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogrupdate.py script.

> 
> -Jukka Rahkonen-
> 
> > Thanks
> > Best regards
> > Nicol
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list