@@ -12,6 +12,12 @@ import type {
12
12
} from "./types"
13
13
import { entityPropertiesEqual , getEntityType } from "./utils"
14
14
15
+ export type OsmMergeOptions = {
16
+ directMerge : boolean
17
+ deduplicateNodes : boolean
18
+ createIntersections : boolean
19
+ }
20
+
15
21
export type OsmChangesStats = {
16
22
deduplicatedNodes : number
17
23
deduplicatedNodesReplaced : number
@@ -305,17 +311,26 @@ export default class OsmChangeset {
305
311
}
306
312
}
307
313
308
- generateFullChangeset ( patch : Osm ) {
309
- this . generateDirectChanges ( patch )
314
+ generateFullChangeset (
315
+ patch : Osm ,
316
+ { directMerge, deduplicateNodes, createIntersections } : OsmMergeOptions ,
317
+ ) {
318
+ if ( directMerge ) {
319
+ this . generateDirectChanges ( patch )
320
+ }
310
321
311
- // Then de-duplicate overlapping nodes
312
- for ( const node of patch . nodes ) {
313
- this . deduplicateOverlappingNodes ( node )
322
+ if ( deduplicateNodes ) {
323
+ // Then de-duplicate overlapping nodes
324
+ for ( const node of patch . nodes ) {
325
+ this . deduplicateOverlappingNodes ( node )
326
+ }
314
327
}
315
328
316
- // Then handle intersecting ways
317
- for ( const way of patch . ways ) {
318
- this . handleIntersectingWays ( way , patch )
329
+ if ( createIntersections ) {
330
+ // Then handle intersecting ways
331
+ for ( const way of patch . ways ) {
332
+ this . handleIntersectingWays ( way , patch )
333
+ }
319
334
}
320
335
}
321
336
0 commit comments