Skip to content

Commit

Permalink
[#30] feat - add export points to kml
Browse files Browse the repository at this point in the history
  • Loading branch information
leossb36 committed Nov 3, 2021
1 parent cb93d12 commit 6332e02
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/comunidades/comunidades.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,30 @@ export class ComunidadesService {

return communityData;
}

async exportCommunityPointsToKml(communityId: string) {
const communityData = await this.getPointByCommunityId(communityId);
const geoJsonData = [];

communityData.forEach((point) => {
geoJsonData.push({
type: 'Feature',
geometry: {
type: 'Point',
coordinates: point.coordinates,
},
properties: {
name: point.title,
},
});
});

const geoJson = {
type: 'FeatureCollection',
features: geoJsonData,
};
const kmlCommunityData = tokml(geoJson);

return kmlCommunityData;
}
}

0 comments on commit 6332e02

Please sign in to comment.