add filter on bounding coordinates
This commit is contained in:
parent
6ed29f8a93
commit
72c335d270
|
@ -6,24 +6,38 @@ import fs from 'node-fs';
|
|||
|
||||
let show_debug = 0;
|
||||
|
||||
|
||||
// wip filter
|
||||
let filterOnBoundingBox = true
|
||||
|
||||
let boundingBoxCoordinates ={
|
||||
xMin: 1.91,
|
||||
yMin: 48.7,
|
||||
xMax: 2.38,
|
||||
yMax: 48.4,
|
||||
}
|
||||
|
||||
let filterCoordinates = true;
|
||||
let filterDepartment = 974;
|
||||
let enableFilterOnDepartment = false;
|
||||
let filterDepartment = 91;
|
||||
let filterZipCode = new RegExp(`^${filterDepartment}`);
|
||||
let filterZipCodeAdresse = new RegExp(` ${filterDepartment}`);
|
||||
let filteredName =''
|
||||
|
||||
if(filterCoordinates){
|
||||
if(enableFilterOnDepartment){
|
||||
filteredName = '_filtered_zipcode_'+filterDepartment
|
||||
}
|
||||
|
||||
if(filterOnBoundingBox){
|
||||
filteredName = '_filtered_bbox_'+boundingBoxCoordinates.xMin+'-'+boundingBoxCoordinates.xMax+'_'+boundingBoxCoordinates.yMin+'-'+boundingBoxCoordinates.yMax
|
||||
}
|
||||
let pointCounterMax = 1000000;
|
||||
|
||||
// let limitConversionToFirstPoint = false;
|
||||
// if (limitConversionToFirstPoint) {
|
||||
// pointCounterMax = 1
|
||||
// }
|
||||
let limitConversionToFirstPoint = false;
|
||||
// limitConversionToFirstPoint = true;
|
||||
if (limitConversionToFirstPoint) {
|
||||
pointCounterMax = 1
|
||||
}
|
||||
|
||||
// limitConversionToFirstPoint = false;
|
||||
|
||||
// let sourceFileChargemapJson = './chargemap_data/hurepoix.json'
|
||||
let sourceFileIRVEGeoJson = './etalab_data/latest.json'
|
||||
|
@ -105,11 +119,33 @@ function convertDataForIRVE(sourceFilePath, mapping, pointCounterMax) {
|
|||
console.log('listOfPoints.length', listOfPoints.length)
|
||||
listOfPoints.forEach(featurePoint => {
|
||||
|
||||
let regextestresult = (
|
||||
let regextestresult = true;
|
||||
|
||||
if(enableFilterOnDepartment){
|
||||
console.log('filtre sur les départements activé')
|
||||
regextestresult = (
|
||||
filterZipCode.test(featurePoint.properties.consolidated_code_postal)
|
||||
||
|
||||
||
|
||||
filterZipCodeAdresse.test(featurePoint.properties.adresse_station)
|
||||
)
|
||||
}else if(filterOnBoundingBox){
|
||||
console.log('filtre sur les coordonnées activé')
|
||||
|
||||
let x = coordonneesXY[0]
|
||||
let xMin = boundingBoxCoordinates.xMin
|
||||
let xMax = boundingBoxCoordinates.xMax
|
||||
let yMin = boundingBoyCoordinates.yMin
|
||||
let yMax = boundingBoyCoordinates.yMay
|
||||
|
||||
let y = coordonneesXY[1]
|
||||
regextestresult = (
|
||||
filterZipCode.test(x >= xMin && x <= xMax)
|
||||
&&
|
||||
filterZipCode.test(y >= yMin && y <= yMax)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// filter points depending on zipcode
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue