diff --git a/packages/turf-destination/index.ts b/packages/turf-destination/index.ts index a5352994cf..513b11615f 100644 --- a/packages/turf-destination/index.ts +++ b/packages/turf-destination/index.ts @@ -66,7 +66,9 @@ function destination

( ); const lng = radiansToDegrees(longitude2); const lat = radiansToDegrees(latitude2); - + if (coordinates1[2] !== undefined) { + return point([lng, lat, coordinates1[2]], options.properties); + } return point([lng, lat], options.properties); } diff --git a/packages/turf-destination/package.json b/packages/turf-destination/package.json index 5bc1e501d6..30539ea919 100644 --- a/packages/turf-destination/package.json +++ b/packages/turf-destination/package.json @@ -3,6 +3,9 @@ "version": "7.2.0", "description": "turf destination module", "author": "Turf Authors", + "contributors": [ + "Pavel Rozvora <@prozvora>" + ], "license": "MIT", "bugs": { "url": "https://github.com/Turfjs/turf/issues" diff --git a/packages/turf-destination/test/in/point-0-with-elevation.geojson b/packages/turf-destination/test/in/point-0-with-elevation.geojson new file mode 100644 index 0000000000..6a89c09bbd --- /dev/null +++ b/packages/turf-destination/test/in/point-0-with-elevation.geojson @@ -0,0 +1,10 @@ +{ + "type": "Feature", + "properties": { + "bearing": 0 + }, + "geometry": { + "type": "Point", + "coordinates": [-75, 38.10096062273525, 100] + } +} diff --git a/packages/turf-destination/test/out/point-0-with-elevation.geojson b/packages/turf-destination/test/out/point-0-with-elevation.geojson new file mode 100644 index 0000000000..d8fa826d74 --- /dev/null +++ b/packages/turf-destination/test/out/point-0-with-elevation.geojson @@ -0,0 +1,34 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "bearing": 0 + }, + "geometry": { + "type": "Point", + "coordinates": [-75, 38.10096062273525, 100] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-75, 39.000281, 100] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [-75, 38.10096062273525, 100], + [-75, 39.000281, 100] + ] + } + } + ] +} diff --git a/packages/turf-ellipse/package.json b/packages/turf-ellipse/package.json index ad34aefefc..2a34c14bf7 100644 --- a/packages/turf-ellipse/package.json +++ b/packages/turf-ellipse/package.json @@ -4,7 +4,8 @@ "description": "Takes a Point and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision.", "author": "Turf Authors", "contributors": [ - "Moacir P. de Sá Pereira <@muziejus>" + "Moacir P. de Sá Pereira <@muziejus>", + "Pavel Rozvora <@prozvora>" ], "license": "MIT", "bugs": { diff --git a/packages/turf-ellipse/test/in/simple-with-elevation.json b/packages/turf-ellipse/test/in/simple-with-elevation.json new file mode 100644 index 0000000000..9092acee05 --- /dev/null +++ b/packages/turf-ellipse/test/in/simple-with-elevation.json @@ -0,0 +1,11 @@ +{ + "type": "Feature", + "properties": { + "xSemiAxis": 5, + "ySemiAxis": 1 + }, + "geometry": { + "type": "Point", + "coordinates": [-73.9975, 40.730833, 120] + } +} diff --git a/packages/turf-ellipse/test/out/simple-with-elevation.json b/packages/turf-ellipse/test/out/simple-with-elevation.json new file mode 100644 index 0000000000..7316bb4b25 --- /dev/null +++ b/packages/turf-ellipse/test/out/simple-with-elevation.json @@ -0,0 +1,259 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "xSemiAxis": 5, + "ySemiAxis": 1 + }, + "geometry": { + "type": "Point", + "coordinates": [-73.9975, 40.730833, 120] + } + }, + { + "type": "Feature", + "properties": { + "stroke-width": 6, + "stroke": "#F00", + "fill": "#F00", + "fill-opacity": 0 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [-73.9975, 40.775799, 120], + [-74.00332, 40.775582, 120], + [-74.009084, 40.774934, 120], + [-74.014736, 40.773862, 120], + [-74.020222, 40.772374, 120], + [-74.025489, 40.770486, 120], + [-74.030485, 40.768216, 120], + [-74.035164, 40.765586, 120], + [-74.039479, 40.762621, 120], + [-74.043389, 40.75935, 120], + [-74.046857, 40.755804, 120], + [-74.049849, 40.752018, 120], + [-74.052336, 40.748028, 120], + [-74.054295, 40.743872, 120], + [-74.055706, 40.739591, 120], + [-74.056557, 40.735225, 120], + [-74.056839, 40.730818, 120], + [-74.056549, 40.726411, 120], + [-74.055691, 40.722046, 120], + [-74.054273, 40.717766, 120], + [-74.052308, 40.713612, 120], + [-74.049816, 40.709624, 120], + [-74.04682, 40.705841, 120], + [-74.04335, 40.702298, 120], + [-74.039439, 40.69903, 120], + [-74.035125, 40.696068, 120], + [-74.030448, 40.69344, 120], + [-74.025456, 40.691173, 120], + [-74.020194, 40.689288, 120], + [-74.014714, 40.687802, 120], + [-74.009069, 40.68673, 120], + [-74.003312, 40.686083, 120], + [-73.9975, 40.685867, 120], + [-73.991688, 40.686083, 120], + [-73.985931, 40.68673, 120], + [-73.980286, 40.687802, 120], + [-73.974806, 40.689288, 120], + [-73.969544, 40.691173, 120], + [-73.964552, 40.69344, 120], + [-73.959875, 40.696068, 120], + [-73.955561, 40.69903, 120], + [-73.95165, 40.702298, 120], + [-73.94818, 40.705841, 120], + [-73.945184, 40.709624, 120], + [-73.942692, 40.713612, 120], + [-73.940727, 40.717766, 120], + [-73.939309, 40.722046, 120], + [-73.938451, 40.726411, 120], + [-73.938161, 40.730818, 120], + [-73.938443, 40.735225, 120], + [-73.939294, 40.739591, 120], + [-73.940705, 40.743872, 120], + [-73.942664, 40.748028, 120], + [-73.945151, 40.752018, 120], + [-73.948143, 40.755804, 120], + [-73.951611, 40.75935, 120], + [-73.955521, 40.762621, 120], + [-73.959836, 40.765586, 120], + [-73.964515, 40.768216, 120], + [-73.969511, 40.770486, 120], + [-73.974778, 40.772374, 120], + [-73.980264, 40.773862, 120], + [-73.985916, 40.774934, 120], + [-73.99168, 40.775582, 120], + [-73.9975, 40.775799, 120] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke-width": 6, + "stroke": "#00F", + "fill": "#00F", + "fill-opacity": 0 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [-74.056839, 40.730818, 120], + [-74.055302, 40.732853, 120], + [-74.052325, 40.734262, 120], + [-74.048754, 40.735355, 120], + [-74.044876, 40.736239, 120], + [-74.040832, 40.73697, 120], + [-74.036706, 40.737578, 120], + [-74.032549, 40.738085, 120], + [-74.028398, 40.738507, 120], + [-74.024279, 40.738856, 120], + [-74.020211, 40.739139, 120], + [-74.016209, 40.739366, 120], + [-74.012284, 40.739542, 120], + [-74.008444, 40.739671, 120], + [-74.004697, 40.73976, 120], + [-74.001048, 40.73981, 120], + [-73.9975, 40.739826, 120], + [-73.993952, 40.73981, 120], + [-73.990303, 40.73976, 120], + [-73.986556, 40.739671, 120], + [-73.982716, 40.739542, 120], + [-73.978791, 40.739366, 120], + [-73.974789, 40.739139, 120], + [-73.970721, 40.738856, 120], + [-73.966602, 40.738507, 120], + [-73.962451, 40.738085, 120], + [-73.958294, 40.737578, 120], + [-73.954168, 40.73697, 120], + [-73.950124, 40.736239, 120], + [-73.946246, 40.735355, 120], + [-73.942675, 40.734262, 120], + [-73.939698, 40.732853, 120], + [-73.938161, 40.730818, 120], + [-73.939701, 40.728784, 120], + [-73.942681, 40.727378, 120], + [-73.946253, 40.726289, 120], + [-73.950132, 40.725407, 120], + [-73.954176, 40.72468, 120], + [-73.958302, 40.724075, 120], + [-73.962459, 40.72357, 120], + [-73.966609, 40.723151, 120], + [-73.970728, 40.722804, 120], + [-73.974795, 40.722522, 120], + [-73.978796, 40.722297, 120], + [-73.98272, 40.722122, 120], + [-73.986559, 40.721994, 120], + [-73.990305, 40.721906, 120], + [-73.993953, 40.721856, 120], + [-73.9975, 40.72184, 120], + [-74.001047, 40.721856, 120], + [-74.004695, 40.721906, 120], + [-74.008441, 40.721994, 120], + [-74.01228, 40.722122, 120], + [-74.016204, 40.722297, 120], + [-74.020205, 40.722522, 120], + [-74.024272, 40.722804, 120], + [-74.028391, 40.723151, 120], + [-74.032541, 40.72357, 120], + [-74.036698, 40.724075, 120], + [-74.040824, 40.72468, 120], + [-74.044868, 40.725407, 120], + [-74.048747, 40.726289, 120], + [-74.052319, 40.727378, 120], + [-74.055299, 40.728784, 120], + [-74.056839, 40.730818, 120] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke-width": 6, + "stroke": "#0F0", + "fill": "#0F0", + "fill-opacity": 0 + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [-73.9975, 40.775799, 120], + [-73.994813, 40.774633, 120], + [-73.992956, 40.772376, 120], + [-73.991515, 40.769669, 120], + [-73.990349, 40.76673, 120], + [-73.989387, 40.763666, 120], + [-73.988587, 40.760539, 120], + [-73.987919, 40.757389, 120], + [-73.987364, 40.754244, 120], + [-73.986906, 40.751122, 120], + [-73.986533, 40.74804, 120], + [-73.986235, 40.745008, 120], + [-73.986004, 40.742034, 120], + [-73.985834, 40.739125, 120], + [-73.985719, 40.736286, 120], + [-73.985653, 40.73352, 120], + [-73.985632, 40.730832, 120], + [-73.985654, 40.728144, 120], + [-73.985721, 40.725379, 120], + [-73.985837, 40.72254, 120], + [-73.986008, 40.719631, 120], + [-73.98624, 40.716657, 120], + [-73.986538, 40.713625, 120], + [-73.986912, 40.710543, 120], + [-73.987371, 40.707422, 120], + [-73.987927, 40.704276, 120], + [-73.988595, 40.701126, 120], + [-73.989395, 40.697999, 120], + [-73.990357, 40.694935, 120], + [-73.991522, 40.691996, 120], + [-73.992961, 40.68929, 120], + [-73.994817, 40.687033, 120], + [-73.9975, 40.685867, 120], + [-74.000183, 40.687033, 120], + [-74.002039, 40.68929, 120], + [-74.003478, 40.691996, 120], + [-74.004643, 40.694935, 120], + [-74.005605, 40.697999, 120], + [-74.006405, 40.701126, 120], + [-74.007073, 40.704276, 120], + [-74.007629, 40.707422, 120], + [-74.008088, 40.710543, 120], + [-74.008462, 40.713625, 120], + [-74.00876, 40.716657, 120], + [-74.008992, 40.719631, 120], + [-74.009163, 40.72254, 120], + [-74.009279, 40.725379, 120], + [-74.009346, 40.728144, 120], + [-74.009368, 40.730832, 120], + [-74.009347, 40.73352, 120], + [-74.009281, 40.736286, 120], + [-74.009166, 40.739125, 120], + [-74.008996, 40.742034, 120], + [-74.008765, 40.745008, 120], + [-74.008467, 40.74804, 120], + [-74.008094, 40.751122, 120], + [-74.007636, 40.754244, 120], + [-74.007081, 40.757389, 120], + [-74.006413, 40.760539, 120], + [-74.005613, 40.763666, 120], + [-74.004651, 40.76673, 120], + [-74.003485, 40.769669, 120], + [-74.002044, 40.772376, 120], + [-74.000187, 40.774633, 120], + [-73.9975, 40.775799, 120] + ] + ] + } + } + ] +}