Unknown GeoJSON type: undefined
because one of the data inputs is vector tiles. I found a question on this back in 2016, but looking for a current answer/resource that will help me learn a) whether I need to convert the vt to geojson and b) best method for doing this client side. Maybe the best answer is to just use a geojson source to begin with?
Hi, I've noticed that when I generate a square grid, whether it's with degrees or radians, the cell dimensions don't match up:
> turf.squareGrid([28.225,27.925,29.275,29], .025 * Math.PI / 180, {units: 'radians'})
...
> turf.squareGrid([28.225,27.925,29.275,29], .025 * Math.PI / 180, {units: 'radians'}).features[0].geometry.coordinates
[
[
[ 28.226548620665543, 27.9375 ],
[ 28.226548620665543, 27.9625 ],
[ 28.25484328981876, 27.9625 ],
[ 28.25484328981876, 27.9375 ],
[ 28.226548620665543, 27.9375 ]
]
]
As you can see, the latitudes are separated by the correct distance (.025) while the longitudes don't. The longitudes are not on the same grid as the provided bounding box. Is there an explanation for this? I've done a bunch of googling but haven't found any reasoning. Checking the source now...
Well, that's not really the issue. But this is:
> turf.distance([28.225, 27.925], [29.275, 27.925], {units: 'degrees'})
0.9266538967022185
> 29.275-28.225
1.0499999999999972
Is there an explanation for this? I guess I'll just gut rectangularGrid for my needs...
const polygonBbox = bbox(poly);
const truncatedPoints = truncate(
randomPoint(pointsLimit, { bbox: polygonBbox }),
truncateOptions,
);
return pointsWithinPolygon(truncatedPoints, poly).features.map(getPointCoords);