Georgia Wildlife Resources Division
2070 U.S. Hwy. 278, SE, Social Circle, GA 30025
This tutorial uses data provided from our website [1] and OGR2OGR [2] to generate a shapefile of rare EOs (element occurrences) for animals, plants and natural communitiy locations in Georgia, USA, generalized to 1/4 of a USGS 7.5 minute topo map [1].
OGR2OGR [2] is a free command line program that is able to manipulate GIS vector and assoicated attribute data in many ways including doing reprojections. It can also convert GIS vector data and non GIS data tables between many common formats such as ESRI Shapefile [3], ESRI Personal GeoDatabase [4], SQLite/SpatiaLite [5], KML [6], and many others [7].
Below is a Windows batch file that uses ogr2ogr first to load qq.shp [8] and qq_eos.csv [9] into a temporary SpatiaLite spatial database file. Then ogr2ogr is used to run an SQL left join query to add quarter quad polygons from qq.shp to associated qq_eos records and output a shapefile.
Notes:
Instructions
Contents of qq_eos_shp.bat:
REM Delete the sqlite database if it already exists
del tmp.sqlite
REM Delete the output shapefile if it already exists
del qq_eos_out.*
REM Create a temporary SQLite (SpatialLite) database and copy qq.shp into it.
ogr2ogr -f SQLite tmp.sqlite qq.shp
REM Copy the CSV file into the SQLite database
ogr2ogr -update -f SQLite tmp.sqlite qq_eos.csv
REM Left join qq shapes to the CSV attribute table and output a shapefile. Create projection file.
ogr2ogr -overwrite -f "ESRI Shapefile" qq_eos_out.shp tmp.sqlite -a_srs EPSG:26917 -sql "SELECT * FROM qq_eos LEFT JOIN qq ON qq_eos.id_code = qq.area_code"
REM Delete the temporary database
del tmp.sqlite
Links:
[1] http:
[2] http://www.gdal.org/ogr2ogr.html
[3] http://www.gdal.org/ogr/drv_shapefile.html
[4] http://www.gdal.org/ogr/drv_pgeo.html
[5] http://www.gdal.org/ogr/drv_sqlite.html
[6] http://www.gdal.org/ogr/drv_kml.html
[7] http://www.gdal.org/ogr/ogr_formats.html
[8] http://georgiawildlife.com/sites/default/files/uploads/wildlife/nongame/zip/qq.zip
[9] http://georgiawildlife.com/sites/default/files/uploads/wildlife/nongame/text/csv/qq_eos.csv
[10] http://www.georgiawildlife.com/1370
[11] http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
[12] http://www.georgiawildlife.com/sites/default/files/uploads/wildlife/nongame/text/bat/qq_eos_shp.bat