2023-08-09 23:10:45 +02:00
interface GeoJsonGeometry {
2024-10-07 23:26:43 +02:00
type : string ,
coordinates : Array < number > ,
2023-08-09 23:10:45 +02:00
}
interface GeoJsonProperties {
2024-10-07 23:26:43 +02:00
[ key : string ] : any ,
2023-08-09 23:10:45 +02:00
}
interface GeoJsonFeature {
2024-10-07 23:26:43 +02:00
type : string ,
geometry : GeoJsonGeometry ,
properties : GeoJsonProperties ,
2023-08-09 23:10:45 +02:00
}
2024-10-07 23:26:43 +02:00
export interface FeatureCollection {
type : string ,
features : Array < GeoJsonFeature > ,
2023-08-09 23:10:45 +02:00
}
2024-10-07 23:26:43 +02:00
export interface BoundingBoxCoordinatesType {
2023-08-09 23:10:45 +02:00
xMin : number ,
xMax : number ,
yMin : number ,
yMax : number ,
}
2024-10-07 23:26:43 +02:00
/ * *
* configuration to choose what point to exclude or include from geographic or properties hints
* /
export interface filteringConfig {
enable_coordinates_filter? : boolean ;
enable_properties_filter? : boolean ;
properties? : object ;
bounding_box? : object ;
2024-10-08 10:09:21 +02:00
offset? :number ;
2024-10-07 23:26:43 +02:00
exclude_point_if_tag_not_empty? : Array < string > ;
exclude_point_if_tag_truthy? : Array < string > ;
exclude_point_if_tag_falsy? : Array < string > ;
}
interface sourceConfig {
geojson_path : string ; // the relative path to the geojson source file to analyse, from the root of this repository
url : string ; // URL from where the geojson comes online, on a data platform. This URL should be fetchable to get the most recent data of the concerned dataset to convert.
}
export default interface MappingConfigType {
2024-10-09 15:12:10 +02:00
config_name : string , // descriptive name
config_author : string , // name and email for example
osmose? : boolean , // is the data from Osmose export
boolean_keys? : Array < string > , // what keys should be converted to boolean values
tags_to_ignore_if_value_is? : Array < string > , // list of strings for which we ignore the tags if they equal any of these
add_not_mapped_tags_too : boolean , // by default, we do not add tags from properties that we do not specify, set this to true to change it
2024-10-07 23:26:43 +02:00
default_properties_of_point? : object , // tag to add to every converted point by default
source : sourceConfig ,
filters? : filteringConfig ,
2023-08-09 23:10:45 +02:00
tags : FeaturePropertyMappingConfigType
}
/ * *
* configuration concernant toutes les valeurs
* /
2024-10-07 23:26:43 +02:00
export interface FeaturePropertyMappingConfigType {
[ key : string ] : any ,
convert_to_boolean_value? : boolean ,
2024-10-09 16:22:57 +02:00
invert_boolean_value? : boolean ,
2024-10-07 23:26:43 +02:00
remove_original_key? : boolean ,
2024-10-09 16:22:57 +02:00
convert_to_phone? : boolean ,
convert_to_name? : boolean ,
ignore_if_falsy? : boolean ,
ignore_if_truthy? : boolean ,
conditional_values? : ConditionnalValuesType ,
2024-10-07 23:26:43 +02:00
transform_function? : Function ,
2023-08-09 23:10:45 +02:00
}
/ * *
* choix de conversion de la valeur originale selon des critères donnés
* /
2024-10-07 23:26:43 +02:00
export interface ConditionnalValuesConfigType {
key_converted? : string ,
value_converted? : string ,
truthy_value? : any ,
falsy_value? : any , // si la valeur originale est falsy, la convertir en la valeur donnée ici
ignore_this_data? : boolean ,
tags_to_add? : TagsToAddConfig ,
transform_function? : Function ,
2023-08-09 23:10:45 +02:00
}
2024-10-07 23:26:43 +02:00
export interface ConditionnalValuesType {
[ key : string ] : ConditionnalValuesConfigType ,
2023-08-09 23:10:45 +02:00
}
2024-10-07 23:26:43 +02:00
2023-08-09 23:10:45 +02:00
interface OneOSMTag {
2024-10-07 23:26:43 +02:00
[ key : string ] : string ,
2023-08-09 23:10:45 +02:00
}
2024-10-07 23:26:43 +02:00
export interface TagsToAddConfig {
2023-08-09 23:10:45 +02:00
tags_to_add : Array < OneOSMTag >
}