[OpenLayers-Users] Question about GML/WFS compatibility and Styling

Christopher Schmidt crschmidt at metacarta.com
Wed Aug 12 21:46:08 EDT 2009


On Wed, Aug 12, 2009 at 03:57:23PM -0700, Aaron_Gundel at sjwater.com wrote:
> Hello,
> 
> I am fairly new to the vector layers within openlayers and I had a 
> question about their usage.  I'm trying to use the gml layer to display 
> data from a wfs.  (If you're wondering why I'm not using the wfs layer, 
> it's because I couldn't find a method to change the wfs url and reload the 
> layer in the wfs layer -- whereas such a method exists within the gml 
> layer, seturl).  It's not working.  I'm using geoserver for the wfs and 
> getting a single feature which I want to display in the gml layer.  I 
> don't know if this is just some inherent incompatibility or if I'm not 
> styling the gml layer properly (I've been experimenting with points that 
> are being retrieved through the wfs.) 
> 
>   var style = new OpenLayers.Style();
>   var rule = new OpenLayers.Rule(
>   {
>        symbolizer: {pointRadius: 10, fillColor: "green", fillOpacity: 0.5, 
> strokeColor: "black"}
>   });
>   style.addRules([rule]);
>   var gmlLayer = new OpenLayers.Layer.GML("GML","http://mywfscall/wfs",
>           {styleMap:new OpenLayers.StyleMap(style)});
>   return gmlLayer;
> 
> Anyway, I've confirmed that my wfs call is definitely returning gml -- I 
> just can't get it to display.  Can anyone help me out here?

is your HTML page hosted at http://mywfscall/htmlpage.html? That is, does it
share the same origin -- protocol (http), domain (mywfscall), port (80)?

If not, then you are violating the same origin policy, and need to set up
a proxy: 

  http://faq.openlayers.org/proxyhost/all/


Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list