Skip to content

Reprojection à la volée des feuilles EDIGÉO du PCI Vecteur

License

Notifications You must be signed in to change notification settings

datagouv/edigeo-reproject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edigeo-reproject

npm version CircleCI codecov XO code style

Reprojection à la volée des feuilles EDIGÉO

Pré-requis

Utilisation côté serveur

Installation

npm install @etalab/edigeo-reproject

If you need to use CommonJS syntax, you will need to use the package version 0.2.0 and install it with npm install [email protected]

Exemple d'utilisation

Get sample data

wget https://cadastre.data.gouv.fr/data/dgfip-pci-vecteur/2023-01-01/edigeo/feuilles/54/54008/edigeo-540080000C01.tar.bz2

Sample for ES6 syntax

A file index-es6.mjs as below

import { readFile, writeFile } from 'fs/promises'
import { reprojectArchive } from 'edigeo-reproject'

// Actuellement l'opérateur await ne fonctionne que dans une fonction asynchrone
async function doJob() {
  const originalArchive = await readFile('edigeo-540080000C01.tar.bz2')
  const reprojectedArchive = await reprojectArchive(originalArchive, '54', 'L93toCC') // L93toCC ou CCtoL93
  await writeFile('edigeo-cc-540080000C01.tar.bz2', reprojectedArchive)
}

doJob().catch(console.error)

Sample for CommonJS syntax

It works only if using [email protected] package.

A file index-commonjs.js as below

const fs = require('fs')
const fsPromises = fs.promises // Available with Node 10+
const {reprojectArchive} = require('edigeo-reproject')

// Actuellement l'opérateur await ne fonctionne que dans une fonction asynchrone
async function doJob() {
  const originalArchive = await fsPromises.readFile('edigeo-540080000C01.tar.bz2')
  const reprojectedArchive = await reprojectArchive(originalArchive, '54', 'L93toCC') // L93toCC ou CCtoL93
  await fsPromises.writeFile('edigeo-cc-540080000C01.tar.bz2', reprojectedArchive)
}

doJob().catch(console.error)

Utilisation en ligne de commande

Installation

npm install -g edigeo-reproject

Exemple d'utilisation

curl edigeo-540080000C01.tar.bz2 | edigeo-reproject -d 54 -m L93toCC > edigeo-cc-540080000C01.tar.bz2
# ou directement à partir d'une ressource distante
curl https://cadastre.data.gouv.fr/data/dgfip-pci-vecteur/2023-01-01/edigeo/feuilles/54/54008/edigeo-540080000C01.tar.bz2 | edigeo-reproject -d 54 -m L93toCC > edigeo-cc-540080000C01.tar.bz2

Licence

MIT

About

Reprojection à la volée des feuilles EDIGÉO du PCI Vecteur

Resources

License

Stars

Watchers

Forks

Packages

No packages published