[Geomoose-users] Displaying google layers and Geomoose popups- GM2.2
FRANZ OKYERE
franzzoa at hotmail.com
Sun Sep 4 17:31:25 EDT 2011
Hi all,
Can someone help me comment the right lines- in either geoomoose.html or mapbook.xmlis out as I am not able to get the onclick event to work and still have my google layers as the background.
<script type="text/javascript" src="http://maps.google.com.gh/maps?file=api&v=2&key=ABQIAAAAnfs7bKE82qgb3Zc2YyS-oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27OwgbtyR3VcA"></script>
<script type="text/javascript" src="OpenLayers-2.8/OpenLayers.js"></script>
<script type="text/javascript" src="compiled.js"></script>
<script type="text/javascript" src="python/all_js.py"></script>
<script type="text/javascript" src="php/all_js.php"></script>
When I turn off the google layers in mapbook (<layer title="Streets" src="google_streets/all" status="off"/>) I can get the javascript onclick event (in compiled.js as shown below) working for my popup to show up. I cannot have google layer at the background and still have the onclick event to trigger my popup which is actually an identify in disguise.
/*#######Courtesy Len Kne Hover to show popup myHoverHandler#######*/
// Hover support on WMS and MapServr layers
var popup;
OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
defaultHandlerOptions: {
'delay': 500,
'single': true,'double': false,'pixelTolerance': 0,'stopSingle': false,'stopDouble': false
},
initialize: function(options) {
this.handlerOptions = OpenLayers.Util.extend(
{}, this.defaultHandlerOptions
);
OpenLayers.Control.prototype.initialize.apply(
this, arguments
);
this.handler = new OpenLayers.Handler.Click(
this,
this, { 'click': this.onClick, 'dblclick': this.onDblclick }, this.handlerOptions
);
},
onClick: function(evt) {
var feature = Map.getLonLatFromPixel(evt.xy);
var url = 'http://localhost/geomoose2i/php/identify2.php?';
var layersArray = GeoMOOSE.getVisibleLayers();
layers = layersArray.join(':');
var requestOptions = OpenLayers.Request.GET({
url: url,
params: {'shape': 'POINT(' + feature.lon + ' ' + feature.lat + ')',
'layers': layers,
'_moosetime': (new Date()).getTime() },
async: false
});
//Clear Popup is any beforeclearPopups();
if(requestOptions.responseText) {
popup = new OpenLayers.Popup.FramedCloud("wms",
Map.getLonLatFromPixel(evt.xy),
null,
requestOptions.responseText,
null, true);//Fonzi//if(popup != null) {Map.addPopup(popup);
// }}
}
});
click = new OpenLayers.Control.Click();
Map.addControl(click);
click.activate();
/*###### End of hoverhandler stuff.
Franz
GIS Specialist.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20110904/54af7882/attachment.html
More information about the Geomoose-users
mailing list