Я интегрировал карту листовок в angular с помощью ngx-leaflet. На этой карте я наложил от 4 до 5 слоев (например, инциденты, вмешательства, черные пятна, регионы). Я хочу, чтобы первый оверлей (то есть инциденты) был отмечен как отмеченный. Мой код .html: -
`<div *ngIf="dataLoaded" class="map records-map" leaflet leafletDraw [leafletOptions]="options"
[leafletLayersControl]="layersControl" [leafletDrawOptions]="drawOptions"
(leafletMapReady)="onMapReady($event)" [leafletLayers]="layers1"></div>`
Мой код .ts: -
this.layersControl = {
baseLayers: {
'STREETS': this.streetMaps,
'SATELLITE': this.wMaps
},
overlays: {
'INCIDENTS': new L.LayerGroup(this.layers1),
'INTERVENTIONS': new L.LayerGroup(this.layers2),
'HEATMAP': circle([46.95, -122], { radius: 5000 }),
'BLACKSPOTS': this.route,
'CITY/PROVINCE': geoJSON(result1, options1),
'REGIONS': geoJSON(result2, options),
}
};
// Set the initial set of displayed layers (we could also use the leafletLayers input binding for this)
this.options = {
layers: [this.streetMaps],
zoom: 6,
center: latLng([this.lat,this.long])
};