Re: [osgeo4w-dev] Import OSGeo4W/Gdal from Python
On Fri, Apr 24, 2015 at 10:20 AM, Max Andela wrote: > 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. > Max, I haven't used idle, so I'm not sure how to configure it, but I use Komodo IDE (there is a free Komodo Edit that works similarly), which allows me to select which python to use. When I still used the OSGeo4W distro, that worked fine. PyCharm can also do this and probably many other editors. 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 ___ osgeo4w-dev mailing list osgeo4w-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Re: [osgeo4w-dev] Import OSGeo4W/Gdal from Python
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 wrote: > On Fri, Apr 24, 2015 at 9:34 AM, Max Andela 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 > ___ osgeo4w-dev mailing list osgeo4w-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Re: [osgeo4w-dev] Import OSGeo4W/Gdal from Python
On Fri, Apr 24, 2015 at 9:34 AM, Max Andela 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 ___ osgeo4w-dev mailing list osgeo4w-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev