Scripts: improve conflate script
This commit is contained in:
parent
7aa3aa2cb2
commit
4e05671968
1 changed files with 26 additions and 2 deletions
|
@ -91,6 +91,14 @@ export class Conflate extends Script {
|
||||||
const unmatched = external_features.filter(
|
const unmatched = external_features.filter(
|
||||||
(f) => !bestMatches.some((matched) => matched.match.external_feature === f)
|
(f) => !bestMatches.some((matched) => matched.match.external_feature === f)
|
||||||
)
|
)
|
||||||
|
const weirdMatch = external_features.filter((f) =>
|
||||||
|
bestMatches.some(
|
||||||
|
(matched) =>
|
||||||
|
matched.match.external_feature === f &&
|
||||||
|
!matched.replayed.certainly_imported &&
|
||||||
|
!matched.replayed.possibly_imported
|
||||||
|
)
|
||||||
|
)
|
||||||
const match_lengths: (string | number)[][] = [
|
const match_lengths: (string | number)[][] = [
|
||||||
[
|
[
|
||||||
"osm_id",
|
"osm_id",
|
||||||
|
@ -111,6 +119,9 @@ export class Conflate extends Script {
|
||||||
if (Object.keys(resting_properties).length === 0) {
|
if (Object.keys(resting_properties).length === 0) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if (!certainly_imported && !possibly_imported) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
const id = osm_feature.properties["@id"]
|
const id = osm_feature.properties["@id"]
|
||||||
match_lengths.push([
|
match_lengths.push([
|
||||||
id,
|
id,
|
||||||
|
@ -153,6 +164,19 @@ export class Conflate extends Script {
|
||||||
" "
|
" "
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fs.writeFileSync(
|
||||||
|
targetDir + "/unmatched_but_has_close_feature.geojson",
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
type: "FeatureCollection",
|
||||||
|
features: weirdMatch,
|
||||||
|
},
|
||||||
|
|
||||||
|
null,
|
||||||
|
" "
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private async findTimeFork(
|
private async findTimeFork(
|
||||||
|
@ -292,12 +316,12 @@ export class Conflate extends Script {
|
||||||
}
|
}
|
||||||
if (properties["website"]) {
|
if (properties["website"]) {
|
||||||
let website = properties.website.toLowerCase()
|
let website = properties.website.toLowerCase()
|
||||||
website
|
website = website
|
||||||
.replace("http://http://", "http://")
|
.replace("http://http://", "http://")
|
||||||
.replace("https://https://", "https://")
|
.replace("https://https://", "https://")
|
||||||
.replace("https//", "https://")
|
.replace("https//", "https://")
|
||||||
.replace("http://", "https://")
|
.replace("http://", "https://")
|
||||||
if (website.startsWith("https://")) {
|
if (!website.startsWith("https://")) {
|
||||||
website = "https://" + website
|
website = "https://" + website
|
||||||
}
|
}
|
||||||
const validator = new UrlValidator()
|
const validator = new UrlValidator()
|
||||||
|
|
Loading…
Reference in a new issue