[MapProxy] Unable to use OpenLayers.ProxyHost for protocol:
OpenLayers.Protocol.WFS.fromWMSLayer(layer)
vinod sharma
veenu22sharma at yahoo.com
Fri Dec 24 04:32:32 EST 2010
Hello all
I am a new bee in open source development, for learning i start with the basic
examples. I download the proxy.cgi, change it to proxy.py (Working with IIS),
implemented each and every step on net. but I am unable to use proxy.py. when i
check manually (http://localhost:80/proxy.py) it is giving
Some unexpected error occurred. Error text was: <urlopen error (10061,
'Connection refused')>
Iam using my college internet for this, which may contain firewalls. I kno it is
a TCP/IP error.
My Question is can we use localhost as the proxy server.
below is my code, Thanks for any help in advance. As it keep my interest in Open
source development
& learning
I try calling WMS from both Geoserver on http://localhost:85 & from remote WMS
also.
code:
<head>
<link rel="stylesheet" href="../OpenLayers-2.10/theme/default/style.css
type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<title>WFS: GetFeature Example (GeoServer)</title>
<script type="text/javascript">
var map, layer, select, hover, control;
function init(){
OpenLayers.ProxyHost= "/cgi-bin/proxy.py?url=";
map = new OpenLayers.Map('map', {
controls: [
new OpenLayers.Control.PanZoom(),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.Navigation()
]
});
layer = new OpenLayers.Layer.WMS(
"States WMS/WFS",
"http://v2.suite.opengeo.org/geoserver/ows",
{layers: 'usa:states', format: 'image/gif'}
);
layer2 = new OpenLayers.Layer.WMS( "India ",
"http://localhost:8080/geoserver/wms",
{ "layers": "india_gc:ind_g_polygon",
"format": "image/png",
"version": "1.1.1",
"transparent": "TRUE",
"SLD_BODY": theSLD_BODY
});
select = new OpenLayers.Layer.Vector("Selection", {styleMap:
new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
});
hover = new OpenLayers.Layer.Vector("Hover");
map.addLayers([layer, hover, select]);
control = new OpenLayers.Control.GetFeature({
protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer),
box: true,
hover: true,
multipleKey: "shiftKey",
toggleKey: "ctrlKey"
});
control.events.register("featureselected", this, function(e) {
select.addFeatures([e.feature]);
});
control.events.register("featureunselected", this, function(e) {
select.removeFeatures([e.feature]);
});
control.events.register("hoverfeature", this, function(e) {
hover.addFeatures([e.feature]);
});
control.events.register("outfeature", this, function(e) {
hover.removeFeatures([e.feature]);
});
map.addControl(control);
control.activate();
map.setCenter(new
OpenLayers.Bounds(-140.444336,25.115234,-44.438477,50.580078).getCenterLonLat(),
3);
}
</script>
</head>
<body onload="init()">
<h1 id="title">WFS GetFeature Example (GeoServer)</h1>
<div id="tags">
WFS, GetFeature
</div>
<p id="shortdesc">
Shows how to use the GetFeature control to select features from a WMS layer.
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
<p>
click
</p>
</div>
</body>
</html>
</div>
--
With Regards
veenu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapproxy/attachments/20101224/04c84187/attachment.html
More information about the MapProxy
mailing list