Skip to content

Instantly share code, notes, and snippets.

@soiqualang
Forked from zackad/ogr2ogr.sh
Created January 11, 2019 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soiqualang/454c29f2fb9240d0f272ea4e464e3e7c to your computer and use it in GitHub Desktop.
Save soiqualang/454c29f2fb9240d0f272ea4e464e3e7c to your computer and use it in GitHub Desktop.
ogr2ogr cheatsheet
# export mysql database into shapefile
ogr2ogr out_shapes MYSQL:gis,user=root,password=password
# import shapefile into mysql
ogr2ogr -f MySQL MySQL:database_name,user=root,password=password my_shapefile.shp -nln table_name -a_srs EPSG:4326 -update -overwrite -lco engine=MYISAM
# reproject spatial reference from WGS 84 UTM 48S to Geographic Lattitide/Longitude Coordinate System
ogr2ogr -f "ESRI Shapefile" target_file.shp source_file.shp -s_srs EPSG:32748 -t_srs EPSG:4326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment