Territory & Prospecting Tool
Status: Planned
Issue: #162Bundle: Ag Bundle (Investor tier — requireAgPlan(event, PLAN_AG_INVESTOR))
Goal
Give ag retailers, grain companies, and territory managers a polygon-draw workspace inside Township Canada. Draw a polygon over the map, get a sortable list of every quarter section inside it with parcel-level attributes (acres, dominant crop, LSRS score, owner-search CTA), and export to CSV for Salesforce / HubSpot ingestion.
User stories
- Crop input retailer covering a 200×150 km territory wants to see every parcel inside the territory polygon by dominant crop class, so the agronomy team can prioritize visits for the upcoming season.
- Grain company territory manager drawing a 50 km radius around an elevator wants the list of every quarter section within that catchment, ranked by deliverable volume.
- Farmland investor scoping an RM-level acquisition pipeline wants every parcel inside a multi-RM polygon with weighted-avg LSRS and 5-year crop intensity.
Feature breakdown
Polygon drawing
The map workspace adds a "Draw territory" mode (alongside the existing measurement tool). Tools:
- Polygon — click vertices, double-click to close
- Rectangle — drag to draw an axis-aligned bounding box
- Circle — click centre, drag radius (useful for "everything within X km of this elevator")
- Buffer — pick a road, river, or municipal boundary and buffer by a chosen radius
Drawn polygons persist in app.territory_polygons keyed by user/team so the user can come back to a saved territory.
Parcel inference
Once a polygon is drawn, the server runs a spatial query against public.dls_quarters (and the equivalent NTS layer where applicable) and returns every parcel whose centroid falls inside the polygon. For each parcel:
- Legal land description, area, township/range/meridian
- Dominant crop (most recent year) from AAFC ACI
- LSRS productivity score
- Soil zone (from existing soilLandscapesCanada layer)
- Whether the parcel sits in any Indigenous consultation overlay, treaty area, or Crown disposition (flag only — full data is Energy Bundle)
Operator inference (subject to legal sign-off)
This is the open question from the PRD (OQ-6). Two options depending on legal verdict:
Option A — operator names shown with strong caveats
If legal sign-off allows, surface inferred operator names from:
- AAFC ACI year-on-year crop continuity (suggests a single farming entity is working a multi-parcel block)
- Public AB / SK / MB title and registry searches where redistribution rights permit
- A confidence score per parcel (low/medium/high)
- Display label: "Approximate — verify before contact"
Option B — no operator names, parcel-list + owner-search-CTA
If legal verdict says operator-name display is too risky, the tool ships without names. Each parcel row gets a "Search owner on ISC / SLI / AltaLIS" CTA link to the appropriate provincial registry. The territory analysis (acres, crop mix, LSRS) is the value; the operator name is the user's own diligence step.
Default for v1 ships Option B and adds Option A only when legal explicitly clears it.
CSV export with CRM mapping
The list view exports to CSV with column headers pre-mapped for Salesforce and HubSpot:
account_name(operator, if Option A)legal_land_descriptionacresdominant_croplsrs_scorelatitude,longitudenotes(consultation/disposition flags)
Export sizes scale to ~10K rows for an RM-scale territory; large-province queries are chunked.
API surface
POST /api/territory/polygon
body: { name, geometry: GeoJSON polygon }
→ persists and returns id
GET /api/territory/[id]/parcels
→ {
polygon: { name, area_km2 },
parcels: [
{ lld, acres, dominant_crop, lsrs_score, ... }, ...
],
summary: {
parcel_count: 432,
total_acres: 68800,
dominant_crop_breakdown: { ... },
weighted_lsrs: 64
}
}
GET /api/territory/[id]/export.csv
→ streaming CSV download (Investor tier; with Salesforce/HubSpot column mapping)
Entitlement
requireAgPlan(event, PLAN_AG_INVESTOR)on every endpoint- Polygon creation limit: 25 saved territories per Investor user (revisit after launch metrics)
UI
- New "Draw territory" mode toggle in
app/components/map/MapControls.vue - Drawing layer integrated with existing Mapbox draw control
- Side panel
app/components/territory/TerritoryPanel.vuewith:- Drawn polygon name + area
- Parcel list table with sort/filter
- Summary stats card
- Export to CSV button
- Save / load / delete territory polygons from a sidebar list
Acceptance criteria progress
- Polygon draw tool integrated into the map workspace
-
app.territory_polygonsschema + migrations - Operator-inference legal sign-off (OQ-6) — defaults to Option B
- "Approximate — verify before contact" disclaimer in the UI for any operator-name display
- CSV export with Salesforce/HubSpot column mapping
- List view: operator/parcel, acres, dominant crop, LSRS
- Conservative confidence threshold for operator names + caveat copy
- Behind
ag_tier = investor(requireAgPlan(event, PLAN_AG_INVESTOR))
Related features
- Land Portfolio Manager — territory polygons can be saved into a portfolio
- One-Click Parcel Report — clicking a parcel in the territory list opens the full report
- AAFC Crop Inventory — provides the dominant_crop column
- LSRS Productivity Score — provides the productivity score column