Plot Points Based on Distances Between Them

Posted by in House, Software

My problem this days is:

I need to provide a drawing of trees on my plot of land in order to see which can be spared when building the house.

The easiest way to do this is to measure the distance between the said trees, add some basic coordinates (to place them within the plot of land) and build a drawing. Initially I thought of building the algorithm myself (or even drawing them by hand), but I found something online, based on d3.js, namely a force-directed graph.

I have adjusted the source code to contain a single group and a dummy node named “0”. Given that I wanted a quick run, I only created an index.html file with the following layout:

  • Header and style

  • The document start tags:

  • The graph (not complete though):

  • The directed graph drawing:

  • The closure tags:

This HTML code will generate the layout with distances between trees (note the linkDistance() function call above and this SO answer).


A little experiment: If you find this post and ad below useful, please check the ad out 🙂