Skip to content

Commit

Permalink
fix(export): bug when cluster datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Jan 27, 2020
1 parent 84348f1 commit a36648e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { MessageService, LanguageService } from '@igo2/core';

import { Feature } from '../../feature/shared/feature.interfaces';
import { IgoMap } from '../../map/shared/map';
import { ClusterDataSource } from '../../datasource/shared/datasources/cluster-datasource';
import { Layer } from '../../layer/shared/layers/layer';
import { VectorLayer } from '../../layer/shared/layers/vector-layer';

Expand Down Expand Up @@ -80,7 +81,10 @@ export class ImportExportComponent implements OnDestroy, OnInit {
handleExportFormSubmit(data: ExportOptions) {
this.loading$.next(true);
const layer = this.map.getLayerById(data.layer);
const olFeatures = layer.dataSource.ol.getFeatures();
let olFeatures = layer.dataSource.ol.getFeatures();
if (layer.dataSource instanceof ClusterDataSource) {
olFeatures = olFeatures.flatMap((cluster: any) => cluster.get('features'));
}
this.exportService
.export(olFeatures, data.format, layer.title, this.map.projection)
.subscribe(
Expand Down

0 comments on commit a36648e

Please sign in to comment.