I have 3 d3 svgs. I want to place the same booklet card. I would like to be able to control them with the same ease as the layers of a booklet.
Here is the code that works , but janky.
The corresponding part is lines 75 to the end, where I create a custom level control, tied specifically to my d3 svg group, create an instance of it and put it in the overlay hashes before adding (map).
var lineLayer = L.Class.extend({
initialize: function () {
return;
},
onAdd: function (map) {
railLineGroup.style("display", "block");
},
onRemove: function (map) {
railLineGroup.style("display", "none");
},
});
var railLineLayer = new lineLayer();
overlays["Rail Lines"] = railLineLayer;
L.control.layers(baseLayers, overlays).addTo(map);
There must be a better way to do this. For example, since this is a hack, the level control does not know that this layer is already activated, so the check box is not selected.
Any help would be greatly appreciated!