[Freegis-list] Sum: Python

David Trillo Montero dtrillo at dap.es
Wed Apr 10 12:43:26 CEST 2002


Thank you very much for all your responses. Anyway I would like to hear more about Python and GIS.

I have been encourage finally to learn it, even if I have to improve my programmer skills. anyway, here are your comments.

Dragos Lipan:

:)) Python is a object oriented, programmer productivity oriented.
It has a sublime way of working with objects and extremely fast learning curve.
Is a very good programming language.

In the GIS field nothing happens special with Python, you can interface existing libraries
wrote in c, c++, python and inteface them.
For imagery you can use several packages. I work with PIL.

You should start from here:
http://www.rimbault.net/python/ 

Howard C Butler sent me this:

Glad to hear that you are interested in Python. I've been using Python for 
about a year and a half, as well as using Avenue for going on five 
years.  Coming from Avenue, Python feels very comfortable, behaves like you 
would expect it to, and is very powerful.  As a language, the syntax is 
clean, readable (especially after you've been away from a script for a 
month or two), and very flexible.  Python itself is built-upon and written 
in C, and if you have something that requires more performance, you can 
write it into a C module and still use it within Python. There is even a 
version of Python called Jython that allows you to work in Java 
environments, but I don't know too much about it.

Python is powerful in the windows environment thanks to Mark Hammond, who 
wrote the hooks to allow Python to talk COM.  You can use Python-COM to 
talk to windows apps like Excel and IE (and ArcGIS!) without having to 
resort to DDE.  The standard library and modules that Python users have 
written is quite large, and if you need to do something, most likely 
someone else has already written a module that will do what you want (like 
working with dbf files, the Python Imaging Library for handling gobs of 
image formats, and ReportLab for generating pdfs).

Bruce Dodson has done the most to bring Python to the ESRI world by writing 
a DLL that allows the Python interpreter to be embedded within ArcView 
(http://www.geocities.com/brucedodson.rm/avpython.htm).  This means that 
you can script Avenue objects with Python and vise versa.  It's very handy 
because Avenue isn't that extendible (scripting-wise), and if you wanted to 
do anything outside of ArcView before, you often had to write a DLL or 
struggle with DDE for apps that supported it.

As for getting started, download yourself a copy of the ActiveState Python 
distribution (assuming Windows here, the avpython.dll doesn't work with 
Solaris to my knowledge). 
(http://www.activestate.com/Products/Download/Download.plex?id=ActivePython) 
Python 2.1.1 or 2.2.0 will do.  I'd choose 2.1.1 for now because a point 
release is coming in the 2.2 branch, and any of the database adapters (and 
other compiled Python modules) you might want to use (postgres, mysql, 
dcoracle2) are likely pre-compiled for 2.1 and not 2.2 yet.  You will also 
need to get a copy of the dll that is compatible with Python 2.1.  The 
version of the dll on Bruce's site only works with Python 2.0, but there is 
a version of the extension available that has dll's for both 2.1 and 2.2 
(http://hobu.net:81/Research/scripts)

After you get Python installed, the dll renamed and put in your bin32 
directory, and the .avx file put in your ext32 directory, your good to 
go.  The O'Reilly "Learning Python" book and the New Riders "Python 
Essential Reference" are probably the two best starter books.  Bruce has 
some sample scripts that show how to fire up Excel and put some data into 
it.  So far, I've used the avpython.dll to write a MySQL connector for 
ArcView, as well as script Internet Explorer and Excel.

I've been very happy working in Python, and I think it fits well with 
Avenue.  It allows you to easily get out of the ArcView-only box that 
Avenue alone puts you in.  I think it adds a lot to ArcView and will allow 
me to keep writing Avenue whilst I stubbornly learn the new stuff in ArcGIS.

james m. johnston:

I have dabbled with Python a bit. It is a very powerful and useful language, 
but as yet I haven't applied it to GIS, nor have I gone beyond playing with 
it. If your getting into the vb and com based world of the new ArcGIS, it 
will prove extremely valuable I'm sure.  My brother in law swares by it and 
he has been a com based programmer for the last 10 years.
good luck!





David Trillo Montero
Dpto. Innovación y Desarrollo.
E.P. Desarrollo Agrario y Pesquero de Andalucia
Telefono: 954938100 Ext 8483
Fax : 954938110
mailto:dtrillo at dap.es





More information about the Freegis-list mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)