A warehouse clerk scans a crate staged on a dividing stripe. The inventory screen says that the crate is in two bays. On another screen, a report puts it in neither. The clerk looks down, sees one crate, and wants to know where to send the evening crew. It is tempting to call one of the screens broken. Both may be giving exact answers to different questions. Neither necessarily gives the crew a destination.

The example works because it keeps three things apart. There is a physical object, there is a point that represents the object, and there is a rule for assigning work. The first screen may list any bay whose polygon includes the point, even if it is on the edge. The second may list only bays whose interiors include it. The crew needs an operational decision: one destination, a request to verify, or some other explicitly defined outcome. A decision to send the crew to one side is not evidence that the crate lies on that side.
All coordinates and counts below describe a fictional example. The named software documentation explains the relationships, not a dataset of crates and not a recommendation for a particular facility. The aim is to see why a precise answer can be incomplete, and how to use it without rewriting what was observed.
Make the painted stripe into a mathematical line
Imagine two rectangular regions in a shared indoor floor grid. The west bay runs from horizontal coordinate zero to four; the east bay runs from four to eight. Both run vertically from zero to six. Their interiors do not overlap. Their boundaries share the segment at horizontal coordinate four, between heights zero and six. Put the recorded crate marker at horizontal coordinate four and height three. It is exactly on the shared segment and away from both corners. These integer coordinates specify an exact planar case, not an indoor positioning device's demonstrated accuracy.
An interior is the open part of a polygon's region; the boundary is the edge, including its vertices. For a one-point input, a test that requires contact with the bay's interior fails at this marker. It fails for the west bay and independently fails for the east bay. A test allowing a point in either the interior or the boundary succeeds for both. The result does not mean the bay interiors overlap. The two regions meet at an edge on which they can both have a legitimate boundary-inclusive claim.
The stripe on the floor almost certainly has width, while the mathematical segment does not. In this example assume a drafter used the stripe center as the reference. There are other possible choices. A facility might designate the entire stripe as a clear strip and place the bay edge at the painted ends. It might instead paint a broad stripe mainly to make an underlying reference line easy to see. Those are different descriptions of the site, not different performance settings for the same relationship. If the physical stripe stands for an omitted aisle, forcing it into a geometric edge will hide the very gap users care about.
The crate also has width. A single point can mean its label, its estimated center, the place where a reader last registered it, or a selected corner. A marker that falls in a bay cannot certify that the entire crate fits. An object can be represented accurately as a point for one purpose and inadequately for another. An inventory crew may only need to know where to start looking; a question about a passage being clear involves the footprint and actual clear space. Changing the geometry from a point to a footprint changes the question. It does not simply improve the precision of the same answer.
Before comparing software outputs, specify the two representations and what the point denotes. Then write down a plain-language expectation. For the fictional point on the exact shared segment, “strictly in one of the two interiors” is false for both. “On an edge or in an interior of either of the two polygons” is true for each. Neither answer asks who is responsible for the physical crate.
Within and covers ask different questions
The sf reference for geometric binary predicates places within, covers and covered by among the tools for testing pairs of geometries. In this planar point example the intended tests are with the point as the first argument to within, and the polygon as the first argument to covers. Covered by inverts the latter relationship, so a comparison phrased from the perspective of the point can use it instead. This is not a naming detail. Swapping the inputs without choosing the converse turns a question about the location of a marker into a question about whether a small marker covers an entire bay.
The PostGIS documentation for ST_Within spells out the interior condition: the geometries' interiors must have a point in common, and no part of the first may be outside the second. A point lying only on the polygon boundary fails the interior condition. The PostGIS documentation for ST_Covers describes the inclusive relation: no point of the second geometry lies outside the first. The boundary point therefore qualifies. These definitions serve to explain an ideal point on two valid planar polygons. They are not a claim that every predicate that sounds like “inside” behaves identically across geometry engines and input types.
There is an easy misunderstanding when the example gets generalized. The phrase “interior only” is suitable here as short chart language for a single point. It does not mean a longer geometry can never touch a polygon's boundary and still satisfy a within relationship. A segment can have endpoints on a bay edge and an interior portion in the bay, with none of it outside. A segment lying entirely along the edge is different. If a crate eventually gets a footprint instead of a marker, the familiar shorthand is not adequate documentation of the new test. Read the exact relationship for the geometry types in use.
Exact equality of a coordinate is not a requirement for a useful test fixture, but it makes this one easy to verify without a graphical display. Put one additional marker near the center of each bay to test the argument order and ordinary case. Put a deliberately exterior marker beyond both rectangles to test a genuine no match. Then put the exact shared edge back in. These checks probe different possibilities. A single map screenshot with all markers drawn as dots can conceal that the edge marker got rounded off the edge before the comparison. An independent fixture with short integers makes the expected classification visible before the code runs.
The test is also a good reminder that the result of a predicate is evidence about supplied geometries. It is not a judgment about an unfortunate human choice of where to put a crate. “Point on the shared edge for map revision two” is a defensible stored result. “Crew A put the crate outside its bay” is an inference about behavior that the same output may not support at all.
Bay matches for one edge marker
This plain-text chart and table use invented counts, not a source dataset, production measurements, or an official target. They count bays for the one fictional edge marker on the two valid rectangular polygons above. For the third row alone, “matches” means the single bay returned after applying an explicit one-owner decision to the inclusive candidates.
Interior-only 0 Boundary-inclusive ██ 2 Declared tie-break █ 1
| Rule | Count (bays) |
|---|---|
| Interior-only | 0 |
| Boundary-inclusive | 2 |
| Declared tie-break | 1 |
Every display row starts with the same coordinate. The zero does not say zero crates were observed. The two does not announce a duplicate crate. The one does not indicate that a more accurate position became available. It says a decision layer selected one of the two candidates under the declared rule. The arithmetic of the chart is a count of rule outcomes, not a competition in which the highest bar is best.
For this example, imagine that the crew covering the west bay also handles shared-edge work; the operations record names west, while the geometric record retains west and east. A different facility might route shared-edge work east or mark it pending review. There is no universal directional winner. A choice becomes defensible when an authorized operational convention says what it means, what cases it covers, and how exceptions are handled. The geometry links the decision to the scene, but the rule supplies the decision.
Another reasonable presentation would split the graphic into two parts, one for spatial candidates and one for assigned destinations. That approach may be better at showing these variables are distinct. The shared chart here works as a teaching device precisely because its caption says how the third count was obtained. If someone takes the figure without the caption, the sequence zero, two, one is likely to read as three inconsistent observations about one object. Keep the explanation attached to the counts.
A join can multiply rows without finding more crates
Many map operations are joins: for each marker, produce a result for each polygon that matches. A single original scan can then yield two output records. The resulting rows each describe a valid pair of geometries under the chosen relation. They are not automatically two independent observations. If a stock auditor sums a crate's quantity across those rows, inventory could be overstated even though the spatial test did exactly what was requested.
Three meaningful counts can diverge: distinct markers observed, marker-to-bay candidate pairs, and markers assigned to a single bay. Keep each count labeled. For example, if the source contains only the one fictional scan, there is one observed marker regardless of which geometry rule is run. Under inclusive analysis there are two candidate pairs. Under the example convention there is one assigned marker. If the marker stays unassigned for review, there is still one observation and there may be two candidate pairs. A dashboard that reports “one match” without saying which of those counts it is showing leaves out the most useful part.
The reverse failure arises with interior-only joins. A method that keeps only positive matches can drop the edge scan from the resulting table. That can be appropriate for a query asking solely for interior cases. It is dangerous if the table is mistaken for a full inventory of observations. Preserve a row for the original scan or retain the observations independently from the join. In the assignment view, store why the row lacks a destination. An exact edge, an exterior point, an unreadable coordinate, and an invalid polygon all merit different explanations. Turn them into the same blank and users cannot tell whether to send a crew, fix the map, or repair the input.
Deciding after the join is often useful because it preserves the full candidate set and offers a place to attach explanations. Merely discarding all but the first matching row is not a stable policy. File ordering may change when a layer is exported; query ordering may change when work is parallelized or a table rebuilt. Even sorting by a stable identifier makes a reproducible but otherwise arbitrary convention unless the business actually chooses it. A specific shared-edge responsibility table speaks much more clearly about why west wins than “whichever polygon the software happened to return first.”
A policy for these two rectangles need not force an assignment for any pair of candidates. If two interior tests are positive, for instance, the bay layer may have an overlap or may intentionally support overlapping work zones. That should have its own interpretation. The fact that an inclusive edge case and an interior overlap can each produce two candidates does not make them equivalent. A system can store how each candidate relates to the point before choosing whether an operational rule applies. The same number of rows can then prompt different actions without ambiguity.
An exact edge and an uncertain observation are not the same case
Now give the recorded point a different horizontal coordinate: just to the west of four, height still three. For the ideal planar rectangles, that point belongs to the west interior. Whether a physical crate is actually just west is another question. If the measurement was derived from a blurred camera frame or a coarse floor-grid reader, plausible positions might extend across the line even though the stored numeric position is not on it. The relationship is exact for the supplied coordinates; the observation may not justify confidence about the crate's side.
The opposite also occurs. A device might display a coordinate rounded to the nearest unit, causing distinct physical or recorded positions to be printed as four. A screenshot that shows the point on the stripe is not evidence the stored point equals the boundary. Alternatively the rounded value may be exactly what gets written into the input file. The predicate will legitimately identify that stored point as an edge case, yet the original record may have been slightly offset. There are two questions to diagnose: what did the engine actually receive, and how was that input derived?
Resolution and uncertainty should not be conflated. A large number of reported decimal places can reflect formatting, transformation, or a device's output convention without demonstrating that the crate was located to that level. A record of uncertainty similarly ought to say what it represents. An envelope from an actual measurement method is different from a convenient alert distance selected by a warehouse manager. Treating the manager's distance as an error estimate gives policy the appearance of an instrument property. Treating an uncertain location as a definite tie because both bays are plausible gives a measurement limitation the appearance of an exact topological event.
An organization may decide to flag records within a chosen distance of an edge. This defines a review band; it does not redefine within or covers. The band might say “confirm this case if the consequence of sending the crew to the wrong bay is unusually costly.” It might also be set to reflect evidence about position quality. The reasons differ, so store the rule and its units. A single distance expressed in degrees would not mean the same thing as a single distance expressed in a warehouse grid measured in meters. Even in a metric grid, a rule derived for one sensor or layout should not be presented as universal.
A useful interface can show two fields in the same place. The spatial relation might read “west interior for stored point,” while the status reads “near boundary; verify if destination matters.” For the exact toy point, the fields might read “on west and east boundaries” and “assigned west under edge rule.” The status is not a hidden override of the relation. It conveys a second conclusion with a different source. Giving the two pieces different names prevents them from competing for the same icon on a map.
Do not solve numerical surprise by inventing a measurement
In real coordinate workflows, numbers that should describe the same nominal line can arrive by different routes. The bay boundary may have been resurveyed, projected, imported, or copied from a layout drawing. A marker may have moved through another coordinate transform altogether. Coordinates that agree at the number of digits printed on a screen are not necessarily equal as stored. Even when they are, equal numbers in different frames are not comparable geometry. The question comes before tolerance: did both objects reach the engine in the same frame, units, and map revision?
Snapping modifies a geometry so that it aligns according to a specified rule. It can be helpful for harmonizing two versions of a map or repairing a known drafting artifact, but it changes the numbers the relationship evaluates. If a marked location just west of the line is snapped onto it, the result becomes an exact boundary relation in the resulting geometry. It does not mean the physical crate moved, and it does not create a better measurement merely by making the shape simpler to work with. Keep a raw representation and label any adjusted representation, including the snap settings when relevant. Downstream users can then tell whether a borderline result was present in the input or produced by the processing.
Buffering poses a similar choice. Expand two neighboring bays toward each other's interiors and more points may match both. That result can be entirely appropriate if the polygons are being used to show proximity to each bay. It is misleading if a buffered match is silently reported as original membership. A thin buffer is not the same as a closed polygon. Closing a polygon's membership at the boundary adds the line itself, while expanding the geometry changes which nearby interior and exterior points fall in the region. The choice affects more than the fictional marker exactly at four.
When a result changes after conversion, a record of raw coordinates lets a reviewer replay the relevant sequence. An informative report would identify the map and coordinate version, relation before any adjustment, and relation after the adjustment if one is used. A less informative report would store only a changed point and a statement that it is now correct. That loses the distinction between a fix to input data and a decision about acceptable output. It also prevents comparing repeated scans against the same map without applying different hidden adjustments each time.
The most valuable test is often not more decimal precision. It is a known point on either side, a known point exactly on the reference segment, and a known disagreement between measurements that should remain disagreement. A processing pipeline passing the first three and swallowing the fourth may be convenient but poor at reporting uncertainty. A clean set of results is not automatically a truthful set of records.
GeoJSON carries geometry, not warehouse authority
RFC 7946, the GeoJSON specification, describes an interchange format for geographic features. It specifies geographic coordinates under WGS 84 with longitude and latitude in decimal degrees, and gives the structure of polygon rings, including the use of an exterior ring and possible interior rings. A closed coordinate ring in a file specifies the shape of an edge. It does not say whether a point on that edge must match one feature or two under an application rule.
This is an important difference in the meaning of closed. A ring is closed as a path because the endpoints coincide. A boundary-inclusive region is closed in the everyday geometric sense relevant to this example because edge points are considered part of the region under the stated model. An operational rule can then decide which region receives a particular edge record. Those are separate conventions. Repeating the first coordinate as the last in a polygon ring does not give one warehouse crew priority over another.
The example grid uses small local integers in a flat system and has no actual global location. Do not label those numbers longitude and latitude just because GeoJSON looks convenient. A program might parse the text without recognizing that zero to eight was supposed to be a short walk across a warehouse, not a difference of degrees. Use an explicitly documented local frame for a schematic or an appropriate geographic representation for genuinely georeferenced data. If conversion into an interchange format is necessary, record how the local frame was tied to a place. Reproducibility starts with knowing what the numbers express.
Longitude and latitude order is also a useful reminder that the geometry of a file is not always the geometry imagined by its producer. In a small local file, a horizontal coordinate and a vertical coordinate can appear to be interchangeable if every check uses a square centered near zero. In the fictional rectangles they cannot be swapped without changing the expected edge case. An asymmetric fixture, or a check against a known reference, helps expose an order error before one reaches for an elaborate tie-break. No ownership convention can make the wrong coordinate frame correct.
Polygon rings can enclose spaces that do not belong to the bay interior. Suppose a machine base is represented as a hole in a bay polygon. A marker inside the hole is not in the bay, and a marker on the hole's edge is a boundary case for that polygon under the corresponding planar relations. The relationship test is not necessarily malfunctioning because a dot seems surrounded by the bay color at small scale. Conversely, one should not treat the hole boundary as a shared edge unless a second eligible region actually has an applicable edge there. The topological status of one polygon does not carry responsibility for the neighboring space.
Records may include application properties such as a bay label or a group identifier, and an operational layer can reference those properties. A file reader should not have to infer which field is authoritative from its spelling. The geometry standard covers the interchange structure. The organization still needs to name the key, the versioned responsibility rule, and what to do when a key is missing. Compare two files with identical coordinates but different active rule versions: the geometry stays the same, while the evening crew can legitimately be sent elsewhere. A map diff alone cannot explain the change.
Choose the boundary model knowingly
The toy example uses simple Euclidean rectangles and defines the exact cases for that setting. Geographic work can use a spherical engine with documented boundary choices. The s2 options reference documents open, closed and semi-open models. The sf predicate reference describes model arguments for some predicates and passes options to s2 in applicable operations. A researcher writing a reproducible note should record the actual backend and options instead of assuming functions with familiar names are interchangeable under all modes.
One benefit of a semi-open model in a properly constructed partition is the possibility of handling shared boundaries without attributing a point to both polygons. This still does not mean the engine's convention matches a desired owner. A mathematical partition solves a uniqueness problem for the geometries and model in use. The warehouse convention solves responsibility for specific cases. If the two do happen to agree, write down how you know that rather than inferring it from the word “semi-open.” A model built for one problem can look like a perfect fit when the only demonstration happens to be the simple edge chosen in the tutorial.
Geometry model and function could both be specified without making a national-scale geographic case behave like a floor grid. Greater extent, the nature of an edge between vertices, and the coordinate system are distinct considerations. A projected planar representation and a spherical representation may answer different exact questions before any point even reaches an ownership layer. Readers do not need a lecture on every engine to reproduce the toy example; they need to know why the example is planar, and why the same three bars cannot be transplanted blindly into another mode.
A note on reproducibility should also name the scope of uniqueness. A point in the middle of our shared segment has two candidate boundaries. At a junction of four valid grid cells it may touch all four. At an outer corner only one may be present. A rule defined for one pair of bays does not automatically define those other outcomes. If a software library resolves all these cases mathematically, the business can still leave some of them undecided operationally. That is not an indecisive graph. It may be an honest description of the work instructions.
Recognize when the map, not the predicate, is the source of the result
A sensible incident review asks whether the map actually contains the edge shown on the floor. Suppose west stops at a coordinate slightly less than four and east starts at a coordinate slightly greater than four. The marker at four then lies in a gap, and closed coverage by either rectangle is false. An exact predicate cannot infer that the gap was supposed to have zero width. If the gap corresponds to a real lane, false is a useful answer. If an editor accidentally created it, fixing the editor's map is better evidence than assigning every unmapped point to the nearest polygon.
If instead both bays extend a little past the intended line, the marker can lie in both interiors. A comparison of the point against both original polygon boundaries can distinguish this from merely touching an edge. To detect the overlap in the bay layer itself, investigate the shared area rather than treating every polygon intersection as unwanted. Well aligned adjoining bays intersect along a segment by design; an interior overlap answers a different question. Reporting the relevant kind of intersection allows both a valid arrangement and a flawed one to be understood without conflict.
An invalid polygon is another case. For example, if a representation intended to describe one simple bay crosses through itself, its intended interior may not be clear. The PostGIS references warn against using these predicates with invalid geometry. A valid negative, a valid double match, and a result from a bad shape deserve different statuses. If the layer is repaired, keep the original or its provenance and verify that the repair reflects the real layout. A tool returning something usable is not proof that its interpretation of the intended bay was the one a drafter meant.
One data quality check with broad value is to compare the edge definitions independently of any particular crate. Ask whether there is an intentional gap, an intended shared border, or an overlapping area. Ask whether the current version describes the same arrangement as the one active at the time of the scan. A result that looks wrong after a rack moves could turn out to be a correct relationship on yesterday's plan. Treating the current file as the only possible truth can make a good historical observation seem out of bounds.
There are also cases where area polygons should not partition the world in the first place. A stocking zone and a cleaning zone may overlap for entirely valid reasons. Identifying both is useful if a record is used for two different kinds of work. The cardinality requirement applies to a named task, not every map layer and every user. The crew responsible for the crate pickup can be selected without abolishing overlapping responsibilities for other jobs. The decision design should name the task so that an exact query never has to pretend there is only one useful way to organize a floor.
Keep the observational and operational records side by side
A clean inventory record can be designed as a chain of small statements. First capture the original observation: which marker, when it was recorded, which device or entry supplied the coordinates, and what coordinate frame was declared. Next document any preparation of the geometry: the floor version, transformations, validation decisions and an adjusted coordinate if one is actually used. Then store the relation result and its candidate set. Finally attach a destination, a reason or a review state from the active policy. Those fields need not live in one oversized table. They just need stable links so a reader can walk back from a dispatch to the observation.
Consider what happens if the assignment policy changes next month. Under this chain, the old coordinate remains the same and the old decision is still intelligible. Applying a new shared-edge rule might generate a new proposed owner for planning but does not retroactively move the crate or invalidate the original dispatch. Conversely, if someone identifies a coordinate transcription error, it can be corrected with an explicit amended observation rather than by quietly altering last month's candidate list. Different kinds of revision can then be reviewed by the right people.
This structure makes it possible to answer questions that a bare assigned field cannot. Why was this marker not routed automatically? Was this the only likely bay, or just the selected one? Did staff have a low quality measurement, or were the map and point precise enough to establish an exact shared edge? If the location was unknown, did the system record that uncertainty before checking the list of bays? An operator can still see a simple destination or review message. Behind it, there is an explanation that survives longer than today's interface.
A hypothetical record might say: source observation, point at four by three in the local frame; map, west and east rectangles from the same revision; geometry relation, on both boundaries; policy, west designated for this shared segment; dispatch, west; uncertainty about the observed physical location, not evaluated. The final phrase matters. A reader will not mistake the simplicity of the illustration for a demonstrated positioning guarantee. If the source observation came from a measurement with a documented uncertainty envelope, that evidence could occupy its own field rather than being guessed from the output.
The same structure protects an intentional no assignment. A shared point nearest to a particular aisle may fall outside the exact scope of a routing rule. “Pending review; no convention for this junction” is a complete operational status, not incomplete software. A point with only one spatial candidate can also be pending if other evidence makes the destination uncertain. One plausible bay does not force a choice in every process, just as two candidates need not require a manual decision where a routine responsibility rule already exists.
Test decisions and geometry independently
Test the exact same polygons and stored point without the business layer. Expect no interior matches and two inclusive matches. Then run the chosen assignment rule on the known inclusive results and expect one destination, west under the stated example. If you verify only the final destination, it is possible for multiple errors to cancel: the geometric function might incorrectly return only west, and a routing step might simply pass through all matches. The output would look right for the fixture while neither layer did the promised work.
A useful small suite includes an ordinary point with one match, a true outer boundary, a point in a deliberate gap, and a point on a junction whose rule is not covered by the simple edge convention. It also includes an overlap as an explicitly different condition. Record why each fixture is in its expected state before testing it. That note helps a reviewer decide whether a failing test reflects changed requirements, changed coordinates, or changed behavior. If a new map deliberately introduces a clear strip, its updated fixture should say that it represents a modeled gap rather than preserving the old expected answer out of habit.
Check presentation as well as calculation. A report should not redraw a rounded marker on the centerline while claiming its position was exactly checked without rounding. A dispatch list should avoid allowing the same label scan to add stock twice. A review view should show the candidates without suggesting that both crews must act unless that is actually the policy. Each is a test of how conclusions travel to the people using them. The machine's boolean output might be correct even when a caption, row count or color quietly changes its meaning.
Finally, keep the motivating question in view. If a team wants to know where to walk, giving both candidates without a decision may waste time. If a team wants to audit geometry, retaining both is exactly right. If a team wants to know the physical side of a poorly measured crate, neither a deterministic tie-break nor a higher number of displayed decimals creates the missing evidence. When the clerk asks where to send the evening crew, the useful answer is “west under the shared-edge rule.” The useful record is longer: it also says why, preserves the point, and leaves room to disagree about the physical position without breaking the dispatch.