[mapserver-users] Intercepting Map Click Coordinates withJavaScript ? Zooming with scale values.
Stephen Woodbridge
woodbri at swoodbridge.com
Tue Jan 22 11:12:06 PST 2002
Hi all,
If you are interested, I posted my Javascript off of
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?SkinsCodeSnippets
<lecture mode>
That said, anything but the simpliest javascript is a pain to maintain
and I don't recommend it if you have an option. The dynapi stuff is
good, but it is NOT pain free (ask Ed McNierney who implemented TopoZone
using it). My code above does not work for all browsers and it took a
huge amount of effort to get it to work as well as it does.
Consider yourselves warned :) so have at it.
</lecture mode>
-Steve Woodbridge
http://swoodbridge.com
http://web-maps.org
Vladimir Guzmán wrote:
>
> Hello.
> I've been working on this for a while, and actually I can make it work in
> IE 5+ and in Netscape 4. Actually I'm working on make it work with
> Mozilla/Gecko browsers. I can do it with a tool I've found in
> http://dynapi.sourceforge.net/dynapi/
> called DynApi.
> You can try my site in
> http//200.24.94.114/ifx/
> login test
> password test
> It is an application to manage ISP's coverages, so we can view, edit,
> delete and update
> clients, nodes and antennas on line. It includes a geo-coding algorithm.
> It was designed for Bogota - Colombia - S.A.
> If you have questions on how I've done, I'll be glad to answer.
>
> --
> Vladimir Guzmán R.
> -----------------
> www.main-task.com
>
> Stephen Woodbridge wrote:
>
> >Well yes it IS darn near impossible! I got it to work for NS4 and IE4
> >but I never played with it to get it to work on IE5 or NS6. Check out:
> >
> >http://web-maps.org/RQ/nav_map.php3?event=get_map&clat=42.634735&clon=-71.390831&zoom=8&title=North+Chelmsford%2C+MA+01863
> >
> >and run the cursor over the map and read the lat/lon in the boxes below
> >the map.
> >
> >Let me know if anyone is interested in trying to get it to work with IE5
> >and NS6 or adding it to a navigation Skin.
> >
> >-Steve W.
> >
> >Steve Lime wrote:
> >
> >>Does this actually work? I was under the impression it would IF the
> >>image in question was in an absolutely positioned layer or it's own
> >>frame. It's typically easy to get page coordinates but figuring out
> >>where an image lies on the page (so you know where you are in the image)
> >>is darn near impossible without layers or frames.
> >>
> >>Steve
> >>
> >>Stephen Lime
> >>Data & Applications Manager
> >>
> >>Minnesota DNR
> >>500 Lafayette Road
> >>St. Paul, MN 55155
> >>651-297-2937
> >>
> >>>>>Walt Lin <joemayfair at usa.net> 01/21/02 12:18 PM >>>
> >>>>>
> >>With CGI, it's dirt easy-- the input type=image automatically sends
> >>along name.x and name.y as cgi parameters. So if you could do what you
> >>want to server side, that's the most reliable and the easiest.
> >>
> >>If you must do it client side, you could do something like this:
> >>var mouseX=0,mouseY=0,setX=0,setY=0;
> >>function getMousemove(e){
> >> mouseX= (bw.ns4||bw.ns6)? e.pageX:
> >> bw.ie&&bw.win&&!bw.ie4? (event.clientX
> >> -2)+document.body.scrollLeft : !bw.opera5?
> >> event.clientX+document.body.scrollLeft :
> >> (event.clientX-2);
> >> mouseY= (bw.ns4||bw.ns6)? e.pageY:
> >> bw.ie&&bw.win&&!bw.ie4? (event.clientY
> >> -2)+document.body.scrollTop : !bw.opera5?
> >> event.clientY+document.body.scrollTop
> >> : (event.clientY-2);
> >>};
> >>
> >>where the bw is browser detection stuff.
> >>
> >>On Mon, Jan 21, 2002 at 11:38:36AM -0500, Doyon, Jean-Francois wrote:
> >>
> >>>Hello,
> >>>
> >>>This is not necessarily a mpaserver specific question but ...
> >>>
> >>>Is there anyway/does anybody know how to intercept the x/y pixel
> >>>
> >>coordinates
> >>
> >>>that the user generated by clicking on the map when using the map as
> >>>
> >>an
> >>
> >>><input type=image> ?
> >>>
> >>>I'm trying to create an interface that uses scale values to determine
> >>>
> >>the
> >>
> >>>next up/down zoom levels, and apparently in order to do this I have to
> >>>
> >>use
> >>
> >>>the CGI variable MAPXY, which unfortunately has to be inn the map's
> >>>projection coordinates.
> >>>
> >>>So, I need to intercept the pixel coordinates (img.x and img.y) in
> >>>
> >>order to
> >>
> >>>do the necessary calculations and set MAPXY, all this triggered by the
> >>>form's onSubmit ...
> >>>
> >>>Anybody have any idea on how to do this? I haven't had any luck so far
> >>>
> >>using
> >>
> >>>things like document.form.img.x ...
> >>>
> >>>If worse comes to worse I guess I could use client-side maps, but I'd
> >>>
> >>rather
> >>
> >>>not unless I absolutely have to!
> >>>
> >>>Thanks in advance for the help!
> >>>
> >>>Jean-Fran?ois Doyon
> >>>Internet Service Development and Systems Support
> >>>GeoAccess Division
> >>>Canadian Center for Remote Sensing
> >>>Natural Resources Canada
> >>>http://atlas.gc.ca
> >>>Phone: (613) 992-4902
> >>>Fax: (613) 947-2410
> >>>
> >>>
> >>>
> >
> >
More information about the MapServer-users
mailing list