Hello,<br>I tried the new WFS code but I still get this response:<br><pre><?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http:<br>
//<a href="http://schemas.opengis.net/wms/1.1.1/WMS_exception_1_1_1.dtd">schemas.opengis.net/wms/1.1.1/WMS_exception_1_1_1.dtd</a>"> <ServiceExceptionReport version="1.1.1" > <br> <ServiceException code="MissingParameterValue" locator="request"><br>
Could not determine geoserver request from http request org.apache.catalina.connector.RequestFacade<br>@10f829<br></ServiceException></ServiceExceptionReport><br></pre><br>I wonder if this WFS call can give me what I want with a KML response. I want to be able to click on the location and a popup with a style for the popup, show a picture, a link etc. fetched from the PostgreSQL table.<br>
<br>/asle<br><br><div class="gmail_quote">2009/3/27 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;">
Hi,<br>
<div class="im"><br>
On Thu, Mar 26, 2009 at 5:08 PM, Asle Benoni <<a href="mailto:asle.benoni@gmail.com">asle.benoni@gmail.com</a>> 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", "<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>
</div>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>
"<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>
<div class="im"> {<br>
format: OpenLayers.Format.KML,<br>
formatOptions: {<br>
extractStyles: true,<br>
extractAttributes: true<br>
}<br>
</div> }));<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>
<div class="im">}));<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>
</div>With the WFS setup above (first of my code snippets), the data should<br>
be automatically reprojected to the SRS of your map.<br>
<div class="im"><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>
</div>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>
<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>
<font color="#888888"><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>
</font></blockquote></div><br>