mapping-geojson-osm/mappings/mapping-config.type.ts

98 lines
2.5 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;
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,
config_author: string,
osmose?: boolean,
boolean_keys?: Array<string>,
tags_to_ignore_if_value_is?: Array<string>,
add_not_mapped_tags_too: boolean,
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,
remove_original_key?: boolean,
conditionnal_values?: ConditionnalValuesType,
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>
}