[OpenLayers-Users] Cannot see WFS layer

Lammie Jonson jrubiando at gmail.com
Thu Dec 10 11:17:16 EST 2009


I think you have to use a proxy because that's how WFS works, that will end
up making any request you use through openlayers go through a proxy also. I
am sort of new to openlayers as well and just figure stuff out from their
examples and experimentation. I just plug in urls in openlayers to my rails
server and then see what kinds of requests openlayers sends out that come
out in the console or log and try to figure out how to handle them etc. They
have some examples on the proxy. I think they have a perl cgi example. What
is your web server ? Are you use PHP, Java, etc ?

On Wed, Dec 9, 2009 at 4:04 AM, Damith Amarasena
<amarasenadamith at gmail.com>wrote:

> Hi Lammie,
>
> Thanks for your reply. You have mentioned about a proxy here. Does that
> mean I have to use one? Sorry if you feel this as a dumb question, but I'm
> new to openlayers and whole GIS stuff. Please guide me on this.
>
> Regards,
> damith
>
> On Wed, Dec 9, 2009 at 2:02 AM, Lammie Jonson <jrubiando at gmail.com> wrote:
>
>> //   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
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091210/3fdbb36e/attachment.html


More information about the Users mailing list