[Qgis-user] Export SHP to mySQL

Matthias Kuhn matthias at opengis.ch
Sat Mar 5 06:17:03 PST 2016


Hi Vincent,

While it should be possible to use MySQL, PostgreSQL with postgis is
much more common and there is much more help available for it in the
QGIS world. So if you are not required to use MySQL for other reasons, I
would recommend to evaluate other database systems first.

If you need to use MySQL, that's what google brought up concerning this
topic:

http://stackoverflow.com/questions/18379808/the-used-table-type-doesnt-support-spatial-indexes

Deducing from this, it sounds like you are not using the ISAM engine.

Kind regards,
Matthias


On 03/05/2016 02:55 PM, Vicent García wrote:
>
> Hi,
>
>  
>
> I’ve tried to do that (shp2mysql), but I got this error:
>
> “ERROR 1: MySQL error message: The used table type doesn’t suport
> SPATIAL indexes. Description: ALTER TABLE ‘shapefile’ ADD SPATIAL
> INDEX(‘poligon_columna’)
>
> ERROR 1: Terminating translation prmaturely after failed translation
> of layer ESP_adm4 (use -skipfailures to skip errors)”
>
>  
>
> Sorry, but it’s my first time that I use this command and I’m a bit lost.
>
>  
>
> Thanks,
>
>  
>
> Vicent.
>
>  
>
> *De:*Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] *En nombre
> de *Marco Lechner - FOSSGIS e.V.
> *Enviado el:* dissabte, 5 de març de 2016 11:16
> *Para:* qgis-user at lists.osgeo.org
> *Asunto:* Re: [Qgis-user] Export SHP to mySQL
>
>  
>
> Hi Vincent,
>
> its possible using ogr2ogr (and should be possible using QGIS -> Layer
> save as ... as well.
>
> # shp2mysql
> ogr2ogr -f MySQL MySQL:<my_db>,user=<username>,password=<mypass>
> <path2shape>.shp -nln <target_table> -overwrite -update -lco
> GEOMETRY_NAME=geom -lco ENGINE=MyISAM -lco CHARSET=UTF-8
>
> # info about table
> ogrinfo MySQL:<my_db>,user=<username>,password=<mypass> <table_name> -so
>
> # mysql2shp
> ogr2ogr -f "ESRI Shapefile" <path2shape>.shp
> MySQL:<my_db>,user=<username>,password=<mypass> -sql "SELECT * from
> <my_table>"
>
> Hope this helps
>
> Marco
>
> Am 05.03.2016 um 08:32 schrieb Vicent García:
>
>     Hi Community,
>
>      
>
>     Does anyone know how to export shapefile files to mySQL? I read
>     some things about the topic on the Internet but no clear solutions
>     I’ve found.
>
>      
>
>     Thanks,
>
>      
>
>     Vicent.
>
>
>
>
>     _______________________________________________
>
>     Qgis-user mailing list
>
>     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>
>     List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>     Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>  
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
Matthias Kuhn
OPENGIS.ch - https://www.opengis.ch
Spatial • (Q)GIS • PostGIS • Open Source

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160305/1f0e6ed2/attachment.html>


More information about the Qgis-user mailing list