[mapserver-users] MapScript and ZoomRectangle (and rectObj problems)

Jelmer Baas Baas at speerit.nl
Fri May 1 18:35:46 EDT 2009


Hello List,

Three years ago, I built a web interface for our primary application
using MapServer. Now we're in the process of building that same
application in VB.Net (but with more features) using MapScript.

Although everything comes along nicely (I love the fact that everything
returns objects, etc) there is one huge problem that I can't seem to
solve: creating and using the rectObj class. I read a lot about it and
found many bug cases, older messages, etc, but I still can't make heads
or tails of it. I'm sorry about asking it, since it must be the
millionth time this question has been asked.

I *CAN* get ZoomRect with a rectObj to work when using image coords,
even though that requires my own code that flips miny and maxy to solve
that lovely error about miny => maxy or something. When I try to use it
with map coords however, I can't get it to work. 

In my init code I create a new rect object:
    Map = New mapObj(strMapPath)
    FullExtent = New rectObj(0, 0, 0, 0, 0)
    With Map.extent
      FullExtent.maxx = .maxx
      FullExtent.minx = .minx
      FullExtent.maxy = .maxy
      FullExtent.miny = .miny
    End With

When I feed this to ZoomRectangle using 
Map.zoomRectangle(FullExtent, MapWidth, MapHeight, Map.extent, Nothing)
I get that famous "mapscript::mapObj::zoomRectangle(): General error
message. image rectangle maxy >= miny". 

When I flip miny and maxy I end up in the middle of the Sahara (while
the original coords should show the Netherlands).

Things I wonder about:
1) How can I get zoomRectangle to work with world/map coords instead of
image coords?
2) Why does the constructor have an "imageunits as integer"? IMHO a
simple rect object has nothing todo with the coordsys of the/a map
(since I can more than one).
3) When will the much discussed bugfix be applied that automaticly flips
miny/maxy?

Any help would be greatly appreciated,

With kind regards,
Jelmer Baas


More information about the mapserver-users mailing list