add types
This commit is contained in:
parent
f819cd7cc7
commit
1e7dba294a
@ -6,11 +6,9 @@ import * as minimist from 'minimist'
|
|||||||
import mappingConfigIRVE from './mappings/converters/configIRVE'
|
import mappingConfigIRVE from './mappings/converters/configIRVE'
|
||||||
import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple'
|
import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple'
|
||||||
import mapping_engine from './mappings/engine'
|
import mapping_engine from './mappings/engine'
|
||||||
import custom_utils from './mappings/utils.mjs'
|
import custom_utils from './mappings/utils'
|
||||||
|
import MappingConfigType from "./mappings/mapping-config.type";
|
||||||
const { debugLog } = custom_utils
|
import {debugLog} from './mappings/utils.ts'
|
||||||
const { isBooleanKey } = custom_utils
|
|
||||||
const { writeFile } = custom_utils
|
|
||||||
|
|
||||||
let use_mappping_engine = false
|
let use_mappping_engine = false
|
||||||
// use_mappping_engine = true
|
// use_mappping_engine = true
|
||||||
@ -26,7 +24,7 @@ let sourceFilePathGeoJson = './etalab_data/small.json'
|
|||||||
let filterOnBoundingBox = true
|
let filterOnBoundingBox = true
|
||||||
filterOnBoundingBox = false
|
filterOnBoundingBox = false
|
||||||
|
|
||||||
let boundingBoxCoordinates = {
|
let boundingBoxCoordinates : BoundingBoxCoordinatesType = {
|
||||||
xMin: 1.91,
|
xMin: 1.91,
|
||||||
xMax: 2.38,
|
xMax: 2.38,
|
||||||
yMin: 48.7,
|
yMin: 48.7,
|
||||||
@ -81,7 +79,7 @@ let converted_geo_json = {
|
|||||||
* @param pointCounterMax
|
* @param pointCounterMax
|
||||||
* @param boundingBoxCoordinates
|
* @param boundingBoxCoordinates
|
||||||
*/
|
*/
|
||||||
function convertDataForIRVE (sourceFilePath, mapping, pointCounterMax, boundingBoxCoordinates) {
|
function convertDataForIRVE (sourceFilePath, mapping: MappingConfigType, pointCounterMax, boundingBoxCoordinates) {
|
||||||
debugLog('convertDataFromChargemap from ', sourceFilePath)
|
debugLog('convertDataFromChargemap from ', sourceFilePath)
|
||||||
|
|
||||||
fs.readFile(sourceFilePath, 'utf8', function (err, data) {
|
fs.readFile(sourceFilePath, 'utf8', function (err, data) {
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
* détail dans le tableau
|
* détail dans le tableau
|
||||||
* https://wiki.openstreetmap.org/wiki/France/data.gouv.fr/Bornes_de_Recharge_pour_V%C3%A9hicules_%C3%89lectriques
|
* https://wiki.openstreetmap.org/wiki/France/data.gouv.fr/Bornes_de_Recharge_pour_V%C3%A9hicules_%C3%89lectriques
|
||||||
*/
|
*/
|
||||||
|
import MappingConfigType, {FeaturePropertyMappingConfigType} from "../mapping-config.type";
|
||||||
|
|
||||||
export default {
|
const MappingIRVE: MappingConfigType = {
|
||||||
config_name: "IRVE config",
|
config_name: "IRVE config",
|
||||||
config_author: "tykayn <contact@cipherbliss.com>",
|
config_author: "tykayn <contact@cipherbliss.com>",
|
||||||
default_properties_of_point: {
|
default_properties_of_point: {
|
||||||
@ -110,4 +111,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default MappingIRVE;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import custom_utils from './utils.mjs'
|
import custom_utils from './utils'
|
||||||
|
|
||||||
const {debugLog} = custom_utils
|
const {debugLog} = custom_utils
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ export default class {
|
|||||||
* @param pointKeyName
|
* @param pointKeyName
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isBooleanKey(pointKeyName) {
|
isBooleanKey(pointKeyName):boolean {
|
||||||
|
|
||||||
return listOfBooleanKeys.indexOf(pointKeyName) !== -1
|
return listOfBooleanKeys.indexOf(pointKeyName) !== -1
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ export default class {
|
|||||||
truthyValues = ['true', 'True', 'TRUE', '1', 1]
|
truthyValues = ['true', 'True', 'TRUE', '1', 1]
|
||||||
falsyValues = ['false', 'False', 'FALSE', '0', 0]
|
falsyValues = ['false', 'False', 'FALSE', '0', 0]
|
||||||
|
|
||||||
filterFeaturesByOffset(offsetCount, listOfFeatures) {
|
filterFeaturesByOffset(offsetCount:number, listOfFeatures) : Array<any>{
|
||||||
let filteredList = listOfFeatures
|
let filteredList = listOfFeatures
|
||||||
// TODO
|
// TODO
|
||||||
return filteredList
|
return filteredList
|
||||||
|
16
mapping_geojson_to_osm_tags/mappings/mapping-config.type.ts
Normal file
16
mapping_geojson_to_osm_tags/mappings/mapping-config.type.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
export interface FeaturePropertyMappingConfigType{
|
||||||
|
key_converted?:string,
|
||||||
|
truthy_value?:any,
|
||||||
|
}
|
||||||
|
export interface BoundingBoxCoordinatesType{
|
||||||
|
xMin: number,
|
||||||
|
xMax: number,
|
||||||
|
yMin: number,
|
||||||
|
yMax: number,
|
||||||
|
}
|
||||||
|
export default interface MappingConfigType{
|
||||||
|
config_name: string,
|
||||||
|
config_author: string,
|
||||||
|
default_properties_of_point: object,
|
||||||
|
tags: object
|
||||||
|
}
|
@ -7,11 +7,11 @@ show_debug = 1
|
|||||||
* faire un log
|
* faire un log
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
function debugLog(message) {
|
function debugLog(...args : any) {
|
||||||
if (!show_debug) {
|
if (!show_debug) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('debug: ', message)
|
console.log('debug: ', ...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,18 +20,18 @@
|
|||||||
"node-fs": "^0.1.7"
|
"node-fs": "^0.1.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.22.5",
|
"@babel/core": "^7.22.9",
|
||||||
"@babel/preset-env": "^7.22.5",
|
"@babel/preset-env": "^7.22.9",
|
||||||
"@babel/preset-typescript": "^7.22.5",
|
"@babel/preset-typescript": "^7.22.5",
|
||||||
"@jest/globals": "^29.5.0",
|
"@jest/globals": "^29.6.2",
|
||||||
"@types/minimist": "^1.2.2",
|
"@types/minimist": "^1.2.2",
|
||||||
"@types/node": "^20.4.5",
|
"@types/node": "^20.4.5",
|
||||||
"babel-jest": "^29.5.0",
|
"babel-jest": "^29.6.2",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.6.2",
|
||||||
"loglevel": "^1.8.1",
|
"loglevel": "^1.8.1",
|
||||||
"nodemon": "^2.0.22",
|
"nodemon": "^2.0.22",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"tslib": "^2.6.0",
|
"tslib": "^2.6.1",
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user