diff --git a/.gitignore b/.gitignore index 145fdda4a..4ced384d8 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,4 @@ node_modules .vscode -.nx/ +.nx/ \ No newline at end of file diff --git a/packages/turf-bbox-clip/README.md b/packages/turf-bbox-clip/README.md index e9031ca2c..882da4b62 100644 --- a/packages/turf-bbox-clip/README.md +++ b/packages/turf-bbox-clip/README.md @@ -4,13 +4,14 @@ ## bboxClip -Takes a [Feature][1] and a bbox and clips the feature to the bbox using -[lineclip][2]. -May result in degenerate edges when clipping Polygons. +Takes a [Feature][1], [Geometry][2] or [FeatureCollection][3] and a bbox and returns the part of the object within the bbox. +Lines and polygons are clipped using [lineclip][4]. +If a Point or LineString geometry is entirely outside the bbox, a [MultiPoint][5] or [MultiLineString][6] with empty `coordinates` array is returned. +LineString geometries may also become MultiLineString if the clipping process cuts them into several pieces. ### Parameters -* `feature` **[Feature][1]<([LineString][3] | [MultiLineString][4] | [Polygon][5] | [MultiPolygon][6])>** feature to clip to the bbox +* `feature` **([Geometry][2] | [Feature][1] | [FeatureCollection][3])** GeoJSON object to clip to the bbox * `bbox` **[BBox][7]** extent in \[minX, minY, maxX, maxY] order ### Examples @@ -25,19 +26,19 @@ var clipped = turf.bboxClip(poly, bbox); var addToMap = [bbox, poly, clipped] ``` -Returns **[Feature][1]<([LineString][3] | [MultiLineString][4] | [Polygon][5] | [MultiPolygon][6])>** clipped Feature +Returns **([Feature][1] | [FeatureCollection][3])** clipped GeoJSON object. [1]: https://tools.ietf.org/html/rfc7946#section-3.2 -[2]: https://github.com/mapbox/lineclip +[2]: https://tools.ietf.org/html/rfc7946#section-3.1 -[3]: https://tools.ietf.org/html/rfc7946#section-3.1.4 +[3]: https://tools.ietf.org/html/rfc7946#section-3.3 -[4]: https://tools.ietf.org/html/rfc7946#section-3.1.5 +[4]: https://github.com/mapbox/lineclip -[5]: https://tools.ietf.org/html/rfc7946#section-3.1.6 +[5]: https://tools.ietf.org/html/rfc7946#section-3.1.3 -[6]: https://tools.ietf.org/html/rfc7946#section-3.1.7 +[6]: https://tools.ietf.org/html/rfc7946#section-3.1.5 [7]: https://tools.ietf.org/html/rfc7946#section-5 diff --git a/packages/turf-bbox-clip/index.ts b/packages/turf-bbox-clip/index.ts index 765dc3942..9d417f92d 100644 --- a/packages/turf-bbox-clip/index.ts +++ b/packages/turf-bbox-clip/index.ts @@ -6,26 +6,37 @@ import { MultiPolygon, GeoJsonProperties, Polygon, + Point, + MultiPoint, + Position, + FeatureCollection, + Geometry, + GeometryCollection, } from "geojson"; import { + featureCollection, + geometryCollection, lineString, multiLineString, + multiPoint, multiPolygon, + point, polygon, } from "@turf/helpers"; import { getGeom } from "@turf/invariant"; import { lineclip, polygonclip } from "./lib/lineclip.js"; /** - * Takes a {@link Feature} and a bbox and clips the feature to the bbox using - * [lineclip](https://github.com/mapbox/lineclip). - * May result in degenerate edges when clipping Polygons. + * Takes a {@link Feature}, {@link Geometry} or {@link FeatureCollection} and a bbox and returns the part of the object within the bbox. + * Lines and polygons are clipped using [lineclip](https://github.com/mapbox/lineclip). + * If a Point or LineString geometry is entirely outside the bbox, a {@link MultiPoint} or {@link MultiLineString} with empty `coordinates` array is returned. + * LineString geometries may also become MultiLineString if the clipping process cuts them into several pieces. * * @function - * @param {Feature} feature feature to clip to the bbox + * @param {Geometry|Feature|FeatureCollection} feature GeoJSON object to clip to the bbox * @param {BBox} bbox extent in [minX, minY, maxX, maxY] order - * @returns {Feature} clipped Feature + * @returns {Feature|FeatureCollection} clipped GeoJSON object. * @example * var bbox = [0, 0, 10, 10]; * var poly = turf.polygon([[[2, 2], [8, 4], [12, 8], [3, 7], [2, 2]]]); @@ -35,15 +46,72 @@ import { lineclip, polygonclip } from "./lib/lineclip.js"; * //addToMap * var addToMap = [bbox, poly, clipped] */ +// pass a specific geometry type or FeatureCollection, get the same type back function bboxClip< - G extends Polygon | MultiPolygon | LineString | MultiLineString, + G extends Point | MultiPoint, P extends GeoJsonProperties = GeoJsonProperties, ->(feature: Feature | G, bbox: BBox) { +>(feature: Feature | G, bbox: BBox): Feature; +function bboxClip< + G extends LineString | MultiLineString, + P extends GeoJsonProperties = GeoJsonProperties, +>( + feature: Feature | G, + bbox: BBox +): Feature; +function bboxClip< + G extends Polygon | MultiPolygon, + P extends GeoJsonProperties = GeoJsonProperties, +>(feature: Feature | G, bbox: BBox): Feature; +function bboxClip< + G extends GeometryCollection, + P extends GeoJsonProperties = GeoJsonProperties, +>(feature: Feature | G, bbox: BBox): Feature; +function bboxClip< + G extends FeatureCollection, + P extends GeoJsonProperties = GeoJsonProperties, +>(feature: G, bbox: BBox): FeatureCollection; + +// pass a non-specific geometry type, get a generic feature back +function bboxClip

( + feature: Feature, + bbox: BBox +): Feature; +function bboxClip(feature: Geometry, bbox: BBox): Feature; + +// "implementation signature", can't be called directly +function bboxClip< + G extends Geometry, + P extends GeoJsonProperties = GeoJsonProperties, +>( + feature: Feature | G | FeatureCollection, + bbox: BBox +): Feature | FeatureCollection { + if (feature.type === "FeatureCollection") { + return featureCollection( + feature.features.map((f: Feature) => bboxClip(f, bbox) as Feature) + ); + } + + // const test = { type: "Point", coordinates: [0, 0] } as Geometry; + // const out = bboxClip(test, bbox); + const geom = getGeom(feature); const type = geom.type; - const properties = feature.type === "Feature" ? feature.properties : {}; - let coords: any[] = geom.coordinates; + const properties: GeoJsonProperties = + feature.type === "Feature" ? feature.properties : {}; + if (type === "GeometryCollection") { + const gs = geom.geometries; + const outGs = gs.map( + (g: Geometry) => (bboxClip(g, bbox) as Feature).geometry + ) as Exclude[]; + return geometryCollection(outGs, properties) as Feature< + GeometryCollection, + P + >; + } + + let coords: any[] = geom.coordinates; switch (type) { case "LineString": case "MultiLineString": { @@ -54,13 +122,15 @@ function bboxClip< coords.forEach((line) => { lineclip(line, bbox, lines); }); - if (lines.length === 1) { + if (lines.length === 1 && type === "LineString") { return lineString(lines[0], properties); } return multiLineString(lines, properties); } - case "Polygon": - return polygon(clipPolygon(coords, bbox), properties); + case "Polygon": { + const poly = clipPolygon(coords, bbox); + return polygon(poly, properties); + } case "MultiPolygon": return multiPolygon( coords.map((poly) => { @@ -68,13 +138,31 @@ function bboxClip< }), properties ); + case "Point": { + const coord = geom.coordinates; + if (checkCoord(coord, bbox)) return point(coord, properties); + return multiPoint([], properties); + } + case "MultiPoint": { + return multiPoint(coords.filter((coord) => checkCoord(coord, bbox))); + } + default: throw new Error("geometry " + type + " not supported"); } } -function clipPolygon(rings: number[][][], bbox: BBox) { - const outRings = []; +function checkCoord(coord: Position, bbox: BBox) { + return ( + coord[0] >= bbox[0] && + coord[1] >= bbox[1] && + coord[0] <= bbox[2] && + coord[1] <= bbox[3] + ); +} + +function clipPolygon(rings: Position[][], bbox: BBox) { + const outRings: Position[][] = []; for (const ring of rings) { const clipped = polygonclip(ring, bbox); if (clipped.length > 0) { diff --git a/packages/turf-bbox-clip/package.json b/packages/turf-bbox-clip/package.json index db1aaa155..148414697 100644 --- a/packages/turf-bbox-clip/package.json +++ b/packages/turf-bbox-clip/package.json @@ -6,7 +6,8 @@ "contributors": [ "Tim Channell <@tcql>", "Vladimir Agafonkin <@mourner>", - "Denis Carriere <@DenisCarriere>" + "Denis Carriere <@DenisCarriere>", + "Steve Bennett <@stevage>" ], "license": "MIT", "bugs": { diff --git a/packages/turf-bbox-clip/test.ts b/packages/turf-bbox-clip/test.ts index 9bd611648..22f6356a7 100644 --- a/packages/turf-bbox-clip/test.ts +++ b/packages/turf-bbox-clip/test.ts @@ -28,14 +28,28 @@ test("turf-bbox-clip", (t) => { const filename = fixture.filename; const name = fixture.name; const geojson = fixture.geojson; - const feature = geojson.features[0]; - const bbox = turfBBox(geojson.features[1]); + const isFeatureCollection = geojson.features.length > 2; + const feature = isFeatureCollection + ? featureCollection(geojson.features.slice(0, -1)) + : geojson.features[0]; + const clipRegion = geojson.features.slice(-1)[0]; + const bbox = turfBBox(clipRegion); const clipped = bboxClip(feature, bbox); - const results = featureCollection([ - colorize(feature, "#080"), - colorize(clipped, "#F00"), - colorize(geojson.features[1], "#00F", 3), - ]); + + let results; + if (isFeatureCollection) { + results = featureCollection([ + ...feature.features.map((f) => colorize(f, "#080", "input")), + ...clipped.features.map((c) => colorize(c, "#F00", "output")), + colorize(clipRegion, "#00F", "clipping bbox", 3), + ]); + } else { + results = featureCollection([ + colorize(feature, "#080", "input"), + colorize(clipped, "#F00", "output"), + colorize(clipRegion, "#00F", "clipping bbox", 3), + ]); + } if (process.env.REGEN) writeJsonFileSync(directories.out + filename, results); @@ -44,15 +58,7 @@ test("turf-bbox-clip", (t) => { t.end(); }); -test("turf-bbox-clip -- throws", (t) => { - t.throws( - () => bboxClip(point([5, 10]), [-180, -90, 180, 90]), - /geometry Point not supported/ - ); - t.end(); -}); - -function colorize(feature, color, width) { +function colorize(feature, color, name, width) { color = color || "#F00"; width = width || 6; feature.properties = { @@ -60,6 +66,7 @@ function colorize(feature, color, width) { fill: color, "stroke-width": width, "fill-opacity": 0.1, + name, }; return feature; } diff --git a/packages/turf-bbox-clip/test/in/feature-collection.geojson b/packages/turf-bbox-clip/test/in/feature-collection.geojson new file mode 100644 index 000000000..099fb80dc --- /dev/null +++ b/packages/turf-bbox-clip/test/in/feature-collection.geojson @@ -0,0 +1,94 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [92.78854443123498, -4.0631420171898185], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [88.80200582619335, -8.780228029258652], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [84.45578448719408, -0.42584674848238535], + [104.00625645806042, -17.30113187521333], + [108.37396514395846, -11.998337187512362] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [95.6755173613135, -5.412355325867296], + [95.6755173613135, -9.59572648513172], + [101.64270834459677, -9.59572648513172], + [101.64270834459677, -5.412355325867296], + [95.6755173613135, -5.412355325867296] + ] + ], + "type": "Polygon" + } + }, + + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [77.58616268346043, -7.556977393000622], + [92.76209967554053, -19.675822211591438], + [84.86920130192482, -25.38820065310992] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [84.5161586806538, 10.150704513809302], + [84.5161586806538, 3.6873648155754495], + [93.5370745092431, 3.6873648155754495], + [93.5370745092431, 10.150704513809302], + [84.5161586806538, 10.150704513809302] + ] + ], + "type": "Polygon" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [91.0644737234989, -0.5254035861065773], + [91.0644737234989, -15.195974906738272], + [98.81078524424902, -15.195974906738272], + [98.81078524424902, -0.5254035861065773], + [91.0644737234989, -0.5254035861065773] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/geometry-collection.geojson b/packages/turf-bbox-clip/test/in/geometry-collection.geojson new file mode 100644 index 000000000..4cb1057bc --- /dev/null +++ b/packages/turf-bbox-clip/test/in/geometry-collection.geojson @@ -0,0 +1,78 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "GeometryCollection", + "geometries": [ + { + "coordinates": [92.78854443123498, -4.0631420171898185], + "type": "Point" + }, + { + "coordinates": [88.80200582619335, -8.780228029258652], + "type": "Point" + }, + { + "coordinates": [ + [84.45578448719408, -0.42584674848238535], + [104.00625645806042, -17.30113187521333], + [108.37396514395846, -11.998337187512362] + ], + "type": "LineString" + }, + { + "coordinates": [ + [ + [95.6755173613135, -5.412355325867296], + [95.6755173613135, -9.59572648513172], + [101.64270834459677, -9.59572648513172], + [101.64270834459677, -5.412355325867296], + [95.6755173613135, -5.412355325867296] + ] + ], + "type": "Polygon" + }, + { + "coordinates": [ + [77.58616268346043, -7.556977393000622], + [92.76209967554053, -19.675822211591438], + [84.86920130192482, -25.38820065310992] + ], + "type": "LineString" + }, + { + "coordinates": [ + [ + [84.5161586806538, 10.150704513809302], + [84.5161586806538, 3.6873648155754495], + [93.5370745092431, 3.6873648155754495], + [93.5370745092431, 10.150704513809302], + [84.5161586806538, 10.150704513809302] + ] + ], + "type": "Polygon" + } + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [91.0644737234989, -0.5254035861065773], + [91.0644737234989, -15.195974906738272], + [98.81078524424902, -15.195974906738272], + [98.81078524424902, -0.5254035861065773], + [91.0644737234989, -0.5254035861065773] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/linestring-outside.geojson b/packages/turf-bbox-clip/test/in/linestring-outside.geojson new file mode 100644 index 000000000..2dd04b4ab --- /dev/null +++ b/packages/turf-bbox-clip/test/in/linestring-outside.geojson @@ -0,0 +1,32 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [84.64117263947469, 27.768789657473377], + [87.96754133213011, 27.75553407987455] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/linestring-two-pieces.geojson b/packages/turf-bbox-clip/test/in/linestring-two-pieces.geojson new file mode 100644 index 000000000..387ef742f --- /dev/null +++ b/packages/turf-bbox-clip/test/in/linestring-two-pieces.geojson @@ -0,0 +1,33 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [60, 47], + [65, 49], + [70, 46] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [58, 48], + [58, 45], + [71, 45], + [71, 48], + [58, 48] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/multipoint-inside-outside.json b/packages/turf-bbox-clip/test/in/multipoint-inside-outside.json new file mode 100644 index 000000000..9c4883ad0 --- /dev/null +++ b/packages/turf-bbox-clip/test/in/multipoint-inside-outside.json @@ -0,0 +1,32 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [83.1, 24.6], + [87.0, 24.5] + ], + "type": "MultiPoint" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/point-inside.geojson b/packages/turf-bbox-clip/test/in/point-inside.geojson new file mode 100644 index 000000000..04ec1ce74 --- /dev/null +++ b/packages/turf-bbox-clip/test/in/point-inside.geojson @@ -0,0 +1,29 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [86.0, 24.6], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/point-outside.geojson b/packages/turf-bbox-clip/test/in/point-outside.geojson new file mode 100644 index 000000000..01a975314 --- /dev/null +++ b/packages/turf-bbox-clip/test/in/point-outside.geojson @@ -0,0 +1,29 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [83.0, 24.6], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/polygon-outside.geojson b/packages/turf-bbox-clip/test/in/polygon-outside.geojson new file mode 100644 index 000000000..cbf0ca59b --- /dev/null +++ b/packages/turf-bbox-clip/test/in/polygon-outside.geojson @@ -0,0 +1,37 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [88.96243031475143, 20.231448613494848], + [87.72712357729051, 19.25794633598106], + [88.84998703480346, 18.12880335033968], + [89.99249247849463, 18.633616551422037], + [88.96243031475143, 20.231448613494848] + ] + ], + "type": "Polygon" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/in/polygon-two-pieces.geojson b/packages/turf-bbox-clip/test/in/polygon-two-pieces.geojson new file mode 100644 index 000000000..5c38247f6 --- /dev/null +++ b/packages/turf-bbox-clip/test/in/polygon-two-pieces.geojson @@ -0,0 +1,37 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [60, 47], + [65, 49], + [70, 46], + [65, 51], + [60, 47] + ] + ], + "type": "Polygon" + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "coordinates": [ + [ + [58, 48], + [58, 45], + [71, 45], + [71, 48], + [58, 48] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/feature-collection.geojson b/packages/turf-bbox-clip/test/out/feature-collection.geojson new file mode 100644 index 000000000..e9e5c6723 --- /dev/null +++ b/packages/turf-bbox-clip/test/out/feature-collection.geojson @@ -0,0 +1,230 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [92.78854443123498, -4.0631420171898185], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [88.80200582619335, -8.780228029258652], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [84.45578448719408, -0.42584674848238535], + [104.00625645806042, -17.30113187521333], + [108.37396514395846, -11.998337187512362] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [ + [95.6755173613135, -5.412355325867296], + [95.6755173613135, -9.59572648513172], + [101.64270834459677, -9.59572648513172], + [101.64270834459677, -5.412355325867296], + [95.6755173613135, -5.412355325867296] + ] + ], + "type": "Polygon" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [77.58616268346043, -7.556977393000622], + [92.76209967554053, -19.675822211591438], + [84.86920130192482, -25.38820065310992] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [ + [84.5161586806538, 10.150704513809302], + [84.5161586806538, 3.6873648155754495], + [93.5370745092431, 3.6873648155754495], + [93.5370745092431, 10.150704513809302], + [84.5161586806538, 10.150704513809302] + ] + ], + "type": "Polygon" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "Point", + "coordinates": [92.78854443123498, -4.0631420171898185] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "MultiPoint", + "coordinates": [] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [91.0644737234989, -6.130236665144828], + [98.81078524424902, -12.816582436640095] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [95.6755173613135, -5.412355325867296], + [95.6755173613135, -9.59572648513172], + [98.81078524424902, -9.59572648513172], + [98.81078524424902, -5.412355325867296], + [95.6755173613135, -5.412355325867296] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "Polygon", + "coordinates": [] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [91.0644737234989, -0.5254035861065773], + [91.0644737234989, -15.195974906738272], + [98.81078524424902, -15.195974906738272], + [98.81078524424902, -0.5254035861065773], + [91.0644737234989, -0.5254035861065773] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/geometry-collection.geojson b/packages/turf-bbox-clip/test/out/geometry-collection.geojson new file mode 100644 index 000000000..b97e1773d --- /dev/null +++ b/packages/turf-bbox-clip/test/out/geometry-collection.geojson @@ -0,0 +1,140 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "type": "GeometryCollection", + "geometries": [ + { + "coordinates": [92.78854443123498, -4.0631420171898185], + "type": "Point" + }, + { + "coordinates": [88.80200582619335, -8.780228029258652], + "type": "Point" + }, + { + "coordinates": [ + [84.45578448719408, -0.42584674848238535], + [104.00625645806042, -17.30113187521333], + [108.37396514395846, -11.998337187512362] + ], + "type": "LineString" + }, + { + "coordinates": [ + [ + [95.6755173613135, -5.412355325867296], + [95.6755173613135, -9.59572648513172], + [101.64270834459677, -9.59572648513172], + [101.64270834459677, -5.412355325867296], + [95.6755173613135, -5.412355325867296] + ] + ], + "type": "Polygon" + }, + { + "coordinates": [ + [77.58616268346043, -7.556977393000622], + [92.76209967554053, -19.675822211591438], + [84.86920130192482, -25.38820065310992] + ], + "type": "LineString" + }, + { + "coordinates": [ + [ + [84.5161586806538, 10.150704513809302], + [84.5161586806538, 3.6873648155754495], + [93.5370745092431, 3.6873648155754495], + [93.5370745092431, 10.150704513809302], + [84.5161586806538, 10.150704513809302] + ] + ], + "type": "Polygon" + } + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "GeometryCollection", + "geometries": [ + { + "type": "Point", + "coordinates": [92.78854443123498, -4.0631420171898185] + }, + { + "type": "MultiPoint", + "coordinates": [] + }, + { + "type": "LineString", + "coordinates": [ + [91.0644737234989, -6.130236665144828], + [98.81078524424902, -12.816582436640095] + ] + }, + { + "type": "Polygon", + "coordinates": [ + [ + [95.6755173613135, -5.412355325867296], + [95.6755173613135, -9.59572648513172], + [98.81078524424902, -9.59572648513172], + [98.81078524424902, -5.412355325867296], + [95.6755173613135, -5.412355325867296] + ] + ] + }, + { + "type": "MultiLineString", + "coordinates": [] + }, + { + "type": "Polygon", + "coordinates": [] + } + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [91.0644737234989, -0.5254035861065773], + [91.0644737234989, -15.195974906738272], + [98.81078524424902, -15.195974906738272], + [98.81078524424902, -0.5254035861065773], + [91.0644737234989, -0.5254035861065773] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/linestring-outside.geojson b/packages/turf-bbox-clip/test/out/linestring-outside.geojson new file mode 100644 index 000000000..d00c7b2e9 --- /dev/null +++ b/packages/turf-bbox-clip/test/out/linestring-outside.geojson @@ -0,0 +1,58 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [84.64117263947469, 27.768789657473377], + [87.96754133213011, 27.75553407987455] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/linestring-single-line.geojson b/packages/turf-bbox-clip/test/out/linestring-single-line.geojson index 58e23f2c9..791ea69cb 100644 --- a/packages/turf-bbox-clip/test/out/linestring-single-line.geojson +++ b/packages/turf-bbox-clip/test/out/linestring-single-line.geojson @@ -7,7 +7,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "geometry": { "type": "LineString", @@ -24,7 +25,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "LineString", @@ -41,7 +43,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon", diff --git a/packages/turf-bbox-clip/test/out/linestring-two-pieces.geojson b/packages/turf-bbox-clip/test/out/linestring-two-pieces.geojson new file mode 100644 index 000000000..89c519802 --- /dev/null +++ b/packages/turf-bbox-clip/test/out/linestring-two-pieces.geojson @@ -0,0 +1,68 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [60, 47], + [65, 49], + [70, 46] + ], + "type": "LineString" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [ + [ + [60, 47], + [62.5, 48] + ], + [ + [66.66666666666667, 48], + [70, 46] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [58, 48], + [58, 45], + [71, 45], + [71, 48], + [58, 48] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/linestring.geojson b/packages/turf-bbox-clip/test/out/linestring.geojson index e2790b756..4928f55f8 100644 --- a/packages/turf-bbox-clip/test/out/linestring.geojson +++ b/packages/turf-bbox-clip/test/out/linestring.geojson @@ -1080,7 +1080,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "type": "Feature" }, @@ -1090,7 +1091,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "MultiLineString", @@ -1763,7 +1765,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon", diff --git a/packages/turf-bbox-clip/test/out/multi-linestring.geojson b/packages/turf-bbox-clip/test/out/multi-linestring.geojson index 2cf362123..715f8e252 100644 --- a/packages/turf-bbox-clip/test/out/multi-linestring.geojson +++ b/packages/turf-bbox-clip/test/out/multi-linestring.geojson @@ -7,7 +7,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "geometry": { "type": "MultiLineString", @@ -40,7 +41,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "MultiLineString", @@ -69,7 +71,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon", diff --git a/packages/turf-bbox-clip/test/out/multi-polygon.geojson b/packages/turf-bbox-clip/test/out/multi-polygon.geojson index 4d052ed8e..6f0ab1401 100644 --- a/packages/turf-bbox-clip/test/out/multi-polygon.geojson +++ b/packages/turf-bbox-clip/test/out/multi-polygon.geojson @@ -1097,7 +1097,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "type": "Feature" }, @@ -1107,7 +1108,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "MultiPolygon", @@ -1451,7 +1453,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon", diff --git a/packages/turf-bbox-clip/test/out/multipoint-inside-outside.json b/packages/turf-bbox-clip/test/out/multipoint-inside-outside.json new file mode 100644 index 000000000..8f513bca3 --- /dev/null +++ b/packages/turf-bbox-clip/test/out/multipoint-inside-outside.json @@ -0,0 +1,58 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [83.1, 24.6], + [87, 24.5] + ], + "type": "MultiPoint" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "MultiPoint", + "coordinates": [[87, 24.5]] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/point-inside.geojson b/packages/turf-bbox-clip/test/out/point-inside.geojson new file mode 100644 index 000000000..2027e440c --- /dev/null +++ b/packages/turf-bbox-clip/test/out/point-inside.geojson @@ -0,0 +1,55 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [86, 24.6], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "Point", + "coordinates": [86, 24.6] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/point-outside.geojson b/packages/turf-bbox-clip/test/out/point-outside.geojson new file mode 100644 index 000000000..e02b46c75 --- /dev/null +++ b/packages/turf-bbox-clip/test/out/point-outside.geojson @@ -0,0 +1,55 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [83, 24.6], + "type": "Point" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "MultiPoint", + "coordinates": [] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/polygon-crossing-hole.geojson b/packages/turf-bbox-clip/test/out/polygon-crossing-hole.geojson index ea35c4e00..923c722bd 100644 --- a/packages/turf-bbox-clip/test/out/polygon-crossing-hole.geojson +++ b/packages/turf-bbox-clip/test/out/polygon-crossing-hole.geojson @@ -1090,7 +1090,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "type": "Feature" }, @@ -1100,7 +1101,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "Polygon", @@ -1322,7 +1324,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon", diff --git a/packages/turf-bbox-clip/test/out/polygon-holes.geojson b/packages/turf-bbox-clip/test/out/polygon-holes.geojson index 8f1854352..c992817b1 100644 --- a/packages/turf-bbox-clip/test/out/polygon-holes.geojson +++ b/packages/turf-bbox-clip/test/out/polygon-holes.geojson @@ -1097,7 +1097,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "type": "Feature" }, @@ -1107,7 +1108,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "Polygon", @@ -1396,7 +1398,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon", diff --git a/packages/turf-bbox-clip/test/out/polygon-outside.geojson b/packages/turf-bbox-clip/test/out/polygon-outside.geojson new file mode 100644 index 000000000..50ad1933f --- /dev/null +++ b/packages/turf-bbox-clip/test/out/polygon-outside.geojson @@ -0,0 +1,63 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [ + [88.96243031475143, 20.231448613494848], + [87.72712357729051, 19.25794633598106], + [88.84998703480346, 18.12880335033968], + [89.99249247849463, 18.633616551422037], + [88.96243031475143, 20.231448613494848] + ] + ], + "type": "Polygon" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "Polygon", + "coordinates": [] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [84.69580856761752, 25.3651953396419], + [84.69580856761752, 22.90862421319129], + [88.38119495093474, 22.90862421319129], + [88.38119495093474, 25.3651953396419], + [84.69580856761752, 25.3651953396419] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/polygon-point-intersection.geojson b/packages/turf-bbox-clip/test/out/polygon-point-intersection.geojson index e1f2e7a72..9bb8ab62a 100644 --- a/packages/turf-bbox-clip/test/out/polygon-point-intersection.geojson +++ b/packages/turf-bbox-clip/test/out/polygon-point-intersection.geojson @@ -7,7 +7,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "geometry": { "type": "Polygon", @@ -32,7 +33,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "Polygon", @@ -45,7 +47,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon", diff --git a/packages/turf-bbox-clip/test/out/polygon-two-pieces.geojson b/packages/turf-bbox-clip/test/out/polygon-two-pieces.geojson new file mode 100644 index 000000000..eefe89dbb --- /dev/null +++ b/packages/turf-bbox-clip/test/out/polygon-two-pieces.geojson @@ -0,0 +1,73 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "stroke": "#080", + "fill": "#080", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "input" + }, + "geometry": { + "coordinates": [ + [ + [60, 47], + [65, 49], + [70, 46], + [65, 51], + [60, 47] + ] + ], + "type": "Polygon" + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#F00", + "fill": "#F00", + "stroke-width": 6, + "fill-opacity": 0.1, + "name": "output" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [60, 47], + [62.5, 48], + [66.66666666666667, 48], + [70, 46], + [68, 48], + [61.25, 48], + [60, 47] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke": "#00F", + "fill": "#00F", + "stroke-width": 3, + "fill-opacity": 0.1, + "name": "clipping bbox" + }, + "geometry": { + "coordinates": [ + [ + [58, 48], + [58, 45], + [71, 45], + [71, 48], + [58, 48] + ] + ], + "type": "Polygon" + } + } + ] +} diff --git a/packages/turf-bbox-clip/test/out/polygon.geojson b/packages/turf-bbox-clip/test/out/polygon.geojson index 747fd31ea..c57a11e85 100644 --- a/packages/turf-bbox-clip/test/out/polygon.geojson +++ b/packages/turf-bbox-clip/test/out/polygon.geojson @@ -1083,7 +1083,8 @@ "stroke": "#080", "fill": "#080", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "input" }, "type": "Feature" }, @@ -1093,7 +1094,8 @@ "stroke": "#F00", "fill": "#F00", "stroke-width": 6, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "output" }, "geometry": { "type": "Polygon", @@ -1638,7 +1640,8 @@ "stroke": "#00F", "fill": "#00F", "stroke-width": 3, - "fill-opacity": 0.1 + "fill-opacity": 0.1, + "name": "clipping bbox" }, "geometry": { "type": "Polygon",