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.
Importing a database from a fileFill in the fields with the connection information. Once connected to the database go to Data Import/Restore. Choose the option Import from Self-Contained File and select the file. Choose the destination database in Default Schema to be Imported To and then click on Start Import.
The shapefile format stores the geometry as primitive geometric shapes like points, lines, and polygons. These shapes, together with data attributes that are linked to each shape, create the representation of the geographic data.
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
http://trac.osgeo.org/osgeo4w/
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With