0

How can I extract country specific map data obtained from http://download.geofabrik.de/asia/india.html

into a mysql table with spatial columns https://dev.mysql.com/doc/refman/5.5/en/using-spatial-data.html

Which format works well with MySQL - .xml, .pbf or .osm ?

codejunkie
  • 908
  • 2
  • 21
  • 34
  • Did you read https://stackoverflow.com/questions/20125242/import-openstreetmap-data-osm-file-to-a-mysql-database-sql-file and https://stackoverflow.com/questions/20125242/import-openstreetmap-data-osm-file-to-a-mysql-database-sql-file ? – scai Sep 20 '16 at 16:28
  • Yes I read both these links. – codejunkie Sep 21 '16 at 03:59

1 Answers1

1

Since your goal is to load downloaded data from the website to MySQL spatial. Then i think the most straightforward way is to download the shapefiles (.shp) from the website and load into your spatial database using OSGEO4W.

There is a data drive for shapefile data loading to MySQL in gdal ogr2ogr. More details about the drive in OSGEO4W (reputable gis toolkit set): OSGEO4W official website

Command example:

ogr2ogr –f MySQL MySQL:database_name,host=localhost,user=database_username, password=database_password path/to/shapefile  -nln datatable_name -update -overwrite -lco engine=MYISAM.

More details about the command line : http://www.gdal.org/ogr2ogr.html

Teng Ma
  • 353
  • 2
  • 9