Skip to content

Instantly share code, notes, and snippets.

@ateucher
Last active November 28, 2016 23:26
Show Gist options
  • Save ateucher/43bf96900f3ce67c4b04ec78a737bd38 to your computer and use it in GitHub Desktop.
Save ateucher/43bf96900f3ce67c4b04ec78a737bd38 to your computer and use it in GitHub Desktop.
Various gis setup tips on Windows
Install Python (Anaconda is easiest)
As explained here: https://pythongisandstuff.wordpress.com/2016/04/13/installing-gdal-ogr-for-python-on-windows/,
download the compiled GDAL from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
Then:
$ pip install GDAL-blah-blah.whl
If fiona (https://github.com/Toblerity/Fiona) is required, download it from http://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona and install it the same way.
Set a User Environment Variable: GDAL_DATA=C:\Users\ateucher\AppData\Local\Continuum\Anaconda\Lib\site-packages\osgeo\data\gdal
Make sure the path to GDAL is on your PATH (eg C:\Users\ateucher\AppData\Local\Continuum\Anaconda\Lib\site-packages\osgeo)
To use the FileGDB driver from ESRI:
(http://gis.stackexchange.com/questions/193288/how-to-add-support-for-filegdb-esri-file-gdb-api-driver-in-fiona)
Download the File Geodatabase API for Windows from the Esri downloads page:
http://appsforms.esri.com/products/download/index.cfm#File_Geodatabase_API_1.3.
If you have Python 2.7 get the 1.3 version [File Geodatabase API 1.3 version for Windows (Visual Studio 2008)].
For Python 3.x the most recent 1.4 version should work
Open the zip and copy bin64/FileGDBAPI.dll to C:\Users\ateucher\AppData\Local\Continuum\Anaconda\Lib\site-packages\osgeo.
Make sure that ogr_FileGDB.dll is in the gdalplugins folder. This folder is the folder that must be set in the GDAL_DRIVER_PATH environment variable (next step)
Set an Environment Variable: GDAL_DRIVER_PATH=C:\Users\ateucher\AppData\Local\Continuum\Anaconda\Lib\site-packages\osgeo\gdalplugins
test with:
$ ogrinfo --formats
FileGDB -vector- (rw+): ESRI FileGDB
OpenFileGDB -vector- (rov): ESRI FileGDB
should both be there
Make sure path to postgreSQL is on your path: (eg C:\Program Files\PostgreSQL\9.6\bin)
# in a windows cmd window
cmd /c chcp 1252 # http://stackoverflow.com/questions/19162055/psql-shell-uses-code-page-850-windows-uses-1252-how-to-solve-change-console-co
psql -U postgis # enter password at promt
# to create a new postgis database: https://gis.stackexchange.com/questions/71130/how-to-create-a-new-gis-database-in-postgis#_=_
CREATE DATABASE postgis;
\connect postgis;
CREATE EXTENSION postgis;
# to create a new postgis db from a previously made template:
DROP DATABASE postgis; # if it exists
CREATE DATABASE postgis TEMPLATE postgis_template;
\q # Quit postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment