transformScale Not Working?
johnstrawserjr opened this issue · comments
Using turf 6.5
Using Leaflet 1.8
If I use a number besides "1" as the transform scale, it is shifting the coordinates way off to the east.
var poly = turf.polygon([[ [45.09917318321617, -93.55466839417353], [45.09940843404584, -93.55428753922236], [45.09966047090112, -93.55445418588944], [45.09917318321617, -93.55466839417353,] ]]); var scaledPoly = turf.transformScale(poly, 1); //any number besides 1 doesn't work L.polygon(poly.geometry.coordinates, { fillOpacity: .5, color: 'orange', interactive: false, stroke: false, }).addTo(map); L.polygon(scaledPoly.geometry.coordinates, { fillOpacity: 1, color: 'green', interactive: false, stroke: false, }).addTo(map);
https://jsfiddle.net/q7hnuptf/8/
Notice in the console logs, the 3rd set of coordinates gets sent very far east. It doesnt seem to matter what options I use for the "origin" option.
var poly = turf.polygon([[
[45.09917318321617, -93.55466839417353],
[45.09940843404584, -93.55428753922236],
[45.09966047090112, -93.55445418588944],
[45.09917318321617, -93.55466839417353,]
]]);
var scaledPoly = turf.transformScale(poly, 1); //any number besides 1 doesn't work
L.polygon(poly.geometry.coordinates, { fillOpacity: .5, color: 'orange', interactive: false, stroke: false, }).addTo(map);
L.polygon(scaledPoly.geometry.coordinates, { fillOpacity: 1, color: 'green', interactive: false, stroke: false, }).addTo(map);
I think I'm having the same issue, and I think it's because some of the coordinates are negative? Did you find a workaround?
{
type: 'Feature',
properties: {},
geometry: {
type: 'Polygon',
coordinates: [
[
[0, -126.23338476660471],
[109.32131801357527, 63.116692383302336],
[-109.32131801357522, 63.116692383302414],
[0, -126.23338476660471],
],
],
},
}
@aubergene - I had my coordinates swapped (lat/long instead of long/lat)