LatLongBoundingBox?

Russell Nelson nelson at crynwr.com
Fri Dec 24 08:17:42 CET 2004


Bernhard Reiter writes:
 > On Tue, Dec 21, 2004 at 07:32:14PM -0500, Russell Nelson wrote:
 > > Hmmm....  It seems to me, from grovelling through the code, that
 > > LatLongBoundingBox should always return sensible values; that is,
 > > values less than 90 to -90 and 180 to -180.  If it doesn't, then by
 > > definition the projection is incorrect.  Oughtn't Thuban to tell a
 > > user that on of their layers is not projected correctly?
 > 
 > Yes, Thuban should.

Unfortunately, that's not enough to fix the "view from 20 miles"
effect of a map misprojection, just a layer misprojection.  I added
the chunk of code given below.

If you load the UTM raster first, it catches the misprojection.
If you then fix the layer's projection, and load a shapefile, you get
a view from 20 miles high; that is, a blank screen.
If you set the Map/Projection to UTM, it displays properly.

If you load the shapefile first, there is no misprojection.
If you then load the UTM raster, it catches the misprojection.
You then get a view from 20 miles high again, but since there is no
misprojection, the code below doesn't catch it.

So, it looks like the code below is working just fine, but it's not
sufficient to catch a map misprojection.  I'm not proposing it as a
patch yet, because I want to catch the map misprojection as well.
Something along the lines of "These layers don't overlap; perhaps the
map projection is wrong?"

Also, something is clearing the Status line when you go up to the
button bar.  I can't find any calls to SetStatusText or
set_position_text which might do this.  Could it be something built
into wxWindows?

-- chunk of code inserted before last line of view_position_changed()
            text = ""
            map = self.canvas.Map()
            for layer in map.layers:
                bbox = layer.LatLongBoundingBox()
                if bbox:
                    left, bottom, right, top = bbox
                    if not (-180 < left < 180 and
                        -180 < right < 180 and
                        -90 < top < 90 and
                        -90 < bottom < 90):
                        text = ("Select "+layer.title+" and pick a " +
                            "projection using Layer/Projection...")
                        break

-- 
--My blog is at angry-economist.russnelson.com  | Freedom means allowing
Crynwr sells support for free software  | PGPok | people to do things the
521 Pleasant Valley Rd. | +1 315-323-1241 cell  | majority thinks are
Potsdam, NY 13676-3213  | +1 212-202-2318 VOIP  | stupid, e.g. take drugs.




More information about the Thuban-devel mailing list

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