Designing Geofences for Yards, Customers and Ports
For supply chain it architects and product owners · Compare approaches

Designing Geofences for Yards, Customers and Ports: Illustrative logistics integration monitoring and event-queue reconciliation desk; not a client facility.
Quick answer: geofence design logistics
Geofence design in logistics starts from the event each fence must prove: queue arrival, yard entry, delivery or departure. Use polygons for yards, multi-gate sites and ports, circles of at least 100 to 150 metres for simple sites, confirm entry and exit over several position reports, and version every fence so detention events replay identically.
TL;DR — what you’ll learn
- Size the fence edge as measured 95th-percentile position error plus distance travelled between reports; at 40 km/h and 60-second reporting that distance is about 667 metres, so faster reporting near stops matters most.
- Declare arrival after 3 consecutive inside reports below 10 km/h and departure after 3 reports beyond a 60 to 100 metre exit buffer; one crossing should never start or stop a detention clock.
- Draw separate queue and property polygons at DCs and port terminals; in the illustrative month, a centroid circle left $11,812.50 and ₹2,67,300 of detention without usable evidence.
- Treat fences as versioned master data stored as RFC 7946 GeoJSON, and stamp each event with fence ID and version so disputed invoices can be replayed months later.
Topics: geofence design logistics · radius vs polygon geofence · geofence dwell trigger · geofence false events · yard and port geofencing
All quantities, amounts, product codes and events are illustrative teaching examples.
The carrier invoices three hours of detention at a distribution centre. The shipper's visibility platform says the truck was on site for 56 minutes beyond free time, because its 150-metre circle around the building centroid missed the queue on the access road and logged a false exit when the trailer was moved to the far side of the yard. Both parties hold timestamps. Neither can prove which one describes what happened, so the invoice sits in dispute for six weeks.
Geofences produce trustworthy events when each one is designed as a definition of a business event: the shape follows the site's real footprint, the boundary is sized from measured position error and the device's reporting interval, entry and exit need confirmation, and every event records which version of the fence produced it. Designed that way, arrival, dwell and departure times stand up in a billing dispute.
- Design choices covered: radius versus polygon, boundary sizing arithmetic, dwell confirmation and exit hysteresis for yards, customer sites and port terminals.
- Failure modes covered: drive-bys, gate queues, signal reflection near container stacks, overlapping fences, tractor-trailer separation and sparse ELD positions.
- Tools included: a GeoJSON fence payload, a detention example in USD and INR, a terminal incident trace and a pre-launch test checklist.
Start from the business event each geofence has to prove
Write down the event before drawing the shape: "truck joined the gate queue", "truck is at a dock door" and "truck left the customer's property" need different fences, even at the same address. One fence asked to answer several questions usually answers none of them precisely enough to bill or alert on.
Most logistics fences serve one of four consumers: the yard management system timing gate-to-dock turns, the TMS starting and stopping detention clocks, the customer notification service sending arrival alerts, and the ePOD application checking that a signature was captured at the right place. Each consumer tolerates a different error, so each gets its own fence or its own ring within a fence.
Scroll horizontally to see all columns.
| Fence | Event emitted | Consuming application | Owner of the geometry | Approves a change |
|---|---|---|---|---|
| Own DC queue lane | Joined gate queue | Yard management system, detention clock | Site operations manager | Network engineering lead |
| Own DC yard polygon | Inside yard, left yard | Yard management system, trailer pool | Site operations manager | Network engineering lead |
| Customer receiving site | Arrived, departed | TMS detention and customer arrival alerts | Customer master data team | Key account manager, with the customer's written confirmation where billing depends on it |
| Delivery point within a customer site | At delivery point | ePOD location check | Customer master data team | Delivery operations lead |
| Port terminal: queue and gate polygons | Queued, gated in, gated out | Drayage dispatch, container turn-time reports | Drayage operations | Drayage operations manager |
| Suppression zone near a site (truck stop, rest area) | No event; blocks false arrivals | Arrival rule engine | Transport planning | Transport planning manager |
Our earlier article on ePOD geofence radius locks and dispatch SLA math looks at one consumer, the delivery confirmation screen. This guide steps back to the geometry itself: how to choose, size, version and test fences so that every consumer, including detention billing, receives events it can defend.
Radius or polygon: choosing a shape from the site's footprint
Use a circle only for small sites with one entrance and nothing confusing nearby; use a polygon for yards, multi-gate DCs, port terminals and any site beside a highway or a neighbour's yard. A circle centred on a geocoded address usually lands on the building or a postal centroid, which can sit hundreds of metres from the gate that matters.
The choice also depends on where the fence is evaluated. Android's geofencing API defines a fence as a latitude, longitude and radius, a circle, and limits each app to 100 active fences per device user. Driver apps that use on-device fencing therefore work with circles and must register only the next stops on the route, while polygons are evaluated on the server against the stream of reported positions.
- Circle strengths: one centre and one radius, cheap to store, supported natively on phones, easy to explain to a customer service agent.
- Circle weaknesses: includes roads, car parks and neighbouring yards inside the radius; excludes long queue lanes and remote trailer pools outside it.
- Polygon strengths: follows the fence line, the queue lane and the dock apron; can exclude a public road running past the gate.
- Polygon weaknesses: needs someone to draw and maintain it, and needs server-side evaluation, which in turn depends on a steady position stream from the vehicle.
For polygons, store geometry in GeoJSON as RFC 7946 defines it. Positions list longitude first and latitude second, a linear ring is closed with at least four positions where the first and last are identical, exterior rings run counterclockwise and holes clockwise, and coordinates use WGS 84. Most mapping bugs in fence tools come from swapped axis order, which places a Chicago yard somewhere in the Indian Ocean.
Sizing the boundary from position error and reporting interval
The fence edge needs a margin equal to the position error you actually observe plus the distance a truck travels between two position reports. On most fleets the second term is far larger than the first, so the reporting interval near sites, not satellite accuracy, decides how small a reliable fence can be.
The US government's GPS programme site states that GPS-enabled smartphones are typically accurate to within 4.9 metres under open sky, and that accuracy worsens near buildings, bridges and trees. Android's documentation is more cautious for its fused location: Wi-Fi-based accuracy usually falls between 20 and 50 metres, can degrade to hundreds of metres or kilometres in rural areas without Wi-Fi, and the recommended minimum geofence radius is 100 to 150 metres.
Boundary margin and dwell floor
d_margin = e95 + v x dt
e95 = 95th-percentile horizontal error of your devices at this site, metres
v = typical approach speed at the fence edge, metres per second
dt = position reporting interval near the site, seconds
T_dwell >= n_confirm x dt (n_confirm = consecutive inside reports required)
Example: e95 = 25 m, v = 11.1 m/s (40 km/h), dt = 60 s
d_margin = 25 + 11.1 x 60 = 691 m
with dt = 10 s near the site: 25 + 111 = 136 m
with n_confirm = 3 and dt = 60 s, no stop shorter than 3 minutes is reliably seen
GeoJSON fence (illustrative coordinates, longitude first, exterior ring counterclockwise)
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[
[-88.1520, 41.5210], [-88.1460, 41.5210], [-88.1460, 41.5255],
[-88.1490, 41.5268], [-88.1520, 41.5255], [-88.1520, 41.5210]
]]
},
"properties": {
"fence_id": "DC-JOL-YARD",
"version": 4,
"valid_from": "2026-11-01T00:00:00Z",
"event": "INSIDE_YARD",
"entry_confirm_reports": 3,
"exit_buffer_m": 60,
"exit_confirm_reports": 3,
"max_speed_kmh_for_arrival": 10,
"owner": "site-ops-joliet"
}
}
The arithmetic explains a common complaint: "the fence never fired". A truck reporting once a minute at 40 km/h covers about 667 metres between reports, so it can pass straight through a 150-metre circle without a single position landing inside. Ask the telematics provider for a faster reporting rate within a set distance of planned stops, or evaluate the straight line between consecutive positions against the polygon instead of the points alone.
Geofence sizing for yard and customer-site arrival events should add the 95th-percentile position error measured on the fleet's own telematics to the distance a truck covers between reports; at 40 km/h and a 60-second interval that travel term alone is about 667 metres, larger than Android's recommended 100 to 150 metre minimum radius.
Dwell confirmation and exit hysteresis that survive queues and drift
Declare arrival only after several consecutive reports inside the fence at low speed, and declare departure only after several consecutive reports beyond a wider exit boundary. A single position crossing the line in either direction should never start or stop a billing clock.
Android offers the same idea on the phone: its documentation recommends the dwell transition with a loitering delay instead of the enter transition when brief drive-past alerts cause noise, and warns that alerts can lag by up to about two minutes, or longer when the device has been stationary. Server-side rules for vehicle telematics follow the same pattern with explicit counts, speeds and buffers that the fence record stores.
- Outside: no recent report inside the entry boundary; nothing is emitted.
- Candidate inside: the first report lands inside; the rule waits for the confirmation count and checks speed is below the arrival threshold.
- Inside: confirmation met; the arrival event is emitted with the timestamp of the first inside report, not the confirming one.
- Candidate outside: a report lands beyond the exit buffer; the rule waits for the exit confirmation count before acting.
- Departed: exit confirmed; the departure event carries the timestamp of the first report beyond the buffer, and dwell equals departure minus arrival.
Scroll horizontally to see all columns.
| Parameter | Own DC yard | Customer receiving site | Port terminal |
|---|---|---|---|
| Shape | Polygon of fence line plus queue lane | Polygon where drawn; circle of at least 150 m otherwise | Separate queue polygon and terminal polygon |
| Entry confirmation | 3 reports inside, speed below 10 km/h | 3 reports inside, speed below 10 km/h | 2 reports in queue polygon; terminal entry taken from the gate transaction where available |
| Exit buffer beyond the entry boundary | 60 m | 75 m | 100 m, because container stacks reflect signals |
| Exit confirmation | 3 reports beyond buffer | 3 reports beyond buffer | 4 reports beyond buffer |
| Main false-event risk | Trailer moves to a remote pool | Drive-past on an adjacent road | Queue on a public road and multipath near stacks |
Where false events come from at yards, customer sites and ports
Most false geofence events come from six repeatable causes, and each has a design fix that is cheaper than arguing about invoices afterwards. Tag every disputed event with one of these causes for three months and the list of fences to redraw writes itself.
- Drive-past traffic: a circle that overlaps a highway or a neighbour's entrance fires as trucks pass; fix with a polygon, a speed threshold and dwell confirmation.
- Queues outside the line: trucks waiting on an access road or outside a terminal gate are invisible to a fence drawn on the property boundary; fix with a separate queue polygon.
- Stationary drift: a parked truck's reported position wanders, especially near tall structures, and crosses the edge; fix with an exit buffer and exit confirmation count.
- Overlapping fences: two customers in one industrial park share an access road; fix by matching events to the planned stop sequence before the nearest fence.
- Tractor and trailer separation: the tracking device sits on the tractor, so a dropped trailer "leaves" with it; fix by recording drop and hook events from the yard system.
- Phone leaves the cab: a driver app reports the driver walking to the shipping office, not the truck; fix by preferring the vehicle's telematics unit for dwell where both exist.
Hours-of-service data is a tempting shortcut and a poor fence feed. Under 49 CFR 395.26(d)(1), an ELD makes an intermediate record while the vehicle is in motion only when there has been no duty status change or other intermediate record in the previous hour. Under 395.26(i), location during authorised personal use is logged with one decimal place, roughly a 10-mile radius.
Hours-of-service ELD records are a weak geofence feed for detention: 49 CFR 395.26(d)(1) requires an intermediate location record only after one hour in motion without another record, and 395.26(i) reduces personal-use location to one decimal place, roughly a 10-mile radius, so dwell timing needs a separate telematics or app position stream.
Keeping fence geometry as versioned master data
A fence is master data with an owner, a version number and an effective date, and every event must store the fence identifier and version that produced it. Editing a polygon in place silently changes how last month's detention would be recalculated, which is exactly the question a disputed invoice asks.
- Never edit in place: a geometry change creates version n+1 with a new effective date; version n stays available for replaying old events.
- Change triggers: a new gate, a relocated queue lane, construction, a new trailer pool or a run of disputed events tagged to that fence.
- Customer confirmation: where detention or service-level credits depend on a customer-site fence, send the customer a map of the polygon and keep their confirmation with the version.
- Review cadence: list every fence with its false-event rate each quarter and assign the worst ten for redraw.
In India, the vehicle often already carries a regulated tracking device. MoRTH's G.S.R. 617(E) of 3 August 2022 requires N2 and N3 vehicles carrying dangerous or hazardous goods, built from 1 September 2022 for new models and 1 January 2023 for existing models, to have an AIS-140 vehicle location tracking device, and states such as Tripura extend AIS-140 fitment to national permit goods carriages. Whether the shipper can use that device's feed depends on the device vendor's contract.
Customer-site geofence polygons stored as GeoJSON under RFC 7946 list longitude before latitude, close each linear ring with at least four positions and wind exterior rings counterclockwise; the TMS should stamp every arrival and departure event with the fence identifier and version so that a detention invoice can be reproduced months later.
A detention dispute worked in USD and INR
A centroid circle with no exit hysteresis undercounted dwell on between a fifth and a third of eligible loads in this illustrative month, costing a US carrier about $11,800 and an Indian fleet about ₹2.7 lakh in detention it could not evidence. The contract terms and volumes below are illustrative, not market rates.
Scroll horizontally to see all columns.
| Item | US carrier at a Midwest DC (USD) | Indian fleet at a Bhiwandi DC (INR) |
|---|---|---|
| Contract free time | 2 hours | 4 hours |
| Detention charge after free time | $75 per hour in 15-minute increments | ₹450 per hour in whole hours |
| Truck joins the queue / leaves the site | 07:10 / 11:25 | 10:05 / 18:40 |
| Circle fence: false exit resets the clock; dwell counted | 08:31 to 11:27 = 2 h 56 min | 13:15 to 18:42 = 5 h 27 min |
| Billable under the circle fence | 1 hour = $75.00 | 1 hour = ₹450 |
| Polygon with queue lane and exit buffer; dwell counted | 07:12 to 11:27 = 4 h 15 min | 10:07 to 18:42 = 8 h 35 min |
| Billable under the polygon fence | 2 h 15 min = $168.75 | 4 hours = ₹1,800 |
| Shortfall per affected load | $93.75 | ₹1,350 |
| Affected loads in the month | 126 of 420 detention-eligible loads | 198 of 900 trips |
| Monthly detention not evidenced | $11,812.50 | ₹2,67,300 |
The same design also helps the paying side. A shipper auditing detention claims can only reject an inflated claim if its own events are reliable, so the polygon and hysteresis rules protect both directions. Our guide to truck detention charge evidence covers the documents a claim needs beyond the geofence timestamps.
A container terminal visit that logged ten arrivals
A terminal fence drawn on the property line, with no queue polygon and no exit confirmation, turned one drayage visit into ten arrival events and roughly halved the reported turn time. The trace below shows the visit as the dispatcher's screen saw it and what the redesign changed.
- 05:42: Dray truck TRK-118, booked to collect import box CNTR-4471, reports a position just inside the terminal polygon at the end of the access road; the board shows "arrived terminal".
- 05:44 to 07:35: The truck creeps forward in the queue on the public road; its positions leave and re-enter the polygon nine more times, and each exit closes and restarts the turn-time clock.
- 07:41: The terminal's gate system records gate-in transaction G-0412 for TRK-118, but the dispatch platform does not ingest gate transactions, so the geofence entry at 07:39 stands.
- 09:58: The truck exits with the box; the platform reports a turn time of 2 h 19 min measured from the last entry, against an actual 4 h 16 min from queue arrival.
- Next day, 11:00: The drayage firm's waiting-time claim to the importer is rejected because its own log shows ten arrivals for a single visit; the fence is split into queue and terminal polygons and gate transactions become the gate-in source.
Ten arrivals for one visit is the signature of a fence edge running along a queue. The redesign did not need better satellites or a new device, only a second polygon and a rule that a terminal gate transaction outranks a position crossing the property line.
Which geofence decisions a rule settles and where models suggest geometry
Event emission must follow a written state machine that replays identically, while models are useful for proposing polygons from historical stop clusters and for flagging fences whose behaviour has drifted. The person who owns the geometry approves every proposed change before it takes effect.
Scroll horizontally to see all columns.
| Task | Settled by a rule | What a model may propose | Approver |
|---|---|---|---|
| Emitting arrival and departure from position reports | State machine with stored counts, speeds and buffers | Nothing | Not needed per event |
| Drawing a new customer-site polygon | None | Polygon traced around clusters of past stops with low speed | Customer master data owner |
| Assigning an event when two fences overlap | Planned stop sequence on the trip decides | Most likely stop when the truck is off plan | Dispatcher for off-plan trips |
| Spotting a fence with rising false exits | Monthly false-event rate per fence | Cause tag such as drift or drive-past from the position pattern | Fence owner |
| Deciding whether a detention claim is payable | Contract free time and rate applied to confirmed dwell | Summary of conflicting evidence | Freight audit analyst |
Gate check-in itself, with plate recognition and a fallback when identity fails, is the subject of our yard check-in pilot guide; the geofence's job ends at telling that process a truck has joined the queue.
Testing a new fence before it drives billing or alerts
Replay at least a month of historical positions through a new fence version and compare its events with gate records before the version goes live. A fence that cannot reproduce known visits from history will not produce trustworthy ones in production.
Scroll horizontally to see all columns.
| Check | Method | Evidence to keep with the fence version |
|---|---|---|
| Geometry is valid | Validate the GeoJSON: axis order, closed rings, counterclockwise exterior | Validator output and a map image of the polygon |
| Replay matches gate records | Run 30 days of positions; compare arrivals and departures with gate logs | Share of visits within 5 minutes of the gate record |
| False events are rare | Count visits with more than one entry or exit pair | Rate per 100 visits against the agreed threshold |
| Short stops are visible | Confirm the reporting interval near the site supports the dwell floor | Measured interval and the resulting minimum detectable stop |
| Consumers read the version | Check YMS, TMS and alerts store fence ID and version per event | Sample events showing both fields |
| Owner and customer sign-off | Route the version for approval | Approval record and, for billing fences, the customer's confirmation |
For related visibility, yard and transport topics, browse the logistics hub. Architects building or replacing a visibility, yard or TMS platform who want fence geometry, versioning and replay in the first release can outline their sites and devices in an RFP submission.
Discuss this workflow
Describe your current systems, the recurring exception and the outcome you need. Keep shipment, customer and financial records out of the initial message.
Common operational questions
Practical answers for operations, engineering, and finance teams working on geofence design logistics in logistics & supply chain.
Should a logistics geofence be a radius or a polygon?
How large should a geofence radius be?
How do you stop false geofence arrivals and exits?
Can ELD location data be used for geofence detention timing?
References
Sources checked 13 November 2026. US and India statutory authorities and vendor documentation support platform facts; the worked examples and diagrams are original.
- IETF - RFC 7946, The GeoJSON Format (August 2016), sections 3.1.1, 3.1.6 and 4Longitude-latitude axis order, closed linear rings of four or more positions, counterclockwise exterior rings and WGS 84 coordinates. Accessed 13 November 2026.
- Android Developers - Create and monitor geofencesCircular geofence definition, limit of 100 geofences per app per device user, 100-150 m minimum radius, 20-50 m Wi-Fi accuracy, dwell transition with loitering delay and alert latency. Accessed 13 November 2026.
- GPS.gov (US government) - GPS AccuracySmartphone accuracy of about 4.9 m under open sky, worsening near buildings, bridges and trees. Accessed 13 November 2026.
- eCFR - 49 CFR 395.26 ELD data automatically recorded, paragraphs (d)(1), (d)(2) and (i)eCFR blocked automated access, so paragraph text was checked against the Cornell LII mirror of the current eCFR. Accessed 13 November 2026.
- Government of Tripura, Commissionerate of Transport - Notification No. F.2(33)-TC/VLTD/2023 (20 February 2025) on AIS-140 VLTD fitment under CMVR rule 125HState notification extending AIS-140 fitment to national permit goods carriages; the MoRTH G.S.R. 617(E) of 3 August 2022 requirement for N2 and N3 dangerous-goods vehicles is taken from this notification's reference list, as the MoRTH gazette copy was not retrieved. Accessed 13 November 2026.
- ASC X12 — EDI Supply Chain & Transportation Transaction Sets (204/210/214/856/940/945)US standard for electronic data interchange across shippers, 3PLs, and motor carriers.
- FMCSA — 49 CFR Part 395 Hours of Service & Electronic Logging Devices (ELD)US federal motor carrier dispatch and driver duty-status compliance mandate.
- ULIP & NIC GST E-Way Bill Portal — Unified Logistics & Rule 138 ComplianceIndian statutory goods-in-transit and multi-modal logistics verification framework.