TransWikia.com

Create ESRI shapefile with attributes from mySQL

Geographic Information Systems Asked by JSz on December 17, 2020

I have some geometry which can be perceived as regions within a country and wish to create a shapefile which contains all the regions along with some attributes (e.g. name, population, area code, etc.)

I have the geometry from the regions in x,y WGS84 lat lon (not polygons so cannot be sure they are closed loops which is priority) currently stored in mySQL.

I wish to be able to create a single shp (with associated dbf and shx files) to contain this data.

Any pointers on command line tools and methods to do this would be gratefully received.

4 Answers

Take look at this example: http://docs.geotools.org/latest/userguide/tutorial/feature/csv2shp.html

It's easy to go from CSV to MySQL in Java.

Answered by Igor S. on December 17, 2020

Try with ogr2ogr using something like:

ogr2ogr output.shp MYSQL:dbname,user=userid,password=password,host=host,port=3306 tablename

Answered by Antonio Falciano on December 17, 2020

If you can read the mySQL file in QGIS, then just right-click and save as a shapefile

Answered by DPSSpatial on December 17, 2020

Here it worked with:

ogr2ogr -f "ESRI Shapefile"  C:/......./pms/pms.shp MySQL:dbgeom,host=webgis.bla.intern,user=bla,password=bla tablename -lco engine=MYISAM

Answered by Kai Behncke on December 17, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP