I changed the URL but still get this response:<br><br><span class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch opened"><b>OpenLayers.Protocol.WFS is not a constructor<br></b><br> map.addLayer(new OpenLayers.Layer.Vector("Gravminne", {<br>
strategies: [new OpenLayers.Strategy.BBOX()],<br> protocol: new OpenLayers.Protocol.WFS({<br> url: "<a href="http://naturkart.no:8080/geoserver/wfs&request=getmap">http://naturkart.no:8080/geoserver/wfs&request=getmap</a>",<br>
typeName: "gravminne",<br> featurePrefix: "kulturminner_ns"<br> })<br> }));<br><br>/asle<br><br></span><div class="gmail_quote">2009/3/28 Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">add &request=getmap to your url.<br>
<br>
Regards,<br>
andreas.<br>
<div><div></div><div class="h5"><br>
On 3/28/09, Asle Benoni <<a href="mailto:asle.benoni@gmail.com">asle.benoni@gmail.com</a>> wrote:<br>
> Hello,<br>
> I tried the new WFS code but I still get this response:<br>
><br>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE<br>
> ServiceExceptionReport SYSTEM "http:<br>
> //<a href="http://schemas.opengis.net/wms/1.1.1/WMS_exception_1_1_1.dtd" target="_blank">schemas.opengis.net/wms/1.1.1/WMS_exception_1_1_1.dtd</a>"><br>
> <ServiceExceptionReport version="1.1.1" ><br>
> <ServiceException code="MissingParameterValue" locator="request"><br>
> Could not determine geoserver request from http request<br>
> org.apache.catalina.connector.RequestFacade<br>
> @10f829<br>
> </ServiceException></ServiceExceptionReport><br>
><br>
><br>
> I wonder if this WFS call can give me what I want with a KML response. I<br>
> want to be able to click on the location and a popup with a style for the<br>
> popup, show a picture, a link etc. fetched from the PostgreSQL table.<br>
><br>
> /asle<br>
><br>
> 2009/3/27 Andreas Hocevar <<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>><br>
><br>
>> Hi,<br>
>><br>
>> On Thu, Mar 26, 2009 at 5:08 PM, Asle Benoni <<a href="mailto:asle.benoni@gmail.com">asle.benoni@gmail.com</a>><br>
>> wrote:<br>
>> > I am really frustrated about not beeing able to display a kmz layer in<br>
>> > OpenLayers.<br>
>> > Here is the code:<br>
>> ><br>
>> > map.addLayer(new OpenLayers.Layer.GML("Gravminne", "<br>
>> <a href="http://naturkart.no:8080/geoserver/wms/kml?layers=kulturminner_ns:gravminne&format=application/vnd.google-earth.kml+XML&transparent=true&srs=EPSG:4326&transparent=true&" target="_blank">http://naturkart.no:8080/geoserver/wms/kml?layers=kulturminner_ns:gravminne&format=application/vnd.google-earth.kml+XML&transparent=true&srs=EPSG:4326&transparent=true&</a><br>
>> > ",<br>
>> > {<br>
>> > format: OpenLayers.Format.KML,<br>
>> > formatOptions: {<br>
>> > extractStyles: true,<br>
>> > extractAttributes: true,<br>
>> > transparent:true<br>
>> > }<br>
>> > }));<br>
>><br>
>> The geoserver url you are using here will always return KMZ, which<br>
>> OpenLayers cannot parse. Instead, you should use the following to<br>
>> create your layer:<br>
>><br>
>> map.addLayer(new OpenLayers.Layer.WFS("Gravminne",<br>
>> "<br>
>> <a href="http://naturkart.no:8080/geoserver/wms?service=WMS&request=GetMap&layers=kulturminner_ns:gravminne&format=kml&srs=EPSG:4326" target="_blank">http://naturkart.no:8080/geoserver/wms?service=WMS&request=GetMap&layers=kulturminner_ns:gravminne&format=kml&srs=EPSG:4326</a><br>
>> ",<br>
>> {<br>
>> format: OpenLayers.Format.KML,<br>
>> formatOptions: {<br>
>> extractStyles: true,<br>
>> extractAttributes: true<br>
>> }<br>
>> }));<br>
>><br>
>> Is there a specific reason why you want to use KML? WFS would give<br>
>> you the same result, you would only have to use a style map for your<br>
>> symbology in addition. This is how to add the layer using the new WFS<br>
>> protocol:<br>
>><br>
>> map.addLayer(new OpenLayers.Layer.Vector("Gravminne", {<br>
>> strategies: [new OpenLayers.Strategy.BBOX()],<br>
>> protocol: new OpenLayers.Protocol.WFS({<br>
>> url: "<a href="http://naturkart.no:8080/geoserver/wfs" target="_blank">http://naturkart.no:8080/geoserver/wfs</a>",<br>
>> typeName: "gravminne",<br>
>> featurePrefix: "kulturminner_ns"<br>
>> })<br>
>> ));<br>
>><br>
>> For the symbology, you can use OpenLayers.Format.SLD to use a sld file<br>
>> that you already have on your server. Look at examples/SLD.html to see<br>
>> how to configure this.<br>
>><br>
>> And you need OpenLayers.ProxyHost configured with a working proxy url.<br>
>><br>
>> If a map image rendered on the server would also do, you could just<br>
>> use a WMS layer, and don't even need a ProxyHost:<br>
>><br>
>> map.addLayer(new OpenLayers.Layer.WMS("Gravminne";<br>
>> "<a href="http://naturkart.no:8080/geoserver/wms" target="_blank">http://naturkart.no:8080/geoserver/wms</a>?", {<br>
>> transparent: true,<br>
>> layers: "kulturminner_ns:gravminne"<br>
>> }));<br>
>> }<br>
>><br>
>> > I can see the http request from the proxy so it is fetching correct<br>
>> > data (I think) but I cannot see any on the map!<br>
>> > The request looks like this (FireBug). I am not sure if the EPSG is<br>
>> > correct. I also tried "EPSG:32632" which I set for the map.<br>
>><br>
>> With the WFS setup above (first of my code snippets), the data should<br>
>> be automatically reprojected to the SRS of your map.<br>
>><br>
>> > Can anyone point to how to show a KMZ file from GeoServer as I need<br>
>> > the options for that layer format. I checked the docs but did not get<br>
>> > wiser.<br>
>><br>
>> As already said, OpenLayers can not parse KMZ, only KML. To make<br>
>> GeoServer output KML, your request would have to be a WMS request and<br>
>> look like this:<br>
>><br>
>><br>
>> <a href="http://naturkart.no:8080/geoserver/wms/?service=wms&request=GetMap&layers=kulturminner_ns:gravminne&format=application/vnd.google-earth.kml+XML&format=kml&bbox=0,0,180,90&width=500&height=250&srs=EPSG:4326" target="_blank">http://naturkart.no:8080/geoserver/wms/?service=wms&request=GetMap&layers=kulturminner_ns:gravminne&format=application/vnd.google-earth.kml+XML&format=kml&bbox=0,0,180,90&width=500&height=250&srs=EPSG:4326</a><br>
>><br>
>> This is what will get generated with the second of my code snippets above.<br>
>><br>
>> Regards,<br>
>> Andreas.<br>
>><br>
>> --<br>
>> Andreas Hocevar<br>
>> OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
>> Expert service straight from the developers.<br>
>><br>
><br>
<br>
</div></div><font color="#888888">--<br>
Sent from my mobile device<br>
</font><div><div></div><div class="h5"><br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
</div></div></blockquote></div><br>