Showing posts with label plotting. Show all posts
Showing posts with label plotting. Show all posts

Monday, November 16, 2026

Calculating Target Inter-Seedling Distance on Tree Planting Sites

 One of the most common questions that a crew leader hears when arriving to a new tree planting block is "what's the density?"

 And almost as common, when a crew leader tells a new planter what the density is supposed to be, the planter will ask "what spacing [between trees] is that?"  (And let's call this number the nominal Contract Spacing). 

 Despite my recent series of posts about using AI as a tool to help with a lot of reforestation management tasks, this post is completely unrelated to AI.

 Several years ago, inter-tree spacing was briefly an active topic on the Replant forums.  We were trying to figure out how to properly calculate the exact average spacing required between trees in order to properly hit a target density on a block.  I didn't ever feel that we resolved that discussion satisfactorily.  A few weeks ago, I was reviewing a public tree planting tender in BC that listed the target spacing as 3.1m, and I wondered how they calculated that number.  Incidentally, they were suggesting that a target spacing of 3.1m would result in achieving 1200 stems/hectare overall density.

 Let's start by looking at this Spacing Chart.  Where did I get these numbers?  I pulled them from Appendix 1 of British Columbia's Planting Quality Inspection Guide, which offers guidance for completing FS 704 Planting Quality Assessments.  This guide is produced by BC's Ministry of Forests, Lands, and Natural Resource Operations.

 


 

 By the way, if you'd like to see a copy of the full Guide, go to our public Dropbox folder at www.replant.ca/dropbox and then go into the "Canadian Reforestation" sub-folder, then into the "Documents Archive" sub-folder, then look for the PDF called "FS704 Planting Quality Inspection System."

 I should point out, before I go into a deep dive on this subject, that I understand it a lot better now than I did a decade ago.  I've been taking GIS courses from BCIT for the past several years, and a lot of them touch upon surface topology, triangulated irregular networks, etc.  So this post will address a lot of different ways of looking at a subject, rather than just some simple math.

 Let's start by looking specifically at density of 1200 stems/hectare (1200sph).  My chart above shows an average spacing (nominal contract spacing) of 3.1m between trees.  Other publications might suggest an average spacing of 2.89m between trees.  This difference is around twenty centimetres, which doesn't sound like much.  However, that's very significant when extrapolated across an entire planting block.

 Both numbers may have mathematical calculations supporting them, so which one is correct?  Well, both are.  This is because they represent two slightly different ways of calculating the amount of ground that each individual tree occupies.  To keep things simple (for now), the difference comes down to whether you're thinking about "square spacing" or "triangular spacing."

 

Square Spacing 

 Some people think that a "perfect" block would be a plowed farmer's field, with trees planted in a perfect square grid.  There are no rocks or logs on the ground that would prevent the planter from putting the seedlings in the perfect microsites that result in this perfect square spacing.  Visual representations will really help out here.  If we're planting a "square grid" the seedlings should be arranged roughly like this:

 


 

In such a situation, the average distance to the nearest neighbour should be represented by the following formula:


 

So in this case, let's say that spacing works out to the square root of (10000/1200) or 2.89 meters between trees.  Ok, that's good, because that's one of our popular choices mentioned in the introduction.

 We also have to count "closest neighbours."  In this type of grid, our average spacing is based upon the distance to the FOUR closest neighbours. 

 

Triangular Spacing

 What if we still have a perfectly spaced grid, almost like a hexagonal honeycomb pattern, but this time the spacing is based on triangles?  This seems a lot better in my mind, because we often teach planters to "make triangles" when we're teaching spacing.  In such a case, a "perfect" block with triangular spacing might look like this:

 


 
In this new situation, the average spacing to the nearest neighbour should be represented by the following formula:


 In this case, the spacing should work out to be the square root of (20000/(1200 x sqrt 3)).  This works out to be 3.10 meters between trees, the other of our popular choices.  And this is also the choice that BC's Ministry of Forests picked, which I'd support, because I'd argue that it more closely matches what we find in the field.

 I'll also point out that in this type of grid, our average spacing to the closest tree is based upon spacing to our SIX closest neighbours.  Also, an assumption is that all of our triangles are perfect equilateral triangles.

 

Irregular Spacing

 Let's be honest, planting blocks are almost never slash-free and rock-free and perfectly flat.  So it's effectively impossible to plant trees in a perfect grid.  And even in those very rare cases where it's possible, I'd quickly argue that it would be stupid for a planter to try.  Why waste time trying to achieving perfection when "95% of perfect" is also acceptable?  That's the sort of concept that a lot of quality assessment systems use as an underlying assumption.  Assuming that "almost perfect" is an acceptable goal is the best way to effectively balance quality against production.  Both are important goals.

 Also, Mother Nature doesn't grow trees in perfect grids.  If we're trying to emulate Nature, then we should be aiming for some randomized spacing.

So let's look at a grid where the trees are spaced completely randomly.

 


 

In this example, trees are placed truly randomly.  This is what we'd encounter if a professional tree planter closed their eyes to pick microsites.  In a case like this, how do we pick how many "closest neighbours" we have?  That's the first big problem.  Also, planters don't generally plant trees like this.  We have spacing rules that need to be respected:

"Maximum Spacing" - the FS 704 doesn't have a fault for spacing that is significantly greater than target spacing.  There is a fault code, B2 (wide spacing) but this is a warning rather than a fault.  A planter only takes a hit on wide spacing if the spacing is so wide that a missed spot is created, which hits quality in a different way than a direct fault (wide spacing can indirectly lower quality by increasing the number of plantable spots).  But to keep things simple, let's assume that we don't want to space our trees too far apart, partly because of the "wide spacing" rules and partly because we make money by planting trees.  We don't want to do unnecessary walking without planting, if possible.

"Minimum Spacing" - the FS 704 does have a specific fault for spacing that is under a specified "minimum inter-tree distance" (MITD).  That's fault code B1, also known as "Too Close."  Every contract will specify a specific minimum spacing, and trees that are closer to each other than that MITD results in one fault for each pair of trees (if it could have been moved to an acceptable spot).  Typical MITDs usually seem to be 1.5m or 1.6m on most contracts.  Occasionally, we still see minimums of 2.0m, but that's becoming less common, and is usually only on blocks with densities of 1200sph or lower.

 So if a planter is being conscientious about trying not to have double-plants or trees planted at less than MITD to another tree, then we shouldn't have any trees as close to each other as might be expected when they're placed randomly.  I'll even go so far as to suggest that we can come up with an estimate of what the "minimum" and "maximum" spacing might be.

 I think that it's fairly common to say that we won't see many trees at less than 1/2 of the target spacing, if a planter is paying attention and the block isn't especially green, or if the planter is using ribbon.  And I'll also say that because we don't want to walk unnecessarily, we won't see many trees at greater than 3/2 of the target spacing.  So if the target spacing on a hypothetical block is 3.0m between trees, I'll suggest that in most cases we probably won't see too many trees under 2.0m and we won't see too many trees at greater than 4.5m spacing.  Let me be very clear though:  This generalization is based simple on field experience and has absolutely no basis in real math/geometry!  It's not always accurate either.  But it's a good way to temporarily create an assumption for the next step.  Let's pretend that our trees are spaced randomly, but none of them are less than 2 meters apart, and none of them are more than 4.5 meters apart.  Our new "random grid" might look something like this:

 


 In my mind, this type of semi-random pattern (random but with minimum and maximum spacing constraints) is what I consider to be "perfect" spacing.  It's not symmetrical, nor is it mathematically perfect.  But it partially emulates the randomness of nature while introducing artificial constraints that maximum overall "elbow room" for each individual tree, which often [but not always] contributes to maximizing long-term growth for each tree as it competes for environmental resources.

 Our problem now is to come up with a formula that recognizes this irregularity.

 I'll be clear up front:  I can't.

 My problem here is that I can't come up with any way to decide how many of the "closest neighbours" should be considered when coming up with an average spacing from those neighbours.  Should we consider our 3 closest neighbours?  4 closest?  6 closest?  Or a varying number which fluctuates based upon the relative positioning of random trees?  The number of closest neighbours used will affect the answer to a new target spacing formula.

 To be accurate, if I know the exact locations of all the trees on the block, then I can use the "mean nearest-neighbour distance" - but that only helps me figure out data for a block that has already been planted.  I could use the homogenous Poisson Point Process, but that doesn't allow for minimum spacing constraints. 

 We can't assume that average spacing is the average of "minimum spacing" and "maximum spacing," partly because those terms can't technically be defined (although I suppose minimum could equal zero).  Also, even if they could be defined, is there a standard bell-shaped distribution between the two extremes, or is it more likely to see trees closer to the minimum than to the maximum?  I just can't figure out a world where I could come up with a defensible assumption for these variables.

 If we use pattern factors, and introduce a dimensionless factor representing the spatial arrangement of the trees, we can come up with a formula which lets us calculate the average distance to the closest tree.  But that's useless, because that's a small value which is pretty useless for a planter.  We can't answer, "What spacing should I use?" with an answer of, "Some unknown number greater than 1.37236 meters." (This was a randomly picked number).

 What we're dealing with here is an "effective but not absolute" model which is close to a spatially inhibited random process.  We can get into complex models (they exist, and are commonly studied in GIS!) such as the Clark-Evans nearest-neighbour model (no relation), or hard-core or Strauss processes.  But these models can't provide a universal value for our two constraints in our dimensionless factor formula.  So I think this is a dead end, or at the very least, math which is definitely above my pay grade.

 

Initial Conclusion

 At this point, I think I've explained enough for you to understand where the specific numbers on the Replant Spacing Chart came from - they came from the FS 704 Guide produced by BC's Ministry of Forests, and THEY got the numbers by using a formula for a block where the distribution of trees approximated a triangular pattern.

 I don't think we need to go any further, if that's all that you were trying to learn.  But for those of you who are feeling more adventurous ...

 

Triangulated Irregular Networks

 Let's introduce another dimension into our analysis.  So far, we've looked at flat 2D graphics representing our planting blocks.  But most blocks have at least some slope or rolling topography.  How does that affect our spacing?  For this section, I can fall back on things that I learned in my GIS classes.

 Triangulated Irregular Networks (TIN's) are used frequently to create three-dimensional representations of terrain (surface topology).  Imagine if you walk all over a planting block with a GPS, collecting thousands of GPS points in which each point includes a known elevation.  GIS software such as ArcGIS or QGIS can connect these points into a network of adjoining triangles, using a method called Delaunay triangulation.

 Unlike one of our earlier examples of perfectly equilateral triangles, the triangles in a TIN can have almost any shape, as long as they all have three straight sides.  They can be large, small, thin, fat, etc.  When combined into a complete surface, they will approximate the hills, valleys, ridges, and slopes of our planting block.

 The interesting thing in a Delaunay triangulation is that there are rules to determine "connected" trees (triangle edge segments).  Also, in a sufficiently large two-dimensional triangulation, the average number of connected neighbours approaches six.  Not all trees have six connected neighbours, but the overall average trends toward six as sample size increases.  This is good.  But what is not good is that the Delaunay-connected neighbours are not necessarily the six closest trees.  Also, what happens if a triangle stretches across an unplantable gap?

 Voronoi diagrams (Thiessen polygon networks) might also be useful.  This sounds like something very theoretical and fancy, but they're a very basic core concept in GIS work.  In a Voronoi diagram, trees are surrounded by polygons (contained within their polygons) and the main rule is that every point within a specific tree's Voronoi polygon is closer to that tree than to any other tree.  Here's a Voronoi diagram that I found online:

 


 The only real drawback with Voronoi diagrams is that they really help with analyzing the amount of elbow room that each tree has while growing up.  They don't seem to help with analyzing spacing, at least not at first glance.  ArcGIS has built-in tools such as the Thiessen Polygons Tool to analyze these, but again, not much help with respect to average spacing.

 Admittedly, a tree's nearest neighbour is guaranteed to be one of its Delaunay-connected neighbours, but that only helps with respect to a single adjacency rather than averages. 

 Anyway, I'm getting into the weeds here.  Let's go back to thinking about our block.  If we recorded the precise location (including elevation) of every tree planted on the block, we could use those points to create a TIN.  The resulting triangles would almost certainly be irregular rather than equilateral, reflecting the fact that planters select their microsites based on available planting spots rather than trying to establish a mathematically perfect grid pattern.

 All good so far.  But remember that the distance between two trees measured along the surface of a slope isn't necessarily the same as the horizontal distance between them!  This is something that inexperienced planters often struggle to understand.

 Think about how trees grow over time, especially conifers which generally have straighter trunks than many Canadian deciduous species.  Although seedlings may be planted on steep slopes, their stems generally grow vertically, responding to gravity.  They don't grow perpendicular to the surface of the hillside at their particular microsite location.  Therefore, when we're discussing stocking density and inter-tree spacing, we need to imagine looking straight down at the trees from above, rather than measuring distances along the face of the slope.

 An example:  Imagine planting two trees, one directly uphill from the other on a 45-degree slope.  If you measured 3.00 meters between these trees along the ground surface, their actual horizontal separation between the trunks once the trees have grown up will be only 2.12 meters.  That's a significant difference.  The steeper the slope becomes, the greater the discrepancy.

 


 Incidentally, this adjustment only applies to the "uphill/downhill" component of the distance.  If you're planting directly across the slope, along a contour line, the horizontal and ground distances should effectively be the same.

 So why is it useful for [some] tree planters to understand TIN's?  Well, GIS software can calculate both the actual three-dimensional surface area of a triangle in a TIN, and also its two-dimensional "projected" area (what you see when looking at the TIN from high above).  In conventional reforestation standards, it's the horizontal projection that matters.  A "mapped hectare" always represents exactly 10,000 square meters of horizontal area, even though the actual ground surface may be considerably larger due to slopes.  The more slopes, the more surface area.  So if you have a heavily-sloped block, and you're asked what the surface area is, the immediate answer of 10,000 square meters is just the 2D horizontal area occupied by the hectare.  The actual ground surface might be more like 13,000 square meters, or 14,000 square meters, or some other number.

 If we project our 3D network of planted trees onto a flat map, we'll see an irregular arrangement of triangles (if we draw segments between trees).  Some of these triangles might be nearly equilateral, but many others would be irregular, stretched or compressed due to avoiding obstacles and picking the best microsites.

 And that's how tree planting really works.

 

 

 

Thursday, November 12, 2026

Create a 100m Grid KML as a Reference Grid for Pay Plotting

When we throw pay plots on tree planting blocks, we typically use a 100m grid to pick plot locations, which results in a plot density of approximately 1 plot per hectare.

Most mapping apps (such as Avenza Maps) don't have any functionality in them to automatically create a digital grid overlay to guide us.  It's possible to create a grid manually, but that's a very tedious and time-consuming approach, taking several minutes for a single small block, and sometimes fifteen to twenty minutes for a very large block.  It's also possible to create grids using ArcGIS or QGIS desktop software, but that's also slightly tedious, and not everybody has access to that software.

In this blog post, we'll use AI to create a grid KML quickly and efficiently.  Before we go through the steps required, here's a link to a video that illustrates the tedious manual approach in Avenza.  You don't need to watch this video, but if you don't fully understand what we're trying to achieve here, this eight-minute video might help illustrate the challenge: 

 



I picked a random block map for this exercise, which you can see here:

I should clarify that the above map is just a JPG graphic of the original map, which was a georeferenced PDF.  You will need to have a georeferenced PDF or georeferenced TIFF file for this exercise, not just a random map graphic.  Foresters will always provide georeferenced maps.

The map above is an especially good one for this exercise.  The gross block area for this block is roughly 28.3 hectares.  However, the plantable area (in pink) is only about 22.3 hectares.  You can see this on the map as the NAR (net area to reforest).  I say that this is a good demonstration map because it's tricky.  There's a WTRA (wildlife tree retention area) that cuts this block into two separate plantable areas.  I wondered if this might trick the AI.

For this exercise, I used OpenAI's ChatGPT Work tab, model GPT-6.1 Terra on the High intensity setting (I have a Pro subscription plan).

This is the prompt that I submitted to GPT-Work:

 

I'd like to try building a new skill, related to GIS/mapping/plotting of tree planting blocks.

When we do quality surveys of a block, we generally need to do a minimum of approximately 1 plot per hectare. We always round up, so if a block is 7.04 Ha in size, I'd typically want to do at least 8 plots.

The expectation is that we throw our blocks based upon a 100m standard grid. However, the foresters never provide a plot grid for us to work with, so we need to build our own. Typically, when we worked with paper maps in the past (a decade ago), we'd draw out the locations for pay plots with a ruler and pencil, and then "eyeball" that we were in the approximate correct location for each plot while in the field. Or sometimes, we'd use a "walk-box" with string to measure out 100m in the field while walking from plot to plot. These methods were rudimentary.

Now that we have the technology to use apps such as Avenza, combined with the GPS in our phones, we can plant a digital grid in advance and then follow that so we're probably within about 2-3m of the "correct" location for each plot as we walk through the block.

Creating the digital grids is the tricky part. In the past, I'd draw them out by hand using the line tool in Avenza, and create a grid KML file. The person throwing the plots could then use that KML grid (which has vertical/longitude and horizontal/latitude lines spaced at 100m) and we'd throw a plot at each location where the lines meet.

I think you can create these grid KML's for me. I'm attaching a sample georeferenced block map. For this particular block, the block is highlighted in a reddish colour. Study the entire map, including the legend, and ensure that this makes sense to you.

I need you to generate a KML file for me which contains a grid that overlays this block. Your grid will contain the appropriate number of vertical lines and the appropriate number of intersecting horizontal lines such that lines are separated by 100m spacing, therefore, there will be approximately one intersection of lines for each 1 hectare on the underlying map.

Make sure that your first vertical line starts about twenty meters to the west of the westernmost part of the block. Your last vertical line will be located past the easternmost point on the block. Similarly, your first horizontal line will start about twenty meters to the north of the northernmost point on the block. Your last horizontal line will be located below the southernmost point on the block. All grid lines can be in standard 3 pixel width, in the standard Orange default colour in Avenza.

Study the attached block map carefully before you proceed. This particular block is approximately 28.3 hectares in size, so once you're finished creating the grid, I would expect approximately 28 of the gridline intersections to be located within the block boundaries, although there may be slightly fewer or slightly more based upon the exact location of underlying block boundaries.

Ask me questions if you don't understand what we're trying to achieve.

 

I also attached the appropriate georeferenced map when I submitted the prompt.

Chat worked for almost three minutes on this project.  It did not ask me any questions to clarify my goal.

This was the first time that I had tried this process, and it will certainly create future grid KML's more quickly now that it understands the process.  Also, it will get faster in the future with newer models, which will certainly be more capable and more efficient.

When it finished processing my query, this is what it told me:

 

I created the 100-metre grid KML for import into Avenza.

It contains nine vertical and ten horizontal orange lines, spaced 100 metres apart in the map’s NAD83 UTM coordinate system. The grid starts approximately 20 metres west and north of the block’s outermost points and extends beyond its eastern and southern edges.

The map distinguishes the 28.3-hectare gross block from the 21.7-hectare pink planting unit; the green-hatched wildlife tree retention areas also fall within the outlined block. I estimate about 22 intersections fall in the pink area, with additional intersections in the retention areas or near boundaries. Those are visual estimates, so the eligible plot count should be checked against the survey rules and boundaries before fieldwork. Under your round-up rule, 28.3 hectares would call for at least 29 plots if the gross area is the relevant basis.

I registered the grid using the map’s printed UTM ticks, so its placement is approximate. The KML’s orange is standard orange at width 3; its exact appearance may depend on Avenza’s display settings.


I wonder why it told me that the pink planting area was 21.7 hectares.  Was this a hallucination?  Or did it double-check the size of the pink planting area and decide that the map's listed NAR size of 22.3 hectares was incorrect?

The KML was generated perfectly.  Here's a graphic showing how it looked when I opened the KML in Google Earth desktop:

 

 

And here's a graphic showing how it looked when I opened the KML as a layer on top of the underlying georeferenced map in Avenza on my phone:

 


Overall, this was another successful project, and it will be a huge time-saver in the future.

If you use a similar prompt in your own workflow, you can ask Chat to turn this into a reusable "skill" on your account, which makes it easy for you to replicate the process in a separate chat, rather than as an additional query within the same chat.  I could share the skill file for this, but it's probably just as fast for you to follow my workflow from scratch and ask your own AI to create its own version of the skill on your local computer.  

Email me at scooter@replant.ca if you also use AI in your reforestation management workflow, and if you want to share some ideas!

 - Scooter

 


PS:  I'm probably not going to write any posts specifically about general use and development progress of AI.  Tons of other people who are far more competent than myself are already writing this sort of stuff.  I'll probably stick to real-world examples of AI being applied as a tool for forestry-related work.  But I'll occasionally throw out a few general comments. 

I think we're going to see incredible optimization of AI in the next several years, which I'd argue as being even more important than developing more powerful models or AGI.  There will probably be portable models running on mobile devices within 3-5 years which are more powerful than the high-end models today (such as ChatGPT 6.1 Sol, Gemini 4 Hydrogen, and Anthropic's top models).

Here are two other characteristics that I think are necessary for the future of AI:

- No guessing, no hallucinations.  Models should say, "I don't know" when a reasonable answer cannot be verified.  This is a challenge that is especially critical for AI to be a reliable tool in medicine, law, finance, and transportation network routing.

- Being able to "mathematically verify" the security of software and apps, especially with respect to [once again] medicine, cryptography, finance, and payments.