iag-geo / bootleaf

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

problem with highlight wmsTiledLayer (line type only) #19

Open bitSurvey opened 5 years ago

bitSurvey commented 5 years ago

hello,

i have try bootleaf for a week and it's look fantastic. one features that i like is highlight objects. I used geoserver and store data using shapefile directory with WMS and WFS service enable. I can use identify and query features too. I can highlight wmsTiledLayer with this code:

"highlightStyle": {
        "weight": 2,
        "opacity": 1,
        "color": 'white',
        "dashArray": '3',
        "fillOpacity": 0.5,
        "fillColor": '#fff32c',
        "stroke": true,
    }

but i dont know why it's only work on point and polygon type of shapefiles and not on line type of shapefiles??.

here is my point and line type on layer config:

{
            "id": "bridge_geo",
            "name": "Bridge",
            "url": "/proxied_geoserver/geoserver/shapefiles_dir/wms",
            "type": "wmsTiledLayer",
            "layers": "bridge_geo",
            "EPSG": 4326,
            "format": "image/png",
            "transparent": true,
            "useCors": true,
            "geomField": "the_geom",
            //"showHighlight": true,
            "maxZoom": 22,
            "showOnTop": true,
            "queryWidget": {
                "queries" : [
            {"name": "bridge_id", "alias": "Bridge Id", "type": "numeric", "defaultOperator": "="}
                ]
            },
            "identify": {
                "layerName": "bridge_geo",
                "layerLabel": "Bridge",
                "primaryField": "bridge_id",
                //"buffer": 10,
                "outFields": [
                {"name": "Id", "hidden": true},
                    {"name": "bridge_id", "alias": "Bridge Id"},
                    {"name": "POINT_X", "alias": "Longitude"},
                    {"name": "POINT_Y", "alias": "Latitude"}
                ],
                "maxAllowableOffset": 0.01
            },
            "outFields": [
                    {"name": "Id", "hidden": true},
                    {"name": "bridge_id", "alias": "Bridge Id"},
            ],
            "visible": false,
    },

{
        "id": "roads_new_geo",
        "name": "Roads",
        "url": "/proxied_geoserver/geoserver/shapefiles_dir/wms",
        "type": "wmsTiledLayer",
        "layers": "roads_new_geo",
        "EPSG": 4326,
        "format": "image/png",
        "transparent": true,
        "useCors": true,
        "geomField": "the_geom",
        //"showHighlight": true,
        "maxZoom": 22,
        //"style": {
        //      "stroke": true,
        //      //"fillColor": "#e31a1c",
        //      //"fillOpacity": 0.5,
        //      "radius": 10,
        //      "weight": 2,
        //      "opacity": 1,
        //      "color": '#e31a1c',
        "queryWidget": {
            "queries" : [
                {"name": "name", "alias": "Road Name", "defaultOperator": "contains"},
            ]
        },
        "identify": {
            "layerName": "roads_new_geo",
            "layerLabel": "Roads",
            "primaryField": "name",
            "outFields": [
                {"name": "name", "alias": "Road Name"},
                {"name": "status", "alias": "Road Stat"},
            ],
            "maxAllowableOffset": 0.01
        },
        "outFields": [
                {"name": "name", "alias": "Road Name"},
                {"name": "status", "alias": "Road Stat"},
            ],
        "visible": false,
}

enable showHighlight to true not given any different.

any help or suggestion please?.

slead commented 5 years ago

I'm glad you find it useful!

I haven't tried highlighting a line layer so I'm not sure why it's not working, sorry. In the demo there is a USA Railways layer that I tried to test this on, and it looks like it has been locked down now, so the layer doesn't work anymore.

I'll see if I can find another line layer to test it on - I'll let you know the outcome.

xorZDrox commented 1 year ago

Hi we are using this great framework but we have the same problem as exposed by BITSURVEY. In on.mouseover we would like the showHighlight function to highlight the geometry. Even forcing the style on queryJSON I don't get a highlight.

slead commented 1 year ago

I haven't looked at Bootleaf for many years, and I'm pretty busy now so won't have a chance to look into it - so unfortunately I don't have any suggestions. Please post back if you find any solutions!

xorZDrox commented 1 year ago

Hello, I'm only answering now that I've had time to solve the problem of highlighting the linestring or Multilinestring layers. In this point of the app.js to the function showHighlight(feature, zoom) it was enough simply to replace in "type" Linestring with MultiLineString. ... } else if (geometryType === 'MultiLineString') { jsonGeometry = { "type": "LineString", "coordinates": [geometry.coordinates[0]] }; } ... Greetings