Intercepting clicks: DHTML Mapserver (landview) style interface

Martin Hoegh mh at SVAJ.DK
Fri Feb 3 03:13:05 EST 2006


Hi,
The trick is to catch the x,y pixel coords from the user click on the
mapserver generated map image, translate them into world coords of the
projection you are using (or lat/lon) and then generate a sql and fire that
against the database server. This is the approach which the dhtml interface
called AppForMap on mapuse.net is using. It uses a small javascript called
libs/getClickPosition.js (in the cvs tree) to insure cross browser support
for the click. The sql query and all the coord translating stuff are done on
the server using php.

There is actually no need for asynchronous HTML voodoo, you could reload the
whole page for every click, but in these AJAX times this is not considered
cool. So therefore AppForMap also support asynchronous javascript and xml in
the next version, which I believed is to be released this weekend.

/martin



More information about the mapserver-users mailing list