[mapserver-users] Image centering problem...

Puneet Kishor pkishor at GeoAnalytics.com
Mon Sep 23 11:15:09 EDT 2002


On Monday, September 23, 2002, at 09:21  AM, Mike Smith wrote:

> But if I don't set the form value of "imgxy" somewhere the image 
> doesn't even load!  Looking at the Itasca demo I see that this value 
> is manually being set at the bottom of the html code, but that demo 
> recenters and zooms on mouse clicked points just fine.  I guess I'm 
> confused as to why the imgxy value is even needed, because mapserver 
> seems to automatically pick up on the img.x and img.y coordinates when 
> I click, but this doesn't help because the image just blows up if I 
> don't manually set imgxy somewhere.  Can I do something like this?

ya, but... what happens if you don't click? what if you just hit 
refresh on the browser, or what if you have a widget to turn layers 
on|off, and you just want to redraw after changing some layers?

hence imgxy... if you don't provide any img.x, img.y, that is, if you 
don't click but still want to draw, the image will get centered.

just a default setting.

follow the logic in the script... your img.x, img.y should only be 
called if you actually click on the map, which would be only if you 
want to zoom in|out, or pan (actually, you could do all of that without 
clicking on the map, but that would be a really dorky interface, so 
that is another story).

[..]

-----Original Message-----
>> From: Mike Smith [mailto:nospam at cnrit.tamu.edu]
>> Sent: Friday, September 20, 2002 3:37 PM
>> To: mapserver-users at lists.gis.umn.edu
>> Subject: [mapserver-users] Image centering problem...
>>
>>
>> Hello,
>>
>>    I'm sure I'm missing something really elementary here, but I've 
>> gone and added so much complexity to my mapserver web pages that I 
>> can't get the image to recenter on my mouse clicks anymore!  I see 
>> the "img.x" and "img.y" values appear in the URL when I click on the 
>> image, but I'm also setting "imgxy" in various places and I guess I'm 
>> clobbering something becuase no matter where I click, the map just 
>> zooms in and out centered on the mid-point of my main image.  I'm 
>> talking about non-applet implementations of Mapserver, and I'm not 
>> using Mapscript either.  If you want to see the problem I'm talking 
>> about look at any of my "non-applet" maps at the following URL:
>>

I have never worked with the cgi version (except for a couple of 
glances at the itasca demo) so I don't have first-hand knowledge... but 
you are definitely overriding the logic somewhere. Once again, it 
should be either imgxy as defined in default settings, that is, the 
center of the image, OR img.x, img.y defined by the user upon clicking 
on the map.

pk/

ps. unless there is specific constraint, I would advise you to move 
your application to mapscript, perl or php or whatever, because you 
would have a great amount of control over how it behaves.




More information about the mapserver-users mailing list