leaflet-control-orderlayers icon indicating copy to clipboard operation
leaflet-control-orderlayers copied to clipboard

geoJson

Open pawaelus opened this issue 9 years ago • 3 comments

Is it possible to add geojson layer? It works in L.control.layers but in orderlayers I can display only wms layer.

pawaelus avatar Jul 29 '15 19:07 pawaelus

Could you provide more info. An example jsfiddle or plunk?

elesdoar avatar Jul 29 '15 19:07 elesdoar

I would like to add a few geojson layers and OSM buildings (with geojson file prepered by me) orderlayers control. code:

            var test = {
                        "type": "FeatureCollection",
                        "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },

                        "features": [
                        { "type": "Feature", "properties": { "id": 1 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 19.372517706874817, 51.870462293195203 ], [ 19.383449140566622, 51.875994346866371 ], [ 19.383449140566622, 51.875994346866371 ], [ 19.393753360849885, 51.874002885944066 ], [ 19.393753360849885, 51.874002885944066 ], [ 19.40629762902082, 51.870849559104272 ], [ 19.401907135160997, 51.852035647775509 ], [ 19.37153208580424, 51.855743717478589 ], [ 19.365259951718777, 51.862992941183535 ], [ 19.372517706874817, 51.870462293195203 ] ] ] } },
                        { "type": "Feature", "properties": { "id": 3 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 19.434791038151932, 51.868249281169724 ], [ 19.430042136630082, 51.848659378281077 ], [ 19.414899412909456, 51.850098474938363 ], [ 19.414451403331928, 51.865261542203768 ], [ 19.434791038151932, 51.868249281169724 ] ] ] } }
                        ]
                        };

            var myStyle = {
                            "color": "#ff7800",
                            "weight": 5,
                            "opacity": 0.65
                        };

            var json = new L.geoJson(test, {style: myStyle});   


            var osmb = new OSMBuildings(map).set(geoJSON).style({wallColor:'#815f33', roofColor:'#9f6a39'});

            L.control.orderlayers(baseLayers, {"ZGR_hybryda": ZH, "Budynki 3D": osmb, "json": json},{collapsed: false, order: 'qgis', title: 'Warstwy'}).addTo(map);
            L.control.layers(baseLayers, {"ZGR_hybryda": ZH, "Budynki 3D": osmb, "json": json, },{collapsed: false, opacity: true}).addTo(map);          

and pics: orderlayer

pawaelus avatar Jul 30 '15 08:07 pawaelus

I have the same problem with GeoJson that pawaelus. Can you tell me if you have solved the issue in the pluggin or which solution is used to solved it.

LovisaSandrine avatar Dec 09 '15 10:12 LovisaSandrine