mapserver Redraw/Refresh problems

kenboss at dilbert.dnr.state.mn.us kenboss at dilbert.dnr.state.mn.us
Tue Nov 16 06:01:54 PST 1999


Robert--

Do you have one of these in the mapserv form in your template file?

<input type="hidden" name="imgext" value="[mapext]">

If not, I think you need one.

You likely also need to set imgxy at .5 less than half the width and height of 
your map (in pixels), e.g., if your map is 300 x 200 pixels, do:

<input type="hidden" name="imgxy" value="149.5 99.5">

imgxy will emulate a mouse click at the center of your map when you're not 
clicking in the map to submit it (i.e., when you submit via a "submit" button).

Just a couple of shots in the dark...

--Ken

============================================================================
Ken Boss                                
Digital Image Analysis / Web Stuff      Forestry Resource Assessment
kenboss at dilbert.dnr.state.mn.us         Minnesota Dept. of Natural Resources
Voice: 218 327 4449 ext. 237            413 SE 13th Street                    
Fax:   218 327 4517                     Grand Rapids, MN  55744         USA
                   www.ra.dnr.state.mn.us
============================================================================



> I have a template file that allows users to add layers to a map view, to
> make the layer visible in the map view I put a simple redraw/refresh
> button in the map view:
> 
> <input type="submit" value="refresh">
> 
> All the map extents, layer info, and other values that mapserver has
> embedded in the template should get sent back and the map should redraw
> with the same extent view, but with new layers added.
> 
> Unfortunately it doesn't work.  The layers get added, but strangely, the
> map view jumps back the original state of the map when it is first
> initialized (imgext=-31.265800+-38.940385+89.902700+82.059685) but the
> imgext info is completely off in the CGI call.
> 
> Here's what gets sent:
> 
> 
http://../cgi-bin/mapserv2?map=%2Fhome%2Frchavez%2Fwww%2Fweb%2Fdocs%2Fmapdemo%2F
> 
ancient.map&imgext=-38.446905+-19.245048+82.721595+101.755022&mode=browse&zoom=1
0&img.x=299&img.y=318
> 
> Here's what I get back:
> 
> 
http://psyche.perseus.tufts.edu/cgi-bin/mapserv2?map=%2Fhome%2Frchavez%2Fwww%2Fw
eb%2Fdocs%2Fmapdemo%2F
> 
ancient.map&imgext=15.977778+31.467920+28.094628+43.567927&mode=browse&refresh=r
efresh&layer=BodiesOfWater&zoom=10
> 
> Here's the extent I'm actually seeing in the map view:
> imgext=-31.265800+-38.940385+89.902700+82.059685
> 
> Oddly enough, if I hardcode a CGI call to refresh the map in the map
> template,
> 
> ../cgi-bin/mapserv2?map=[map]&mapext=[minx]+[miny]+[maxx]+[maxy]..
> 
> everything works fine, but the new layer(s) won't be displayed, of course.
> 
> I thought the problem might be related to the extents in my map file, but
> they check out OK with shpdmp.  I also thought the problem might be due to
> the fact that I'm my data is unprojected (Decimal Degrees) and I'm using
> DD as map units, but I tried this with projected data and meters units and
> got the same results.  I can't figure out what I'm overlooking.  Any
> ideas?  (I'm using mapserver 3.2.21)
> 
> Thanks
> Robert Chavez
> Programmer
> Perseus Project
> rchavez at perseus.tufts.edu
> 



More information about the MapServer-users mailing list