How to use the @igo2/utils.downloadContent function in @igo2/utils

To help you get started, we’ve selected a few @igo2/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / import-export / shared / export.service.ts View on Github external
format: ExportFormat,
    title: string,
    projectionIn: string,
    projectionOut: string
  ) {
    const olFormat = new olformat[format]();
    const featuresText = olFormat.writeFeatures(olFeatures, {
      dataProjection: projectionOut,
      featureProjection: projectionIn,
      featureType: 'feature',
      featureNS: 'http://example.com/feature'
    });

    const fileName = `${title}.${format.toLowerCase()}`;

    downloadContent(featuresText, 'text/plain;charset=utf-8', fileName);
    observer.complete();
  }
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / import-export / shared / export.utils.ts View on Github external
export function exportToCSV(rows: any[][], fileName: string, separator: string = ';') {
  const lines = rows.map((row: any[][], index: number) => row.join(separator));
  const csvContent = lines.join('\n');
  downloadContent(csvContent, 'text/csv;charset=utf-8', fileName);
}