More or less working version of advanced conflation

This commit is contained in:
Pieter Vander Vennet 2022-01-06 14:39:42 +01:00
parent 7f99e76b0c
commit 3176a4d665
11 changed files with 634 additions and 524 deletions

View file

@ -362,6 +362,85 @@ export default class GeoOperationsSpec extends T {
const overlapsRev = GeoOperations.calculateOverlap(polyHouse, [polyGrb])
Assert.equal(overlapsRev.length, 0)
}],
["Overnode removal test", () => {
const feature = { "geometry": {
"type": "Polygon",
"coordinates": [
[
[
4.477944199999975,
51.02783550000022
],
[
4.477987899999996,
51.027818800000034
],
[
4.478004500000021,
51.02783399999988
],
[
4.478025499999962,
51.02782489999994
],
[
4.478079099999993,
51.027873899999896
],
[
4.47801040000006,
51.027903799999955
],
[
4.477964799999972,
51.02785709999982
],
[
4.477964699999964,
51.02785690000006
],
[
4.477944199999975,
51.02783550000022
]
]
]
}}
const copy = GeoOperations.removeOvernoding(feature)
Assert.equal(copy.geometry.coordinates[0].length, 7)
T.listIdentical([
[
4.477944199999975,
51.02783550000022
],
[
4.477987899999996,
51.027818800000034
],
[
4.478004500000021,
51.02783399999988
],
[
4.478025499999962,
51.02782489999994
],
[
4.478079099999993,
51.027873899999896
],
[
4.47801040000006,
51.027903799999955
],
[
4.477944199999975,
51.02783550000022
]
], copy.geometry.coordinates[0])
}]
]
)

File diff suppressed because one or more lines are too long

View file

@ -45,7 +45,9 @@ export default class T {
throw `ListIdentical failed: expected a list of length ${expected.length} but got a list of length ${actual.length}`
}
for (let i = 0; i < expected.length; i++) {
if (expected[i] !== actual[i]) {
if(expected[i]["length"] !== undefined ){
T.listIdentical(<any> expected[i], <any> actual[i])
}else if (expected[i] !== actual[i]) {
throw `ListIdentical failed at index ${i}: expected ${expected[i]} but got ${actual[i]}`
}
}