Time for action – intercepting the Click event
If you want to query your GeoServer's WMS, you need to get the latitude and longitude. You can use this example map:
Open
chapter7/index.html
in your favorite browser.Click on the Google lat/lng on click event example.
Open
/chapter7/source/google/geoserver_latlonclickevent/index.html
and/chapter7/source/google/geoserver_latlonclickevent/map.js
.Review the
map.js
file:var map; var geocoder; var overlay; function mapinitialize() { //add all the overlays we want var overlayMaps =[ { // Google Roads layer getTileUrl: function(coord, z) { var x = coord.x % (1 << z); var y = coord.y; return "http://mt0.google.com/vt/v=apt.116&hl=en-US&x=" + x + "&y=" + y + "&z=" + z + "&src=apiv3&s=G&lyrs=r&apistyle=s.t:33|p.v:off&apistyle=s.t:49|s.e:l|p.v:on|p.l:50|p.s:24,s.t:5|p.v:off,s.t:6|p.v:off,s.t:1|p.v:off,s.t:5|p.v:off,s.t:2|p.v:off" ...