[osgeo4w-dev] Import OSGeo4W/Gdal from Python

Max Andela andelamax38 at gmail.com
Fri Apr 24 08:20:06 PDT 2015


Dear Thomas,

Thanks for your information. yes, it really worked from OSGeo4W command
shell.

I also tried to import gdal from Python idle. I set Path environment
variable to "C:\OSGeo4W64\bin" and PYTHONPATH variable to
"C:\OSGeo4W64\apps\Python27". But could not import the gdal from Python
idle.

Thank you so much.
Max


On Fri, Apr 24, 2015 at 11:54 PM, Thomas Juntunen <junt0015 at umn.edu> wrote:

> 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/20150425/58fdeea9/attachment.html>


More information about the osgeo4w-dev mailing list