Hi all,
In edit widget i want to enable all layers snapping, i used this code:
snappingOptions: { // autocasts to SnappingOptions()
enabled: true, // global snapping is turned on
// assigns a collection of FeatureSnappingLayerSource() and enables feature snapping on this layer
featureSources: [{ layer: myFlLayer1, myflLayer2, enabled: true }]
}
but, it des not work.
How can i pass several layers in featureSources?
Thanks
You need to have a collection of FeatureSnappingLayerSource . So with three layers (the second one is not enabled) it might look something like this
featureSources: [{ layer: myFlLayer0, enabled: true }, { layer: myFlLayer1, enabled: false}, { layer: myFlLayer2, enabled: true }]
If you really want to enable snapping on all layers in your map you could probably do something like this but I haven't checked to see if this actually works. I think it should, but you might have to filter the allLayers collection first to just the layer types supported in featureSources
snappingOptions: {
enabled: true,
featureSources: map.allLayers
}
Thank you @Sage_Wall , i see, i did not try to add FLs as objects and map.allLayers i couldn't think about it.
Thanks again