I'm trying to project nodes using the d3-geo
and reactflow
libraries. The nodes xPos
and yPos
(x
and y
positions) are longitudes
and latitudes
. And I use the below approach to map those positions to pixels.
const projection = geoEquirectangular();
const mappedNodes = initialNodes.map((node) => {
const [x, y] = projection([node.position.x, node.position.y]);
return { ...node, position: { x, y } };
});
As the geo points are close to each other the nodes are overlapped. Is there a way to scale and project? Is this the correct approach for solving the issue?