forked from MapComplete/MapComplete
Various bugfixes and improvements to UK_addresses and GRB theme
This commit is contained in:
parent
bec7ed6da6
commit
8acf85cc55
16 changed files with 290 additions and 82 deletions
|
@ -222,7 +222,6 @@ export class ExtraFunction {
|
|||
const maxFeatures = options?.maxFeatures ?? 1
|
||||
const maxDistance = options?.maxDistance ?? 500
|
||||
const uniqueTag: string | undefined = options?.uniqueTag
|
||||
console.log("Requested closestN")
|
||||
if (typeof features === "string") {
|
||||
const name = features
|
||||
const bbox = GeoOperations.bbox(GeoOperations.buffer(GeoOperations.bbox(feature), maxDistance))
|
||||
|
@ -238,7 +237,7 @@ export class ExtraFunction {
|
|||
let closestFeatures: { feat: any, distance: number }[] = [];
|
||||
for (const featureList of features) {
|
||||
for (const otherFeature of featureList) {
|
||||
if (otherFeature === feature || otherFeature.id === feature.id) {
|
||||
if (otherFeature === feature || otherFeature.properties.id === feature.properties.id) {
|
||||
continue; // We ignore self
|
||||
}
|
||||
const distance = GeoOperations.distanceBetween(
|
||||
|
@ -249,6 +248,11 @@ export class ExtraFunction {
|
|||
console.error("Could not calculate the distance between", feature, "and", otherFeature)
|
||||
throw "Undefined distance!"
|
||||
}
|
||||
|
||||
if(distance === 0){
|
||||
console.trace("Got a suspiciously zero distance between", otherFeature, "and self-feature",feature)
|
||||
}
|
||||
|
||||
if (distance > maxDistance) {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue