-
Notifications
You must be signed in to change notification settings - Fork 992
Open
Description
Facing a similar issue to a previous issue I raised
https://github.com/Turfjs/turf/issues/2892
Upgrading to
"@turf/turf": "^7.2.0",
Fixed that one case of inputs however for this it doesn't resolve
import * as turf from '@turf/turf';
import { Feature, GeoJsonProperties, MultiPolygon, Polygon } from 'geojson';
const poly1 = {"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-92.47571,42.71498],[-92.47532,42.71495],[-92.47535,42.71421],[-92.47515,42.71349],[-92.47469,42.71323],[-92.47452,42.71135],[-92.47335,42.71131],[-92.47306,42.71123],[-92.473,42.71104],[-92.47285,42.70978],[-92.47336,42.70849],[-92.47344,42.70545],[-92.47322,42.70482],[-92.47232,42.70426],[-92.47207,42.70387],[-92.47219,42.70043],[-92.45653,42.70042],[-92.45618,42.70054],[-92.45617,42.70811],[-92.45637,42.70858],[-92.46089,42.70862],[-92.46087,42.71126],[-92.46057,42.71161],[-92.46044,42.71215],[-92.4607,42.71283],[-92.46089162382165,42.714197499528396],[-92.46233,42.71402],[-92.46312,42.71395],[-92.46392,42.7139],[-92.46865,42.71389],[-92.46870945733048,42.7138914499349],[-92.4688,42.71365],[-92.46887,42.71364],[-92.46887,42.71351],[-92.46888,42.71344],[-92.4689,42.71352],[-92.46888,42.71362],[-92.4689,42.71374],[-92.46899,42.71388],[-92.46939,42.71391],[-92.46972,42.71398],[-92.46954554,42.71394299],[-92.46984019,42.71398775],[-92.47003,42.714],[-92.47024026,42.71404852],[-92.47025,42.71405],[-92.47047394300176,42.71409653854567],[-92.47075,42.71413],[-92.47098495,42.71420272],[-92.47102,42.71421],[-92.47133963,42.7142857],[-92.47117,42.71426],[-92.4715,42.71431],[-92.4717302922405,42.71437823473792],[-92.47182101859093,42.71439971782684],[-92.47219,42.71447],[-92.47274,42.7146],[-92.47296401,42.71466637],[-92.47321483,42.71470267],[-92.47314,42.7147],[-92.47342,42.71471],[-92.47367,42.71476],[-92.47371545000003,42.71477818],[-92.4738516,42.7148096],[-92.47394,42.71482],[-92.47409,42.71486],[-92.47452012,42.71491103],[-92.47487,42.71492],[-92.47499884,42.71493741],[-92.47511,42.71494],[-92.47518205445736,42.71496217060226],[-92.47524,42.71497],[-92.47546367,42.71496791],[-92.47551603,42.71496508],[-92.47571,42.71498],[-92.47571,42.71498]]]}} as Feature<Polygon, GeoJsonProperties>
const intersection = {"type":"Feature","properties":{},"geometry":{"type":"MultiPolygon","coordinates":[[[[-92.47571,42.71498],[-92.47532,42.71495],[-92.47535,42.71421],[-92.47515,42.71349],[-92.47469,42.71323],[-92.47452,42.71135],[-92.47335,42.71131],[-92.47306,42.71123],[-92.473,42.71104],[-92.47293778625954,42.71051740458015],[-92.47293,42.71086],[-92.47301,42.71186],[-92.47298,42.71201],[-92.4728,42.71231],[-92.47236,42.71232],[-92.47217,42.71245],[-92.47214,42.71252],[-92.47224,42.713],[-92.47225,42.71332],[-92.47222,42.71388],[-92.47215,42.71418],[-92.4724184937466,42.71452400761283],[-92.47274,42.7146],[-92.47296401,42.71466637],[-92.47321483,42.71470267],[-92.47314,42.7147],[-92.47342,42.71471],[-92.47367,42.71476],[-92.47371545,42.71477818],[-92.4738516,42.7148096],[-92.47394,42.71482],[-92.47409,42.71486],[-92.47452012,42.71491103],[-92.47487,42.71492],[-92.47499884,42.71493741],[-92.47511,42.71494],[-92.47518205,42.71496217],[-92.47524,42.71497],[-92.47546367,42.71496791],[-92.47551603,42.71496508],[-92.47571,42.71498]]],[[[-92.47344,42.70545],[-92.47341760660248,42.70538587345254],[-92.47334,42.70553],[-92.47336,42.70592],[-92.47326,42.70695],[-92.47332,42.70765],[-92.4733,42.70827],[-92.4732,42.70883],[-92.4729,42.7095],[-92.47285,42.70972],[-92.47284,42.70998],[-92.472911,42.7102924],[-92.47285,42.70978],[-92.47336,42.70849],[-92.47344,42.70545]]]]}} as Feature<Polygon | MultiPolygon, GeoJsonProperties>
const difference1 = turf.difference(
turf.featureCollection([
turf.truncate(poly1, { precision: 8 }),
turf.truncate(intersection, { precision: 8 })
]),
);
If I change the precision to 4 or 6 it terminates and produces a result.
as mentioned I am using
"@turf/turf": "^7.2.0",
Metadata
Metadata
Assignees
Labels
No labels