[OpenLayers-Users] OpenLayers.ProxyHost = '/geoserver/rest/proxy?url=';

Morper-Busch, Lucia Lucia.Morper-Busch at sbg.ac.at
Wed Jul 13 10:55:38 EDT 2011


Hello!
I want to query local and remote feature information for WMS layers.
I have a server on which stays a javascript/html map viewer with ExtJs and Openlayers, in the back runs a Geoserver 2.0.2.
I installed the Geoserver Proxy Extension on my server to access also a remote server.
On my server the html file is in the C:\Program Files\GeoServer 2.0.2\webapps\geoserver folder.
I added two hosts (without port) to the permitted hostnames: the server localhost (but with the server address not 'localhost') and a remote server host (IP address) where another geoserver is running.
When I try to access the html map viewer from another PC the getfeatureinfo request requires an authentification (the geoserver username and password). And only the first host on that I try to ask the feature information gives me an reply, the other host is not responding. But when I begin with the other host it's the other way round. Like random.
When I insert the url in the browser address box (http://serverhost:8080/geoserver/rest/proxy?url=getfeatureinfo-request) I have to authentificate!
On the server the getfeatureinfo request works without authentification, but that's not intended.
Without proxyhost I get only the feature information for the layers that are local.
I tried also OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; But the response is only the plain text of the cgi file.
Who's familiar with proxy and local/remote WMS layers?
Thank you for suggestions
Lucia

Dipl.-Geogr. Lucia Morper-Busch | Researcher
University of Salzburg | Centre for Geoinformatics - Z_GIS
Schillerstr.30 | Techno-Z, Block 15, 3rd floor | 5020 Salzburg, Austria
Phone +43 (0)662 8044 5298 | Fax +43 (0)662 8044 5260
> Z_GIS...experts for the spatial view

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Bryan Hempen
Gesendet: Samstag, 09. Juli 2011 23:42
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] WFS getFeature with Filter resulting in InternalServer Error

Hey!

I am trying to use the example at 
http://openlayers.org/dev/examples/wfs-spatial-filter.html with my own 
WFS (UMN Mapserver) but I am having a hard time getting some problems 
fixed. When I load my test page for the first time OpenLayers sends the 
following request:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" 
version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
<wfs:Query typeName="omega">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates decimal="." cs="," ts=" ">135.45,-47.425 
157.95,-36.175</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

I get a valid response and the data is properly displayed on the map. 
When, however, I try to use a spatial filter in the request, like this...

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" 
version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd">
<wfs:Query xmlns:ms="http://mapserver.gis.umn.edu/mapserver" 
typeName="ms:omega">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:And>
<ogc:Intersects>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" 
">142.28349609375,-40.5255859375 142.2615234375,-43.49189453125 
148.1501953125,-44.15107421875 149.40263671875,-39.44892578125 
142.28349609375,-40.5255859375</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogc:Intersects>
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates decimal="." cs="," ts=" ">135.45,-47.425 
157.95,-36.175</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:And>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

... one of the two following things will happen:

1. I get a "Internal Server Error  The server encountered an internal 
error or misconfiguration and was unable to complete your request." The 
logfile says "Premature end of script headers: mapserv.exe, referer: 
http://localhost/".

2. This is the response:

<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" 
xmlns:ms="http://mapserver.gis.umn.edu/mapserver" 
xmlns:gml="http://www.opengis.net/gml" 
xmlns:ogc="http://www.opengis.net/ogc" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.opengis.net/wfs 
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd 
http://mapserver.gis.umn.edu/mapserver 
http://localhost/cgi-bin/mapserv.exe?map=E:/ms4w/Apache/htdocs/mapservertest/wfs.map&amp;SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=ms:omega&amp;OUTPUTFORMAT=XMLSCHEMA"> 

<gml:boundedBy>
<gml:Box srsName="EPSG:4326">
<gml:coordinates>-1.000000,-1.000000 -1.000000,-1.000000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
</wfs:FeatureCollection>

Which one of the two possibilities happens appears to be random. I am 
using the proxy.cgi and when I run http://localhost/cgi-bin/proxy.cgi I 
see the OpenLayers website. Any ideas?

This is how my wfs-spatial-filter.js looks like:

OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url=";

.....

var layer = new OpenLayers.Layer.Vector("WFS", {
     strategies: [new OpenLayers.Strategy.BBOX()],
     protocol: new OpenLayers.Protocol.WFS({
         url:  
"http://localhost/cgi-bin/mapserv.exe?map=E:/ms4w/Apache/htdocs/mapservertest/wfs.map",
         featureType: "omega",
         featurePrefix: "ms"
     })
});

....

The rest of the file looks exactly like in the example at 
http://openlayers.org/dev/examples/wfs-spatial-filter.js

Thanks for your help!

Bryan

_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list