Addressing Process for Greenfield Subdivision

A greenfield subdivision is built on land that has not been developed before, such as former farmland or open land at the city’s edge. Its lots, and often its streets, are new, so there are no existing addresses to follow.

This post introduces greenfield-addressing, a workflow that numbers the lots of a new subdivision from just two GIS layers, with explicit rules, and asks the user only when the rules cannot decide. Part 1 explains the idea and the algorithm; Part 2 implements it with the QGIS Python API (PyQGIS). All figures use a small synthetic subdivision.


Part 1 — The idea

Two inputs, one unit of work

The process needs only two layers:

  1. Survey parcels: the lot polygons of the subdivision plan.
  2. Street segments: street centrelines, each with a street_name.

The segments that share a street name are merged into one street line. Its direction is the street’s direction, and the distance along it from its start is a point’s measure, so the segments may be digitised either way and need no measure attributes.

Both layers must be in the same projected CRS in metres (UTM, for example): every length, area and tolerance below is in the layer’s own units, and in a geographic CRS they would be degrees.

Everything else (the frontage of every lot, address points, the search rays, a numbering coefficient per street) is produced by the process.

A person numbering a street works one side at a time, from a known number. The process does the same: each run takes a seed lot, its seed number and the street, and addresses one side of that street. The other side is a second run with its own seed.

Flowchart of one run: seed lot, number and street; scope; seed frontage street and side; replace if this side is already addressed; direction; then, if the other side is not yet addressed, walk lot to lot, otherwise number by measure; finally plan, confirm and write

Step 1: the seed lot — its front and its side

A run starts by processing the seed lot: which edge is its front, which street that front faces, and which side of the street it is on. Every later lot goes through the same tests.

Which edge is the front? Ray casting

A lot’s address belongs to the street it faces. To find it, the parcel boundary is first reduced to meaningful edges, then a ray is cast from each edge.

Edges. Survey rings carry many vertices: a curved front can be dozens of short pieces (especially when the geometry library has no true circular curves, which is common with web GIS data), and corners leave small leftovers. Consecutive pieces are merged into one edge while the turn between them is small (default under 10°), or moderate next to a very short piece (default under 45° next to a piece shorter than 2 m). These thresholds are parameters and can be tuned to the data.

Left: a lot whose survey ring has 14 vertices, most of them along a gently curved front with a short leftover piece. Right: the same lot reduced to four edges, with the whole curved front as edge 0

Frontage rays. From the midpoint of every edge, a ray is cast perpendicular to the edge, away from the lot’s centroid, up to a maximum length (default 200 m, a parameter). The edge is a frontage only if the first thing the ray hits is a named street. A neighbouring lot, an unnamed street, or nothing at all means the edge is not a front.

A lot between two neighbours with a rear parcel behind it. A ray leaves the middle of each edge: the top ray reaches Maple Street, so the top edge is the frontage; the side rays hit the neighbours and the rear ray hits the rear parcel, so those edges are blocked

The “first hit” test is what makes the method robust: a rear edge that eventually reaches a street 60 m away is still rejected, because a lot is in the way.

Parcel rules

Most lots have exactly one frontage. The rest are settled by rules, applied to every lot in this order. The thresholds are parameters of the code; the values given are defaults and can be tuned to the local lot pattern:

  1. Large parcels (over an area threshold, default 1600 m²) are usually parks, reserves or future development parcels, not house lots: skipped.
  2. No frontage on the run’s street, and frontage on at most one other street: skipped.
  3. Frontage on more than one street. If the lot is the seed, the user picks the street; the front edge on that street is then found by rule 4, like any other lot. Any other lot in the run (a lot found as the next parcel, Step 2):
    • faces the run’s street and another street whose frontage is within a set angle of it (default under 45°): a through-lot backing onto another road, addressed on the run’s street;
    • faces them at that angle or more: a corner lot, addressed on the street with the shorter frontage (each street’s longest edge compared), since the narrow side is the front and the long side the flank. If that is not the run’s street, the lot is skipped and counted as a gap; if the two lengths are within a set ratio of each other (default 10%), the user is asked;
    • does not face the run’s street but faces several others: the run stops there.
  4. Several edges on the same street. If they spread widely (default 45° or more), the street bends around the lot and the shortest edge is the front. Otherwise the front is a curve split into pieces, and the piece most parallel to the street is the front. An exact tie is asked.

A corner lot where Birch Avenue meets Cedar Lane, with 13 m of frontage on Birch Avenue and 23 m on Cedar Lane; its address point is numbered 2 on Birch Avenue

Two lots. (a) A street bends around a lot, so a 9.5 m edge and a 14 m edge face the same street at right angles; the shorter 9.5 m edge is the front. (b) A lot's front is split into pieces at 0 and 20 degrees to the street; piece A, parallel to the street, is the front

Which side of the street? A cross product

Odd and even numbers belong on opposite sides, so each frontage needs a side. Take the street segment a → b nearest to the frontage midpoint p (in the street line’s direction). The sign of the 2D cross product decides:

cross = (bx − ax)·(py − ay) − (by − ay)·(px − ax)      > 0: left,  < 0: right

A street segment from a to b in the street line's direction, with point p above it on the left, where the cross product is positive, and point q below it on the right, where it is negative

Using the nearest segment, not the whole street, keeps the test correct on curved streets. Floating-point coordinates almost never give exactly 0, so a point on or very near the line has no side and is treated as undecided. |cross| is the area of the parallelogram spanned by a → b and a → p, so dividing it by the segment length gives the point’s distance from the line, and the test is |cross| / |ab| < ε with ε a distance tolerance (default 1 cm, a parameter).

Step 2: finding the next parcel

Once the seed is processed, the run moves along the street one lot at a time. The next parcel is found from the current one:

  1. From the current lot, take the point where its frontage ray meets the street and the street’s tangent there.
  2. Cast a search ray from the lot’s centroid along the tangent, in the chosen direction.
  3. The first lot the ray enters that passes the parcel rules is the next lot. If it is on the other side of the street, or nothing is found within the ray length (default 200 m), the side is done.

Step 3: the first side — walk from lot to lot

The first side of a street is numbered by walking: each next lot found in Step 2 is numbered from the current one:

  • it shares an edge with the current lot (at least 0.5 m of common boundary): current + conventional_increment (default 4, a parameter);
  • otherwise (a lane, a walkway, a skipped parcel in between): current + D × c, rounded up to the same parity, where D is the distance between the two frontage midpoints.

c is the street’s coefficient in numbers per metre, measured from the run itself: c = conventional_increment / d, with d the frontage-midpoint distance of the first two adjacent lots. A gap therefore reserves as many numbers as the missing frontage would have used, at this street’s own lot width.

Lots along Willow Crescent with a lane between two groups. Adjacent lots are numbered 3, 7, 11, 15 and 19; across the lane, 38 m between frontage midpoints, the next lot is 31, followed by 35, 39 and 43

Step 4: the other side — number by position along the street

If the second side were walked independently, the two sides could drift apart (odd 35 facing even 48). So the second side is numbered against the first, by measure, the distance along the street line:

  1. Every address on the first side and every candidate lot on this side is placed on the street at the measure where its frontage ray hits.
  2. In measure order from the seed, each lot gets the smallest number of its parity that is above the previous number on this side and above every opposite number behind it, while staying below every opposite number ahead of it.
  3. If no such number is left (the numbers up to the next opposite address are used up), the side stops there, and the remaining lots stay unnumbered for review rather than being squeezed in.

Addresses on both sides of a street plotted by measure along the street from 0 to 120 m: odd numbers 3 to 39 on the side walked first; on the other side even numbers 4, 8, 12, 16 and 20, then 28 at 82 m and 32

Projected onto the street, all numbers then increase in one direction on both sides.

Step 5: when the rules cannot decide, ask

A process that silently guesses is worse than one that asks. Whenever the rules run out, the code asks a precise question:

Question When Default
scope always first: only parcels in the current spatial filter are affected
seed_number the seed lot has no seed number yet
street the seed lot has frontage on more than one street
replace this side of the street already has addresses no
direction which way the numbers run along the street forward
street:<lot> a corner lot’s two frontages are within 10% of each other in length
tie:<lot> two edges tie exactly on the edge rules
coefficient a gap appears before the coefficient is known
confirm write the planned addresses

A run also respects a scope: only lots inside the user’s spatial filter are addressed or replaced. That is how a user keeps a run away from lots already addressed from another street. Lots outside the filter still block frontage rays, because a lot does not stop being in the way just because it is filtered out.


Part 2 — Implementing it with the QGIS API

The implementation is a single file, greenfield_addressing.py, with no dependency other than PyQGIS, so it runs in the QGIS Desktop Python console or headless, and the same structure can be ported to ArcPy. A test script builds a synthetic subdivision and checks every rule. The snippets below are simplified from the module.

Layers

import math
from qgis.core import (QgsExpression, QgsFeatureRequest, QgsGeometry, QgsPointXY,
                       QgsSpatialIndex, QgsVectorLayer)

parcels = QgsVectorLayer("work/survey_parcels.gpkg", "Survey parcels", "ogr")
streets = QgsVectorLayer("work/street_segments.gpkg", "Street segments", "ogr")

Inputs are read only. The addresses go to their own layer in a GeoPackage, created on demand; every ray cast is returned as a memory layer for review.

Edges: merging small turns

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def dist(p, q):
return math.hypot(q.x() - p.x(), q.y() - p.y())

def turn_degrees(prev, cur, nxt):
v1x, v1y = cur.x() - prev.x(), cur.y() - prev.y()
v2x, v2y = nxt.x() - cur.x(), nxt.y() - cur.y()
return math.degrees(math.atan2(abs(v1x * v2y - v1y * v2x), v1x * v2x + v1y * v2y))

def normalised_edges(ring, tol=10.0, short_m=2.0, short_tol=45.0):
if ring[0] == ring[-1]:
ring = ring[:-1] # drop the closing vertex
n = len(ring)
# start at the sharpest corner so a straight run is not split at the ring start
k = max(range(n), key=lambda i: turn_degrees(ring[i - 1], ring[i], ring[(i + 1) % n]))
ring = ring[k:] + ring[:k]
kept = [ring[0]]
for i in range(1, n):
cur, prev = ring[i], kept[-1]
nxt = ring[(i + 1) % n]
short = min(dist(prev, cur), dist(cur, nxt)) < short_m
if turn_degrees(prev, cur, nxt) < (short_tol if short else tol):
continue # merge: drop this vertex
kept.append(cur)
return list(zip(kept, kept[1:] + kept[:1])) # edges as (start, end)

The ring is the outer ring of the parcel, with true curves converted to straight segments and, for a multipolygon, only the largest part kept:

def outer_ring(geometry):
    g = QgsGeometry(geometry)              # copy: the input layer stays untouched
    g.convertToStraightSegment()
    if g.isMultipart():
        largest = max(g.asMultiPolygon(), key=lambda p: QgsGeometry.fromPolygonXY(p).area())
        return largest[0]
    return g.asPolygon()[0]

Frontage rays: first hit wins

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def outward_normal(a, b, centroid):
dx, dy = b.x() - a.x(), b.y() - a.y()
n = math.hypot(dx, dy)
nx, ny = -dy / n, dx / n
m = QgsPointXY((a.x() + b.x()) / 2, (a.y() + b.y()) / 2)
if nx * (m.x() - centroid.x()) + ny * (m.y() - centroid.y()) < 0:
nx, ny = -nx, -ny # flip to point away from the lot
return m, nx, ny

def hit_distance(ray, start, geometry):
if not ray.intersects(geometry):
return None
return QgsGeometry.fromPointXY(start).distance(ray.intersection(geometry))

index = QgsSpatialIndex(parcels.getFeatures()) # other parcels are obstacles

def edge_status(parcel, a, b, centroid, max_m=200.0):
m, nx, ny = outward_normal(a, b, centroid)
start = QgsPointXY(m.x() + nx * 0.01, m.y() + ny * 0.01) # just outside the edge
ray = QgsGeometry.fromPolylineXY([start, QgsPointXY(m.x() + nx * max_m,
m.y() + ny * max_m)])
box = ray.boundingBox().buffered(1.0) # a ray along an axis has a zero-width box
lot_d = min((d for fid in index.intersects(box) if fid != parcel.id()
for d in [hit_distance(ray, m, parcels.getFeature(fid).geometry())]
if d is not None), default=None)
hits = sorted(((d, f["street_name"])
for f in streets.getFeatures(QgsFeatureRequest().setFilterRect(box))
for d in [hit_distance(ray, m, f.geometry())] if d is not None),
key=lambda h: h[0]) # by distance only: names may be NULL
if lot_d is not None and (not hits or lot_d <= hits[0][0] + 1e-3):
return "blocked_parcel", None
if not hits:
return "no_hit", None
if not hits[0][1]:
return "blocked_unnamed", None
return "frontage", hits[0][1]

Starting the ray 1 cm outside the edge makes a neighbour that shares the edge the first hit, so shared boundaries are rejected without special cases. The spatial index (for parcels) and the bounding-box filter (for streets) keep each ray to a handful of candidates; the real code also keeps the clipped ray geometry so every ray can be drawn for review.

Street line, side and tangent

mergeLines joins a street’s segments into the street line, whatever way each was digitised:

def street_line(name):
    request = QgsFeatureRequest().setFilterExpression(f"street_name = {QgsExpression.quotedValue(name)}")
    line = QgsGeometry.unaryUnion([f.geometry() for f in streets.getFeatures(request)]).mergeLines()
    if line.isMultipart():
        raise ValueError(f"{name}: segments do not join into one line (gap or branch)")
    return line

On the street line, closestSegmentWithContext returns the vertex after the closest segment, which gives the local segment a → b for both the side test and the tangent:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def local_segment(street_geometry, point):
_, _, after, _ = street_geometry.closestSegmentWithContext(point)
return street_geometry.vertexAt(after - 1), street_geometry.vertexAt(after)

def street_side(point, street_geometry, eps=0.01):
a, b = local_segment(street_geometry, point)
cross = (b.x() - a.x()) * (point.y() - a.y()) - (b.y() - a.y()) * (point.x() - a.x())
if abs(cross) < eps * math.hypot(b.x() - a.x(), b.y() - a.y()):
return None # within eps metres of the street line: undecided
return "L" if cross > 0 else "R"

def tangent_at(street_geometry, point):
a, b = local_segment(street_geometry, point)
n = math.hypot(b.x() - a.x(), b.y() - a.y())
return (b.x() - a.x()) / n, (b.y() - a.y()) / n

The walk: search ray, shared edge, numbering

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def next_lot(current, hit_point, street_geometry, forward=True, max_m=200.0):
tx, ty = tangent_at(street_geometry, hit_point)
if not forward:
tx, ty = -tx, -ty
c = current.geometry().centroid().asPoint()
ray = QgsGeometry.fromPolylineXY([c, QgsPointXY(c.x() + tx * max_m, c.y() + ty * max_m)])
entered = sorted(
(QgsGeometry.fromPointXY(c).distance(ray.intersection(f.geometry())), f.id())
for f in parcels.getFeatures(QgsFeatureRequest().setFilterRect(ray.boundingBox().buffered(1.0)))
if f.id() != current.id() and ray.intersects(f.geometry()))
for distance, fid in entered: # nearest first
verdict = parcel_rules(fid) # rules 1-4: "addressed", "skipped" or "stop"
if verdict == "addressed":
return fid
if verdict == "stop": # rule 3: faces other streets only
return None
return None # end of this side

def shared_edge_length(a, b, tol=0.05):
boundary = QgsGeometry(a.constGet().boundary())
return boundary.intersection(b.buffer(tol, 4)).length()

def next_number(current, D, c):
n = math.ceil(current + D * c - 1e-9) # round up ...
return n + 1 if (n - current) % 2 else n # ... to the same parity

With shared_edge_length(...) >= 0.5 the step is +conventional_increment (default 4); otherwise next_number(current, D, c). The coefficient is c = conventional_increment / d from the first adjacent pair of the run, stored per street.

Measure and the other side

lineLocatePoint gives the measure, the distance along the street line:

def measure(line, point):
    return line.lineLocatePoint(QgsGeometry.fromPointXY(point))

The numbering of the other side is then plain Python over (measure, number) pairs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def number_by_measure(candidates, reference, seed_measure, start_number, forward=True):
"""candidates: [(measure, lot)] on this side, seed included;
reference: [(measure, number)] on the first side."""
from_seed = [(m, lot) for m, lot in candidates
if (m >= seed_measure if forward else m <= seed_measure)]
plan, previous = [], None
for m, lot in sorted(from_seed, key=lambda t: t[0], reverse=not forward):
behind = [n for rm, n in reference if (rm < m if forward else rm > m)]
ahead = [n for rm, n in reference if (rm > m if forward else rm < m)]
if previous is None:
n = start_number
else:
n = previous + 2
while behind and n <= max(behind):
n += 2
if ahead and n >= min(ahead):
break # no valid number left: stop, rest unnumbered
plan.append((lot, n))
previous = n
return plan

Asking, planning, writing

Questions go through a small Prompter class: the base class looks up preset answers, falls back to the default, and logs every answer; a ConsolePrompter reads the terminal; a QgisPrompter opens QInputDialog.getItem / getText. A front end for another platform implements the same single method, interactive.

forward = prompter.ask("direction", "Which way do the numbers run?",
                       {"forward": "towards the end of the street line",
                        "backward": "towards its start"},
                       default="forward") == "forward"

The run builds the whole plan first, prints it, asks confirm, and only then writes, through the data provider so that layers already open in QGIS Desktop see the change:

provider = addresses.dataProvider()
provider.deleteFeatures(replace)           # this side's old addresses, if confirmed
provider.addFeatures(features)

Running it in QGIS

With the project open, put greenfield_addressing.py on the Python path and, in the Python console:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import greenfield_addressing as ga

project = QgsProject.instance()
parcels = project.mapLayersByName("Survey parcels")[0]
streets = project.mapLayersByName("Street segments")[0]
addresses = ga.address_layer(parcels.crs(), "work/addresses.gpkg") # opened if it exists
ask = ga.QgisPrompter()

# seed lot fid, seed number, street
ga.run(parcels, streets, addresses, 136, 3, "Maple Street", ask, dry_run=True)
plan = ga.run(parcels, streets, addresses, 136, 3, "Maple Street", ask) # plan → confirm → write
ga.run(parcels, streets, addresses, 240, 12, "Maple Street", ask) # the other side, by measure
ga.run(parcels, streets, addresses, 136, 3, "Maple Street", ask, stop_on=150) # no further than lot 150
project.addMapLayer(plan.rays) # every ray, for review

Each run prints the reason for every number (“shares an edge: 15 + 4 = 19”; “no shared edge: D = 38.0 m, D x c = 10.9 -> 31”) and returns every ray it cast as a layer, so the result can be checked on the map, not just in a log. All thresholds are fields of ga.Settings, passed as settings=ga.Settings(max_lot_m2=2000), for example.


Limits

  • Greenfield only. The process assumes no addresses on the street except those its own runs created. Infill (fitting a new lot between existing numbers, such as 25A) is out of scope.
  • Run order. The denser side should be walked first; the other side follows by measure.
  • One line per street. The segments of a street must join into one line. A street with a gap, or a branch carrying the same name, is refused and has to be split into parts first.
  • Thresholds. All defaults (ray length, area, angles, tolerances, conventional_increment) are starting values and need review on more subdivisions.

Takeaway

Numbering a new street by hand is full of small judgements, but most of them are rules that can be written down: which edge is the front, which lots to skip, how many numbers a gap is worth, how the two sides stay in step. Casting rays answers the geometric questions, the measure along the street keeps the two sides aligned, and whatever is left is asked as a precise question. Rules where possible and questions where not: that split makes the process both automatic and trustworthy.


Addressing Process for Greenfield Subdivision
https://meliber.github.io/2026/11/14/Addressing-Process-for-Greenfield-Subdivision/
Author
Adam Han
Posted on
November 14, 2026
Licensed under