mapping-geojson-osm/mappings/mapping-config.type.ts
2024-10-22 11:10:42 +02:00

104 lines
3.0 KiB
TypeScript

interface GeoJsonGeometry {
type: string,
coordinates: Array<number>,
}
interface GeoJsonProperties {
[key: string]: any,
}
interface GeoJsonFeature {
type: string,
geometry: GeoJsonGeometry,
properties: GeoJsonProperties,
}
export interface FeatureCollection {
type: string,
features: Array<GeoJsonFeature>,
}
export interface BoundingBoxCoordinatesType {
xMin: number,
xMax: number,
yMin: number,
yMax: number,
}
/**
* 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;
offset?:number;
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 {
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
default_properties_of_point?: object, // tag to add to every converted point by default
source: sourceConfig,
filters?: filteringConfig,
tags: FeaturePropertyMappingConfigType
}
/**
* configuration concernant toutes les valeurs
*/
export interface FeaturePropertyMappingConfigType {
[key: string]: any,
convert_to_boolean_value?: boolean,
invert_boolean_value?: boolean,
remove_original_key?: boolean,
convert_to_phone?: boolean,
convert_to_name?: boolean,
ignore_if_falsy?: boolean,
ignore_if_truthy?: boolean,
conditional_values?: ConditionnalValuesConfigType,
transform_function?: Function,
}
/**
* choix de conversion de la valeur originale selon des critères donnés
*/
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,
}
export interface ConditionnalValuesType {
[key: string]: ConditionnalValuesConfigType,
}
interface OneOSMTag {
[key: string]: string,
}
export interface TagsToAddConfig {
tags_to_add: Array<OneOSMTag>
}