Python: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
mNo edit summary
Line 1: Line 1:
Brian's random notes on Python
A few random notes on Python


== Geoprocessing ==


 
=== ESRI ===
 
 
== Links ==
 
[http://pythonce.sourceforge.net/ Python on Windows CE] (and Pocket PC)
 
=== Quick links into the official docs ===
 
TUTORIAL  http://docs.python.org/tut/tut.html
 
GENERAL    http://docs.python.org/
 
STRINGS    http://docs.python.org/lib/string-methods.html
 
http://diveintopython.org/
 
=== Geoprocessing ===
 
==== ESRI ====


31-Dec-2007 update: ArcGIS Desktop 9.3 includes a new wrapper that makes working
31-Dec-2007 update: ArcGIS Desktop 9.3 includes a new wrapper that makes working
with ArcObjects a lot easier. I am using ActiveState 2.4.3 with it with good results. It breaks if you try to move up to 2.5.1.
with ArcObjects a lot easier. I am using ActiveState 2.4.3 with it with good results. It breaks if you try to move up to 2.5.1.


Old notes:
====Old notes:====


This guy seems to have slogged through a lot of development with it and collected useful notes: http://www.ollivier.co.nz/support/python.shtm
This guy seems to have slogged through a lot of development with it and collected useful notes: http://www.ollivier.co.nz/support/python.shtm
Line 36: Line 18:
It still crashes. Oh joy. It does not even crash faster.
It still crashes. Oh joy. It does not even crash faster.


==== Open source ====
=== Open source ===


How about geoprocessing with [http://www.gdal.org OGR/GDAL]?  
How about geoprocessing with [http://www.gdal.org OGR/GDAL]?  
Line 43: Line 25:
Getting Python 2.4 and GDAL without disrupting the ESRI installation... See also [http://hobu.biz/ Howard Butler's site].
Getting Python 2.4 and GDAL without disrupting the ESRI installation... See also [http://hobu.biz/ Howard Butler's site].


'''Not good enough:''' [http://fwtools.maptools.org/ FWtools] installs a funky GUI called OpenEV_FW and a shell environment.
[http://fwtools.maptools.org/ FWtools] installs a GUI called OpenEV_FW and a shell environment. It comes with python 2.3.4 which is old. I think Frank does this because it's stable and test with his tools. Going to a newer version means the DLL won't work so you'd need to compile your own.
It comes with python 2.3.4 which is old but better than ESRI's 2.1
'''It does NOT include the pythonwin IDE'''. How INCORNVENIENT!


'''23-Aug-2006''' Python+OGR probably not worth messing with right now.
'''23-Aug-2006''' Python+OGR probably not worth messing with right now.
From the OGR site: ''The Python API isn't really well documented at this time, but parallels the C/C++ APIs. The interface classes can be browsed in the pymod/ogr.py (simple features) and pymod/osr.py (coordinate systems) python modules. The pymod/samples/assemblepoly.py sample script is one demonstration of using the python API.''
From the OGR site: ''The Python API isn't really well documented at this time, but parallels the C/C++ APIs. The interface classes can be browsed in the pymod/ogr.py (simple features) and pymod/osr.py (coordinate systems) python modules. The pymod/samples/assemblepoly.py sample script is one demonstration of using the python API.''
== Links ==
[http://pythonce.sourceforge.net/ Python on Windows CE] (and Pocket PC)
=== Links into official python docs ===
TUTORIAL  http://docs.python.org/tut/tut.html
GENERAL    http://docs.python.org/
STRINGS    http://docs.python.org/lib/string-methods.html
http://diveintopython.org/

Revision as of 21:02, 31 December 2007

A few random notes on Python

Geoprocessing

ESRI

31-Dec-2007 update: ArcGIS Desktop 9.3 includes a new wrapper that makes working with ArcObjects a lot easier. I am using ActiveState 2.4.3 with it with good results. It breaks if you try to move up to 2.5.1.

Old notes:

This guy seems to have slogged through a lot of development with it and collected useful notes: http://www.ollivier.co.nz/support/python.shtm

I can add a new one to his list. I was getting error messages on setting gp.workspace = 'foo' where foo is a valid path. It's because the gp object was hanging around in pythonwin's memory. You should be able to say 'del gp' but I gave up and restarted pythonwin to fix it.

When working with ArcToolbox 9.1 and Python 2.1 I have been having lots of crashes in PythonWin. Using it on a computer with ActiveState 2.4.3 I have not been experiencing the same problems. I am going to try installing 2.4x without removing 2.1 so I can fall back on it... I followed the instructions above.

It still crashes. Oh joy. It does not even crash faster.

Open source

How about geoprocessing with OGR/GDAL? Will that do it for me?

Getting Python 2.4 and GDAL without disrupting the ESRI installation... See also Howard Butler's site.

FWtools installs a GUI called OpenEV_FW and a shell environment. It comes with python 2.3.4 which is old. I think Frank does this because it's stable and test with his tools. Going to a newer version means the DLL won't work so you'd need to compile your own.

23-Aug-2006 Python+OGR probably not worth messing with right now. From the OGR site: The Python API isn't really well documented at this time, but parallels the C/C++ APIs. The interface classes can be browsed in the pymod/ogr.py (simple features) and pymod/osr.py (coordinate systems) python modules. The pymod/samples/assemblepoly.py sample script is one demonstration of using the python API.

Links

Python on Windows CE (and Pocket PC)

Links into official python docs

TUTORIAL http://docs.python.org/tut/tut.html

GENERAL http://docs.python.org/

STRINGS http://docs.python.org/lib/string-methods.html

http://diveintopython.org/