I'm with geoserver on my local machine running on port 8080 on jetty which is standard in windows installer. I want to use my GetFeatureInfo WMS layers, but I have the following questions:
I need to configure proxyHost even being on my local machine?
Can I use ProxyHosto GeoServer running with Jetty as the default installation for WindosEstou with geoserver on my local machine running on port 8080 on jetty which is standard in windows installer. I want to use my GetFeatureInfo WMS layers, but I have the following questions:
I need to configure proxyHost even being on my local machine?
Can I use ProxyHosto with GeoServer running on Jetty as is standard for Windows installation or do I have to install it in Tomcat?
This is my code, when I click is carrying too much time and nothing appears:
** EDITED CODE **
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<title>My OpenLayers Map</title>
<script type='text/javascript' src='OpenLayers.js'></script>
<script type='text/javascript'>
OpenLayers.ProxyHost = "proxy.cgi?url=";
var map;
function init() {
var bounds = new OpenLayers.Bounds(
-51.280762, -30.241074,
-51.020828, -29.969619
);
var options = {
controls :[new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoom()],
maxExtent: bounds,
maxResolution: 0.00106037109375,
projection: "EPSG:4326",
units: 'degrees'
};
map = new OpenLayers.Map('map_element', options);
var wms = new OpenLayers.Layer.WMS(
"Paradas de ônibus",
"http://localhost:8080/geoserver/wms?",
{
layers: 'Teste:Stops',
isBaseLayer: false,
styles : '',
format :"image/jpeg"
}
);
map.addLayers([wms]);
//GetFeatureInfo Simples
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost:8080/geoserver/wms?',
title: 'Identify features by clicking',
queryVisible: true,
eventListeners: {
getfeatureinfo: function(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
}
}
});
map.addControl(info);
info.activate();
var point = new OpenLayers.LonLat(-51.22,-30.08);
point.transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject());
map.setCenter(point, 3);
map.addControl(new OpenLayers.Control.LayerSwitcher({}));
if(!map.getCenter()){
map.zoomToMaxExtent();
}
}
</script>
</script>
</head>
<body onload='init();'> <!-- Chama a função js init() -->
<!--Elemento HTML onde o mapa é exibido -->
<div id='map_element' style='width: 800px; height: 800px;'>
</div>
</body>
</html>