Hello,<br><br>I have google hybrid as base map, I have some POI's that I store in my own postGIS database that I overlay on top of google base map. I want to attach click mouse handler on POI layer for GetFeatureInfo. Whenever I click the mouse, I don't get any features back. I think it has something to do with projection and mouse location ? ...not quite sure.<br>
<br>Just as an aside, when I view my POI layer using Geoserver's demo functionality, it gets back all features fine, this is reason I think it has something to do with projection that I attach to my mouse handler or something.<br>
<br>here is relevant code:<br><br><html><br><br> <head><br> <title>CIRA GIS</title><br> <script src="<a href="http://openlayers.org/api/OpenLayers.js">http://openlayers.org/api/OpenLayers.js</a>" type="text/javascript"></script><br>
<link rel="stylesheet" href="../css/google.css" type="text/css" /><br> <script src="<a href="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAo2c5r7VgSxo43IHrZeBAoBQamh927W1qenomYTPDD5XN6kDJqBTSmynWaZ9MUgwOTtaOkIJeFZSMjQ">http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAo2c5r7VgSxo43IHrZeBAoBQamh927W1qenomYTPDD5XN6kDJqBTSmynWaZ9MUgwOTtaOkIJeFZSMjQ</a>" type="text/javascript"></script><br>
<br> <script defer="defer" type="text/javascript"><br><br>function setHTML(response){<br> document.getElementById('nodelist').innerHTML = response.responseText;<br>
};<br><br>function init()<br>{<br><br> var options = {<br> projection: new OpenLayers.Projection("EPSG:900913"),<br> displayProjection: new OpenLayers.Projection("EPSG:4326"),<br>
units: "m",<br> numZoomLevels: 30,<br> maxResolution: 156543.0339,<br> maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34),<br>
controls: []<br> };<br><br> var map = new OpenLayers.Map( 'map', options );<br><br> <br> var cira_addresses_layer = new OpenLayers.Layer.WMS(<br> "ACS Addresses",<br>
"localhost:8080/geoserver/wms",<br> {<br> layers: 'cira:addresses',<br> transparent: true<br> },<br> {buffer:0, ratio: 1, transitionEffect: 'resize', isBaseLayer: false}<br>
);<br><br> var ghyb = new OpenLayers.Layer.Google(<br> "Google Hybrid",<br> {sphericalMercator: true, type: G_HYBRID_MAP, numZoomLevels: 20}<br> );<br><br><br> // build up all controls<br>
map.addControl(new OpenLayers.Control.PanZoomBar({ position: new OpenLayers.Pixel(2, 15) }));<br> map.addControl(new OpenLayers.Control.Navigation());<br> map.addControl(new OpenLayers.Control.Scale($('scale')));<br>
map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));<br> map.addControl(new OpenLayers.Control.LayerSwitcher());<br><br> map.events.register('click', map, function (e) {<br>
document.getElementById('nodelist').innerHTML = "Loading... please wait...";<br> var params = {<br> REQUEST: "GetFeatureInfo",<br> EXCEPTIONS: "application/vnd.ogc.se_xml",<br>
BBOX: map.getExtent().toBBOX(),<br> X: e.xy.x,<br> Y: e.xy.y,<br> INFO_FORMAT: 'text/html',<br> QUERY_LAYERS: map.layers[1].params.LAYERS,<br>
FEATURE_COUNT: 50,<br> Layers: 'cira:addresses',<br> Styles: '',<br> Srs: 'EPSG:4326',<br> WIDTH: map.size.w,<br>
HEIGHT: map.size.h,<br> format: 'image/jpeg'};<br> //updateFeatureInfoFilters(params);<br> OpenLayers.loadURL("<a href="http://localhost:8080/geoserver/wms">http://localhost:8080/geoserver/wms</a>", params, this, setHTML, setHTML);<br>
OpenLayers.Event.stop(e);<br> // alert("layer: " + map.layers[1].params.LAYERS);<br> alert("mouse pos: " + e.xy);<br> });<br><br>
map.addLayers([ghyb,cira_addresses_layer]);<br><br> map.zoomToMaxExtent();<br>}<br> </script><br><br> </head><br><br> <body onload="init()"><br> <div style="width:100%; height:100%" id="map"></div><br>
<div id="nodelist"><br> <em>Click on the map to get feature info</em><br> </div><br> </body><br></html><br clear="all"><br><br>Thank you very much !<br>
<br>-- <br>Signed,<br>Alessandro Ferrucci<br>