import { Map, Control, DomUtil } from 'leaflet'; import { Editable, EditOptions } from 'leaflet-draw';
public editOptions: EditOptions = { featuresLayer: null, edit: { featureGroup: null } };
this.map = new Map('map', {center: [40, -86], zoom: 4}); this.map.addControl(new Control.Draw({ edit: { featureGroup: Editable(this.map, this.editOptions), poly: {allowIntersection: false} }, draw: { polyline: {guideLayers: [this.routeLayer]}, polygon: {allowIntersection: false}, rectangle: {showArea: true}, circle: {showRadius: true}, marker: {}, circlemarker: {} } }));
this.editOptions.featuresLayer = L.layerGroup().addTo(this.map);
let featureGroup = this.editOptions.edit.featureGroup; featureGroup.addLayer(L.geoJSON(data)); featureGroup.editLayer(L.geoJSON(data).getLayers()[0]);