Hi there

Firstly I want to say thanks for Chris and all the people involved in the
FloatCanvas project.  I've found it really useful for my research.

Secondly, in using FloatCanvas for my research, I have come across an issue
that I do not understand, and was hoping someone might be able to enlighten
me.  I have a python class which contains the NavCanvas and a bunch of
associated methods for loading various shapefiles. Now I want to customise
the zoom function so it zooms to a user-defined bounding box automatically.
The problem with ZoomToFit is that some of the shapefile features are far
larger than the area of interest, and hence the area of interest disappears.

I create the bounding box with
    self.bounding_box = BBox.asBBox([[min_x,min_y],[max_x,max_y]])
and then use that with the OGR spatial filter to get the features I want.

When it comes to drawing the features, I used to do a ZoomToFit after each
draw.  I have changed it to a 'canvas'.ZoomToBB(self.bounding_box), but I
get the following error

File 
"/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/lib/floatcanvas/FloatCanvas.py",
line 2706, in ZoomToBB
    self.ViewPortCenter = N.array(((BoundingBox[0,0]+BoundingBox[1,0])/2,
AttributeError: MapCanvas instance has no attribute '__getitem__'

where MapCanvas is the python class I've written.  Has anyone come across
this before?  I can't figure out why the attribute '__getitem__' is
expected.


Cheers, Sam :)
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to