I need to import the spatial data in shape file into MySQL tables. I am able to import into PostGreSQL. Any pointers for MySQL. I need the data in MySQL table.
How to Import shape file into MySQL
I am looking what exactly I need to do ? Do I need to install things extra tools something FWtools I do have SQL2008R2 installed, what else I need ? –
Jamin
try this with FWtool installed
ogr2ogr -f MySQL MySQL:database_name,host=localhost,user=root,password=1234 C:\route_path\line.shp -nln datatable_name -update -overwrite -lco engine=MYISAM
try install for a better result in any process Osgeo4w
I tried that as well, but It didn't work because of some error regarding driver not found. –
Jamin
but the error will comes with FWTools or Osgeo4w, you could place the code you used –
Chastise
The Ogre works wonders! You have to have the .shx file in the same dir as the .shp for it to work, and if you want any data to correspond with your shapes, you will need the .dbf files there as well, however it does not throw an error if it is not there: you will just end up with shapes with indexes (pretty useless to me). –
Clyster
OSGeo4W is only for Windows, and I need to do this on linux. Do you know if there are any linux tools available that do this too? –
Cyprio
OSGeo4W is a packpage compiled for windows, the source is GDAL, GRASS, etc, find this in the documentation of de osgeo4w –
Chastise
I have just used the ogr2ogr command line tool to import the shape file into the mysql database. Make sure that the database server allows external connections. If doesn't, then it throws all sorts of errors.
Once you have that you can use -
Select ASTEXT(Shape) POLYGON from world to get an array of the polygon coordinates etc
© 2022 - 2024 — McMap. All rights reserved.