GDAL on Windows: Difference between revisions
Brian Wilson (talk | contribs) mNo edit summary |
Brian Wilson (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
=== ArcGIS 9.3 + Python + GDAL using OSGeo4W === | |||
2010-Jul-25 | |||
Install [http://trac.osgeo.org/osgeo4w/OSGEO4W] just gdal 1.7 and python using the Advanced option. Asking for gdal turns on the other dependencies we need including proj4. | |||
This looks promising since it installs python 2.5 which is what we use with ArcGIS 9.3 | |||
Python packages are installed in OSGEO4WROOT/apps/Python25/Lib/site-packages | |||
=== ArcGIS 10 + Python + GDAL using OSGeo4W === | === ArcGIS 10 + Python + GDAL using OSGeo4W === | ||
2010-June-something | |||
'''Download and install PyPI''' the python installer package. | '''Download and install PyPI''' the python installer package. | ||
See http://pypi.python.org/pypi/GDAL/ | |||
First install the installer. Get the Windows version for Python 2.6 and run it. See http://pypi.python.org/pypi/setuptools | First install the installer. Get the Windows version for Python 2.6 and run it. See http://pypi.python.org/pypi/setuptools | ||
Line 14: | Line 30: | ||
Next step WOULD be to go install the Python packages using the installer. The easy_install GDAL" fails because it can't find the cpl_ports.h file that's installed with gdal in C:\OSGeo4W\ | Next step WOULD be to go install the Python packages using the installer. The easy_install GDAL" fails because it can't find the cpl_ports.h file that's installed with gdal in C:\OSGeo4W\ | ||
-- | -- | ||
Line 33: | Line 47: | ||
include_dirs = C:/OSGeo4W/include | include_dirs = C:/OSGeo4W/include | ||
library_dirs = C:/OSGeo4W/lib | library_dirs = C:/OSGeo4W/lib | ||
import osgeo.gdal gives | import osgeo.gdal gives | ||
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 | Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 | ||
Line 51: | Line 62: | ||
ImportError: No module named _gdal | ImportError: No module named _gdal | ||
--- | --- |
Revision as of 21:57, 25 July 2011
ArcGIS 9.3 + Python + GDAL using OSGeo4W
2010-Jul-25
Install [1] just gdal 1.7 and python using the Advanced option. Asking for gdal turns on the other dependencies we need including proj4.
This looks promising since it installs python 2.5 which is what we use with ArcGIS 9.3
Python packages are installed in OSGEO4WROOT/apps/Python25/Lib/site-packages
ArcGIS 10 + Python + GDAL using OSGeo4W
2010-June-something
Download and install PyPI the python installer package.
See http://pypi.python.org/pypi/GDAL/
First install the installer. Get the Windows version for Python 2.6 and run it. See http://pypi.python.org/pypi/setuptools Add the C:\Python26\ArcGIS10.0\Scripts directory to your PATH. That allows your command shell to find and run easy_install.
Next install OSGeo4W for this. See http://trac.osgeo.org/osgeo4w/ Along with GDAL and PROJ4 which is what we're looking for right now, this installs lots of cool stuff like QGIS and uDig. (You can uncheck boxes if you are in a hurry or don't want the whole thing.)
You have to have gdal 1.7 installed before you install Python gdal. Turns out that's part of the OSGeo4W installation done in the previous section, so now all I have to do is figure out how to reference those files.
I can't figure that out yet.
Next step WOULD be to go install the Python packages using the installer. The easy_install GDAL" fails because it can't find the cpl_ports.h file that's installed with gdal in C:\OSGeo4W\
--
I got a little further along, I was able to get it to build and install and now it can't find _gdal.py I think possibly either it's not loading gdal17.dll or that's wrong and it really needs gdal171.dll
I downloaded source for gdal 171 and edited the file setup.cfg, adding the last two lines so it could find where OSGeo4W put things.
[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0
[build_ext] gdal_config = ../../apps/gdal-config include_dirs = C:/OSGeo4W/include library_dirs = C:/OSGeo4W/lib
import osgeo.gdal gives
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import osgeo.gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module> File "osgeo\__init__.py", line 21, in <module> _gdal = swig_import_helper() File "osgeo\__init__.py", line 13, in swig_import_helper import _gdal
ImportError: No module named _gdal
--- GOT IT (I've been making some notes here: http://wildsong.biz/index.php?title=Geoprocessing#Open_source)
To get the import to happen I had to set the environment, and there is a script to help me do that in c:\OSGeo4W\bin called gdal17.bat
In a cmd window I run that then I start python....
C:\OSGeo4W\bin>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import osgeo.osr >>> dir(osgeo.osr) ['CoordinateTransformation', 'CoordinateTransformation_swigregister', 'DontUseEx ceptions', 'GetProjectionMethods', 'GetUserInputAsWKT', 'GetWellKnownGeogCSAsWKT ', 'SRS_DN_NAD27', 'SRS_DN_NAD83', 'SRS_DN_WGS72', 'SRS_DN_WGS84', 'SRS_PM_GREEN WICH', 'SRS_PP_AZIMUTH', 'SRS_PP_CENTRAL_MERIDIAN', 'SRS_PP_FALSE_EASTING', 'SRS _PP_FALSE_NORTHING', 'SRS_PP_FIPSZONE', 'SRS_PP_LANDSAT_NUMBER', 'SRS_PP_LATITUD E_OF_1ST_POINT', 'SRS_PP_LATITUDE_OF_2ND_POINT', 'SRS_PP_LATITUDE_OF_CENTER', 'S RS_PP_LATITUDE_OF_ORIGIN', 'SRS_PP_LATITUDE_OF_POINT_1', 'SRS_PP_LATITUDE_OF_POI NT_2', 'SRS_PP_LATITUDE_OF_POINT_3', 'SRS_PP_LONGITUDE_OF_1ST_POINT', 'SRS_PP_LO NGITUDE_OF_2ND_POINT', 'SRS_PP_LONGITUDE_OF_CENTER', 'SRS_PP_LONGITUDE_OF_ORIGIN ', 'SRS_PP_LONGITUDE_OF_POINT_1', 'SRS_PP_LONGITUDE_OF_POINT_2', 'SRS_PP_LONGITU DE_OF_POINT_3', 'SRS_PP_PATH_NUMBER', 'SRS_PP_PERSPECTIVE_POINT_HEIGHT', 'SRS_PP _PSEUDO_STD_PARALLEL_1', 'SRS_PP_RECTIFIED_GRID_ANGLE', 'SRS_PP_SATELLITE_HEIGHT ', 'SRS_PP_SCALE_FACTOR', 'SRS_PP_STANDARD_PARALLEL_1', 'SRS_PP_STANDARD_PARALLE L_2', 'SRS_PP_ZONE', 'SRS_PT_ALBERS_CONIC_EQUAL_AREA', 'SRS_PT_AZIMUTHAL_EQUIDIS TANT', 'SRS_PT_BONNE', 'SRS_PT_CASSINI_SOLDNER', 'SRS_PT_CYLINDRICAL_EQUAL_AREA' , 'SRS_PT_ECKERT_I', 'SRS_PT_ECKERT_II', 'SRS_PT_ECKERT_III', 'SRS_PT_ECKERT_IV' , 'SRS_PT_ECKERT_V', 'SRS_PT_ECKERT_VI', 'SRS_PT_EQUIDISTANT_CONIC', 'SRS_PT_EQU IRECTANGULAR', 'SRS_PT_GALL_STEREOGRAPHIC', 'SRS_PT_GAUSSSCHREIBERTMERCATOR', 'S RS_PT_GEOSTATIONARY_SATELLITE', 'SRS_PT_GNOMONIC', 'SRS_PT_GOODE_HOMOLOSINE', 'S RS_PT_HOTINE_OBLIQUE_MERCATOR', 'SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURA L_ORIGIN', 'SRS_PT_IMW_POLYCONIC', 'SRS_PT_KROVAK', 'SRS_PT_LABORDE_OBLIQUE_MERC ATOR', 'SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA', 'SRS_PT_LAMBERT_CONFORMAL_CONIC_1S P', 'SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP', 'SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BE LGIUM', 'SRS_PT_MERCATOR_1SP', 'SRS_PT_MERCATOR_2SP', 'SRS_PT_MILLER_CYLINDRICAL ', 'SRS_PT_MOLLWEIDE', 'SRS_PT_NEW_ZEALAND_MAP_GRID', 'SRS_PT_OBLIQUE_STEREOGRAP HIC', 'SRS_PT_ORTHOGRAPHIC', 'SRS_PT_POLAR_STEREOGRAPHIC', 'SRS_PT_POLYCONIC', ' SRS_PT_ROBINSON', 'SRS_PT_SINUSOIDAL', 'SRS_PT_STEREOGRAPHIC', 'SRS_PT_SWISS_OBL IQUE_CYLINDRICAL', 'SRS_PT_TRANSVERSE_MERCATOR', 'SRS_PT_TRANSVERSE_MERCATOR_MI_ 21', 'SRS_PT_TRANSVERSE_MERCATOR_MI_22', 'SRS_PT_TRANSVERSE_MERCATOR_MI_23', 'SR S_PT_TRANSVERSE_MERCATOR_MI_24', 'SRS_PT_TRANSVERSE_MERCATOR_MI_25', 'SRS_PT_TRA NSVERSE_MERCATOR_SOUTH_ORIENTED', 'SRS_PT_TUNISIA_MINING_GRID', 'SRS_PT_TWO_POIN T_EQUIDISTANT', 'SRS_PT_VANDERGRINTEN', 'SRS_PT_WAGNER_I', 'SRS_PT_WAGNER_II', ' SRS_PT_WAGNER_III', 'SRS_PT_WAGNER_IV', 'SRS_PT_WAGNER_V', 'SRS_PT_WAGNER_VI', ' SRS_PT_WAGNER_VII', 'SRS_UA_DEGREE', 'SRS_UA_DEGREE_CONV', 'SRS_UA_RADIAN', 'SRS _UL_CHAIN', 'SRS_UL_CHAIN_CONV', 'SRS_UL_FOOT', 'SRS_UL_FOOT_CONV', 'SRS_UL_LINK ', 'SRS_UL_LINK_CONV', 'SRS_UL_METER', 'SRS_UL_NAUTICAL_MILE', 'SRS_UL_NAUTICAL_ MILE_CONV', 'SRS_UL_ROD', 'SRS_UL_ROD_CONV', 'SRS_UL_US_FOOT', 'SRS_UL_US_FOOT_C ONV', 'SRS_WGS84_INVFLATTENING', 'SRS_WGS84_SEMIMAJOR', 'SRS_WKT_WGS84', 'Spatia lReference', 'SpatialReference_swigregister', 'UseExceptions', '__builtins__', ' __doc__', '__file__', '__name__', '__package__', '_newclass', '_object', '_osr',
'_swig_getattr', '_swig_property', '_swig_repr', '_swig_setattr', '_swig_setatt
r_nondynamic']