Mapping in python? Transforming shapefile so that basemap can read them?

2009-09-11 Thread C Barr Leigh
I'm trying to get started with plotting maps in python. I need to read
shape files (.shp) and make maps. There seem to be many efforts but
none is complete? I'm looking for suggestions and troubleshooting.

The basemap package is obviously at an impressive stage and comes with
some data:
http://www.scipy.org/Cookbook/Matplotlib/Maps

but it cannot read shapefiles when their coordinates are not in
geographic projection. min are in a lambert, so the readshapefile
fails.

Apparently there is a utility that can convert a .shp file to lat/lon
coordinates, but it fails for me. “You can convert the shapefile to
geographic - coordinates using the shpproj utility from the shapelib
tools - (http://shapelib.maptools.org/shapelib-tools.html)
 For me, this gives:
“unable to process projection, exiting...”

Has anyone overcome these problems?

Thanks!
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread C Barr Leigh
Help! Have I found a serious bug?
This seems like highly undesired behaviour to me. From the program
below, I get output:

call1: ['sdf']
call2: ['Set within test for call2']
call3: ['Set within test for call2']

instead of what I should get,

call1: ['sdf']
call2: ['Set within test for call2']
call3: ['Set within test for call3']

I'm using Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02). The code is
below.


#!/usr/bin/python

def testPersistence(anarg,twooption=[]):
#print anarg
if not twooption:
twooption.append('Set within test for '+anarg)
print anarg +': '+str(twooption)

testPersistence('call1',twooption=['sdf']);
testPersistence('call2');
testPersistence('call3');

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread C Barr Leigh
Oh, oops! Of course...  :)  A great and sensible feature if you're
expecting it.
Thanks very much, everyone, for the links and discussion!

Chris

-- 
http://mail.python.org/mailman/listinfo/python-list