script to get latest charging station geojson from overpass
This commit is contained in:
parent
ef2fdc7ff2
commit
576d0c29c9
1
content_irve.txt
Normal file
1
content_irve.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
[out:json][timeout:25];area(id:3600007401)->.searchArea; (node["amenity"="charging_station"](area.searchArea);); out center;
|
5640
data_other/irve_osm_2023-08-30.geojson
Normal file
5640
data_other/irve_osm_2023-08-30.geojson
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2030
etalab_data/bus/variance_opendata_stations_junglebus.csv
Normal file
2030
etalab_data/bus/variance_opendata_stations_junglebus.csv
Normal file
File diff suppressed because it is too large
Load Diff
14
etalab_data/toilettes/variance_small.csv
Normal file
14
etalab_data/toilettes/variance_small.csv
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
;variance de ./etalab_data/toilettes/small.csv;généré le:;Fri Aug 18 2023 13:39:11 GMT+0200 (heure d’été d’Europe centrale);lignes du csv original:;10;fait avec make_variance_from_csv.ts de Tykayn
|
||||||
|
;TYPE;STATUT;ADRESSE;ARRONDISSEMENT;HORAIRE;ACCES_PMR;RELAIS_BEBE;URL_FICHE_EQUIPEMENT;geo_shape_1;geo_shape_2;geo_point_2d_1;geo_point_2d_2
|
||||||
|
;3;1;9;7;4;2;3;7;9;9;9;9
|
||||||
|
|
||||||
|
|
||||||
|
;SANISETTE;;63 AVENUE DU GENERAL LECLERC;75003;24 h / 24;Oui;;;2.3164276371957278;48.82101412751667;48.82101412751667;2.3164276371957278
|
||||||
|
;TOILETTES;;JARDIN HENRI SAUVAGE;75007;Voir fiche équipement;Non;Non;https://www.paris.fr/equipements/jardin-henri-sauvage-ex-square-amiraux-boinod-2702;2.3195679829481666;48.82896483276907;48.82896483276907;2.3195679829481666
|
||||||
|
;WC PUBLICS PERMANENTS;;SQUARE DU TEMPLE;75012;;;Oui;https://www.paris.fr/equipements/square-du-temple-elie-wiesel-2425;2.320485389226217;48.836321683521824;48.836321683521824;2.320485389226217
|
||||||
|
;;;JARDIN DU MOULIN DE LA POINTE;75013;6 h - 22 h;;;https://www.paris.fr/equipements/jardin-du-monument-aux-meres-francaises-2564;2.3279795895584483;48.838257002553206;48.838257002553206;2.3279795895584483
|
||||||
|
;;;BOIS DE VINCENNES - PARC FLORAL DE PARIS - PINEDE;75014;;;;https://www.paris.fr/equipements/parc-floral-de-paris-1;2.3523880408452515;48.8409122311636;48.8409122311636;2.3523880408452515
|
||||||
|
;;;JARDIN CATHERINE LABOURE;75015;;;;https://www.paris.fr/equipements/jardin-catherine-laboure-2465;2.356788716578511;48.851401300193594;48.851401300193594;2.356788716578511
|
||||||
|
;;;JARDIN JAMES JOYCE;75018;;;;https://www.paris.fr/equipements/jardin-james-joyce-2560;2.3604997434830852;48.86260809408294;48.86260809408294;2.3604997434830852
|
||||||
|
;;;Parc Rives de Seine;;;;;;2.3737508079721192;48.86428649324811;48.86428649324811;2.3737508079721192
|
||||||
|
;;;face au 55 BOULEVARD DE VAUGIRARD;;;;;;2.4446432727101697;48.89412215800546;48.89412215800546;2.4446432727101697
|
|
5
get_irve.sh
Normal file
5
get_irve.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "récupérer les bornes de recharge en Essonne"
|
||||||
|
overpass_website="https://overpass-api.de/api/interpreter"
|
||||||
|
curl --header "Content-Type: plain/text" --data @content_irve.txt --trace-ascii website-data.log "$overpass_website" > data_other/irve_osm_2023-08-30.geojson
|
||||||
|
du -sch data_other/irve_osm_2023-08-30.geojson
|
@ -18,17 +18,22 @@ let mini_arguments: any = minimist(process.argv.slice(2))
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
let csv_content = 'variance de dataset\n';
|
let csv_content = 'variance de dataset\n';
|
||||||
let separator = ';';
|
let separator = ',';
|
||||||
|
let separator_fallback = ';';
|
||||||
let data_variance: any = {};
|
let data_variance: any = {};
|
||||||
|
|
||||||
let inputFile = 'sanisettesparis_reworked'
|
let folder = 'toilettes'
|
||||||
let fileName = `sanisettesparis_${inputFile}.csv`;
|
let inputFile = 'small.csv'
|
||||||
let inputPath = `./etalab_data/toilettes/${inputFile}.csv`
|
let fileNameOutput = `variance_${inputFile}`;
|
||||||
|
let inputPath = `./etalab_data/${folder}/${inputFile}`
|
||||||
// let inputPath = './etalab_data/toilettes/small_datas.csv'
|
// let inputPath = './etalab_data/toilettes/small_datas.csv'
|
||||||
let outputPath = 'etalab_data/toilettes'
|
let outputPath = `etalab_data/${folder}`
|
||||||
if (mini_arguments['source']) {
|
if (mini_arguments['source']) {
|
||||||
inputPath = mini_arguments['source']
|
inputPath = mini_arguments['source']
|
||||||
}
|
}
|
||||||
|
if (mini_arguments['separator']) {
|
||||||
|
separator = mini_arguments['separator']
|
||||||
|
}
|
||||||
let columns_headings: Array<string> = [];
|
let columns_headings: Array<string> = [];
|
||||||
let lines_count = 0;
|
let lines_count = 0;
|
||||||
let longest_variance_count = 0;
|
let longest_variance_count = 0;
|
||||||
@ -37,6 +42,7 @@ let longest_variance_count = 0;
|
|||||||
function getColumnsFromRow(row: string) {
|
function getColumnsFromRow(row: string) {
|
||||||
let headings: any = []
|
let headings: any = []
|
||||||
console.log('elem', row)
|
console.log('elem', row)
|
||||||
|
|
||||||
headings = row.split(separator)
|
headings = row.split(separator)
|
||||||
return headings
|
return headings
|
||||||
}
|
}
|
||||||
@ -65,12 +71,27 @@ fs.readFile(inputPath, function (err: any, fileData: any) {
|
|||||||
throw new Error(err)
|
throw new Error(err)
|
||||||
}
|
}
|
||||||
console.log('line ', lines_count)
|
console.log('line ', lines_count)
|
||||||
|
console.log('lines.length', lines.length)
|
||||||
|
|
||||||
lines.forEach((line: any) => {
|
lines.forEach((line: any) => {
|
||||||
|
|
||||||
line = line[0]
|
line = line[0]
|
||||||
|
|
||||||
if (lines_count === 0) {
|
if (lines_count === 0) {
|
||||||
|
console.log('line', line)
|
||||||
|
if(line.indexOf(separator) === -1){
|
||||||
|
console.log('separator not found: ', separator, 'trying other separator')
|
||||||
|
if(line.indexOf(separator_fallback) === -1){
|
||||||
|
console.log('separator not found: ', separator_fallback)
|
||||||
|
|
||||||
|
throw new Error('no separator found in csv')
|
||||||
|
|
||||||
|
}else{
|
||||||
|
console.log('fallback separator found: ', separator_fallback, 'now using it ')
|
||||||
|
separator = separator_fallback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
columns_headings = getColumnsFromRow(line)
|
columns_headings = getColumnsFromRow(line)
|
||||||
console.log('columns_headings.length', columns_headings.length)
|
console.log('columns_headings.length', columns_headings.length)
|
||||||
// console.log('columns_headings', columns_headings)
|
// console.log('columns_headings', columns_headings)
|
||||||
@ -118,8 +139,7 @@ fs.readFile(inputPath, function (err: any, fileData: any) {
|
|||||||
console.log('longest_variance_count', longest_variance_count)
|
console.log('longest_variance_count', longest_variance_count)
|
||||||
|
|
||||||
reorderValuesInDataVariance()
|
reorderValuesInDataVariance()
|
||||||
utils.writeFile(fileName, writeCSVVariance(), outputPath)
|
utils.writeFile(fileNameOutput, writeCSVVariance(), outputPath)
|
||||||
// console.log('data_variance', data_variance)
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ const MappingIRVE: MappingConfigType = {
|
|||||||
nom_operateur: 'operator',
|
nom_operateur: 'operator',
|
||||||
telephone_operateur: {
|
telephone_operateur: {
|
||||||
key_converted: 'phone',
|
key_converted: 'phone',
|
||||||
convert_to_phone: true, // convertit en yes ou no
|
convert_to_phone: true, // conversion en format international si possible
|
||||||
},
|
},
|
||||||
contact_operateur: 'email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
|
contact_operateur: 'email', // ici, on souhaite convertir la clé contact_operateur=bidule en email=bidule
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@
|
|||||||
"variance": "ts-node make_variance_from_csv.ts",
|
"variance": "ts-node make_variance_from_csv.ts",
|
||||||
"example": "ts-node convert_to_osm_tags.ts --engine=true --department=974 --source=\"./etalab_data/irve_bornes_recharge/all.json\"",
|
"example": "ts-node convert_to_osm_tags.ts --engine=true --department=974 --source=\"./etalab_data/irve_bornes_recharge/all.json\"",
|
||||||
"irve": "ts-node convert_to_osm_tags.ts --engine=true --source=\"./etalab_data/irve_bornes_recharge/all.json\"",
|
"irve": "ts-node convert_to_osm_tags.ts --engine=true --source=\"./etalab_data/irve_bornes_recharge/all.json\"",
|
||||||
|
"irve:up": "bash get_irve.sh && ts-node convert_to_osm_tags.ts --engine=true --source=\"./data_other/irve_osm_2023-08-30.geojson\"",
|
||||||
"irve:jb": "ts-node convert_to_osm_tags.ts --engine=true --source=\"./etalab_data/irve_bornes_recharge/irve-junglebus.csv\"",
|
"irve:jb": "ts-node convert_to_osm_tags.ts --engine=true --source=\"./etalab_data/irve_bornes_recharge/irve-junglebus.csv\"",
|
||||||
"simple": "ts-node convert_to_osm_tags.ts",
|
"simple": "ts-node convert_to_osm_tags.ts",
|
||||||
"chargemap": "ts-node chargemap.ts",
|
"chargemap": "ts-node chargemap.ts",
|
||||||
|
10
query-overpass.sh
Executable file
10
query-overpass.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Query Overpass API (https://wiki.openstreetmap.org/wiki/Overpass_API)
|
||||||
|
# Usage:
|
||||||
|
# ```sh
|
||||||
|
# echo "[out:json];(way(109849152); node(1985407312);); out;" | ./query-overpass.sh
|
||||||
|
# ```
|
||||||
|
|
||||||
|
curl -d @- -X POST http://overpass-api.de/api/interpreter
|
||||||
|
#> data_other/output_query_irve_from_overpass.json
|
2413
website-data.log
Normal file
2413
website-data.log
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user