[OpenLayers-Users] Cannot see WFS layer
Lammie Jonson
jrubiando at gmail.com
Tue Dec 8 15:32:09 EST 2009
// Here's is how I did this.
// You need to use the openlayers proxy:
OpenLayers.ProxyHost="proxy.cgi?url=";
// WFS layer points to geoserver or your host
state_layer = new OpenLayers.Layer.WFS( "States WFS",
"http://yourhost:8080/geoserver/wfs",
{ typename: 'topp:states'} );
===============
I'm using rails, so I create a sort of fake proxy in config/routes.rb
map.connect '/proxy.cgi',
:controller => 'wfs',
:action => 'myproxy'
Then inside the myproxy() action:
if url =~ /geoserver/
# geo server WFS data
uri = URI.parse(url)
resp = Net::HTTP.get_response(uri)
send_data(resp.body, :type => 'text/xml')
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091208/22ffbd19/attachment.html
More information about the Users
mailing list