iag-geo / bootleaf

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

service geoJSON from geoserver #30

Closed ed5on closed 4 years ago

ed5on commented 4 years ago

Hello, how can I add a geoJSON or jsonp layer from geoserver (ows service) and not from files. For example this url: geoJSON

slead commented 4 years ago

The recommended approach for this is shown in the config file under World countries (WFS).

Unfortunately since the demo config file was published, the world countries layer has been removed from https://demo.boundlessgeo.com so the layer doesn't actually work, but hopefully you can figure out the pattern from the config file.

ed5on commented 4 years ago

Thanks for the reply, I tried to add a WFS layer from [URL]( https: //demo.geo-solutions.it/geoserver/unesco/ows? Service = WFS & version = 1.0.0 & request = GetFeature & typeName = unesco: Unesco_point & maxFeatures = 50 & outputFormat = application% 2Fjson), and returns Cross-Origin Read Blocking (CORB) blocked cross-origin per console, when opening the console url there are only these empty data:

{" type ":" FeatureCollection "," totalFeatures ": 0," features ": []," crs ": null}.

My code in config.js is:

{
    "id": "countries",
    "name": "World countries (WFS)",
    "type": "WFS",
    "url": "https://demo.geo-solutions.it/geoserver/unesco/ows",
    "typeName": "unesco:Unesco_point",
    "visible": false,
    "popup": true,
    "outputFormat": "application/json",
    "geomField": "the_geom",
    "outFields": [
        { "name": "cod_unesco", "alias": "Name" },
        { "name": "sito", "alias": "Economy" },
    ]
}
ed5on commented 4 years ago

Solved! It returned empty data because the projection was different, I am using EPSG: 32719. In geoserver I had to reproject the layer to EPSG: 4269, attached configuration capture. image

slead commented 4 years ago

Thanks for the update, I'm glad you got it working. Feel free to update the sample config.js file with a working WFS layer if you have the time - I'm too busy to look into it at the moment, unfortunately.

slead commented 4 years ago

@ed5on I added an enhancement request https://github.com/iag-geo/bootleaf/issues/31 to fix the broken sample WFS layer - feel free to update this if you have a chance. Thanks