Swap out w8r/martinez clipper for mfogel/polygon-clipping

This is a drop in replacement that performs better and yields more correct results
see also https://github.com/ideditor/location-conflation/pull/20
This commit is contained in:
Bryan Housel
2021-01-21 11:31:29 -05:00
parent cb8e9e379a
commit 2cd11040b3
3 changed files with 54 additions and 39 deletions

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@ import { dispatch as d3_dispatch } from 'd3-dispatch';
import deepEqual from 'fast-deep-equal';
import turf_bboxClip from '@turf/bbox-clip';
import stringify from 'fast-json-stable-stringify';
import * as martinez from 'martinez-polygon-clipping';
import polygonClipping from 'polygon-clipping';
import Protobuf from 'pbf';
import vt from '@mapbox/vector-tile';
@@ -66,13 +66,13 @@ function vtToGeoJSON(data, tile, mergeCache) {
var merged = mergeCache[propertyhash];
if (merged && merged.length) {
var other = merged[0];
var coords = martinez.union(
var coords = polygonClipping.union(
feature.geometry.coordinates,
other.geometry.coordinates
);
if (!coords || !coords.length) {
continue; // something failed in martinez union
continue; // something failed in polygon union
}
merged.push(feature);

View File

@@ -58,10 +58,10 @@
"fast-json-stable-stringify": "2.1.0",
"lodash-es": "~4.17.15",
"marked": "~1.2.3",
"martinez-polygon-clipping": "0.7.0",
"node-diff3": "2.1.0",
"osm-auth": "1.1.0",
"pannellum": "2.5.6",
"polygon-clipping": "~0.15.1",
"rbush": "3.0.1",
"whatwg-fetch": "^3.4.1",
"which-polygon": "2.2.0"