iag-geo / bootleaf

An open-source version of IAG's Bootleaf fork
https://demo.bootleaf.xyz
MIT License
88 stars 65 forks source link

WFS layer URLs from local Geoserver #2

Closed adolmajian closed 6 years ago

adolmajian commented 6 years ago

What is the proper way to load a WFS layer from Geoserver? I don't know if I'm inputting the urls incorrectly or if something else is wrong. I'm running Geoserver locally.

This is a great project! Thank you and keep it up!

slead commented 6 years ago

Cool, I'm really glad you like it!

If you look in the sample config file at https://github.com/iag-geo/bootleaf/blob/master/config.js there is an example WFS layer coming from a publicly-accessible GeoServer - search for wfs and it's the US Population layer. That demonstrates the syntax to use for a WFS layer coming from GeoServer, which is the only type of WFS layer that I've actually tested.

Since you're running GeoServer locally there may be cross-origin / CORS issues, which I'm definitely not an expert in but have encountered too. In my case I run nginx as a reverse-proxy, allowing the Bootleaf map to access those layers.

In my nginx.conf file I specify that I want to proxy_pass http://localhost:80, so that when I visit http://localhost:8080 it's actually displaying the contents of port 80. Then I specify the geoserver URL in the nginx.conf file:

        location / {
           proxy_pass http://localhost:80/;
        }
        location /my_geoserver/ {
           proxy_pass http://localhost:8080/geoserver/;
        }

then within the Bootleaf config.js I refer to the local geoserver using the location specified in the nginx.conf file:

    "id": "layer_id",
    "type": "WFS",
    "url": '/my_geoserver/wfs',

I hope this helps - let me know if not.

adolmajian commented 6 years ago

Thank you for the response Stephen.

I'm running WAMP with local Geoserver but I think I'm not setting up the WFS correctly in Geoserver. I'm sticking with GeoJSON for now.

slead commented 6 years ago

to validate the WFS you could try opening a known working layer (eg search for "population" at https://demo.geo-solutions.it/geoserver/web/wicket/bookmarkable/org.geoserver.web.demo.MapPreviewPage?1) and see the WFS preview response, then compare that to your own server's output. Good luck with it

ryantich commented 3 years ago

What is the proper way to load a WFS layer from Geoserver? I don't know if I'm inputting the urls incorrectly or if something else is wrong. I'm running Geoserver locally.

This is a great project! Thank you and keep it up!

Hi @adolmajian did you ever succeed with the wfs layer from GeoServer?