[osgeo4w-dev] Import OSGeo4W/Gdal from Python

Thomas Juntunen junt0015 at umn.edu
Fri Apr 24 07:54:08 PDT 2015


On Fri, Apr 24, 2015 at 9:34 AM, Max Andela <andelamax38 at gmail.com> wrote:

> Dear OSGeo4W Developers and Users:
>
> I have installed Python 2.7 and Osgeo4w in my PC.
>
> The gdal is inside Osgeo4w installation. How can I import that gdal from
> Python?
>
> I hope somebody can help me.
>

​Max,

In your Start menu you should find OSGeo4W and under that an icon that
launches an OSGeo4W command shell with the environment set such you can now
access GDAL from python. Click it and it will open a shell window, at the
prompt launch python and in the interpreter you can do:

from osgeo import gdal

You can also execute python scripts from the shell window. If you want to
do this from an ordinary DOS prompt window, you'll need to modify your
system environment similarly to how OSGeo4W does it. Look at their .bat
files to see how to set your PATH and PYTHONPATH and whatever else you
might need.

HTH,
Thomas​

-- 
*The right coordinate system can turn an impossible problem into two really
hard problems. -- Charlie Pellerin*

Thomas Juntunen
GIS Specialist
Polar Geospatial Center
R280 Learning and Environmental Science
1954 Buford Ave
University of Minnesota
St. Paul, MN 55108
612-626-0505
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/osgeo4w-dev/attachments/20150424/19ffdd20/attachment.html>


More information about the osgeo4w-dev mailing list