jamesil/nova-google-polygon
A Laravel Nova field for drawing and editing polygons on Google Maps, storing polygon coordinates or GeoJSON in your models. Adds an interactive map input to Nova forms for location-based data.
What this package is (from the release evidence): a Laravel/Nova field package (jamesil/nova-google-polygon) that captures Google Maps polygon geometry in a Nova resource and exposes a server-side Polygon::contain() point-in-polygon predicate. The TPM-relevant surface is therefore not the map UI but the containment predicate — it is the component that encodes business rules (service eligibility, territory/zone assignment, delivery coverage, risk geofencing) into code.
Architecture fit: Good for Laravel/Nova-centric apps that need lightweight geofencing without standing up PostGIS. contain() is a pure PHP computation over stored geometry, so it fits cleanly into form validation, Nova actions, queued jobs, and policy checks. It is not a spatial index or query engine — any workload of the form "which of N polygons contains this point" scales linearly and needs an application-level bounding-box prefilter or a real spatial store. Treat it as a rule evaluator, not a geospatial database.
V2.1.1 significance: This is a correctness release, and the defect class it closes is the one that matters most for a TPM — silent wrong answers. The prior implementation returned incorrect results whenever the queried point shared a longitude with a vertex, and threw ValueError for coordinates near the equator (scientific-notation strings reaching bccomp). Wrong-but-successful geofence decisions produce incorrect business outcomes with clean logs and green dashboards; that is materially worse than an outage.
Technical risk assessment:
| Risk | Severity | Notes |
|---|---|---|
| Historical decisions computed under ≤2.1.0 are unreliable near-equator and on vertex-shared longitudes | High | Silent; no error signal existed to trigger investigation |
| Edge/vertex semantics are a documented convention, not "obvious" | Medium | Vertex = inside; half-open edges (min-latitude and min-longitude inclusive) |
Degenerate/empty polygons now return false instead of erroring |
Medium | Any code that caught the exception as a validation signal now silently gets "not contained" |
| Vendor concentration (small maintainer, single package) | Medium | Mitigated here by unusually strong verification evidence |
Verification confidence — a positive signal worth recording: An exact-integer oracle across 8M+ comparisons over 155k convex, concave, and self-intersecting polygons with zero mismatches, plus an independent float reference across equator/meridian/extreme-magnitude regimes, is a materially higher bar than typical package test suites. From a TPM standpoint this converts the upgrade from "trust the changelog" to "trust but verify with your own fixtures."
Key questions for the maintainer / team:
1.2.1 on the 1.x line, implying 2.x targets a newer Laravel/Nova baseline. What exactly is the supported matrix for 2.x (Laravel 12? Nova 5? PHP 8.2+)?1.2.1 functionally identical to 2.1.1 for this fix, or does the 1.x backport omit anything?contain(), or can UI and server disagree on boundary points?ext-bcmath used anywhere else in the package, or was it solely a contain() dependency?contain() behave for antimeridian-crossing polygons and polar coordinates — in scope, or explicitly out of scope?Stack fit: Laravel + Nova + composer. Upgrade is a single composer update jamesil/nova-google-polygon. No API change means no code edits, no config migration, no front-end rebuild. This is the cheapest possible upgrade shape.
Compatibility / migration path:
1.x line and the target is 1.2.1, not 2.1.1. Pinning ^1.0 vs ^2.0 is now a real constraint decision, not a formality — capture it in composer.json deliberately rather than letting the resolver decide.ext-bcmath removal is a deployment simplification: it unblocks minimal containers, shared hosting, and managed PHP runtimes where bcmath is absent. Verify nothing else in your app declares bcmath implicitly through this package's transitive needs.Sequencing (recommended):
false is the desired answer or whether that should be a data-quality alert.Ordering caution: do not bundle this with unrelated Nova or Laravel major upgrades. Because the behavior change is silent (wrong → right; error → false), you want a clean diff where any observed change in business outcomes is attributable to exactly this package.
Maintenance: Low ongoing cost — small package, narrow responsibility, no configuration surface described. The upgrade carries no migration burden. The one durable maintenance obligation is documenting the boundary convention in your own domain docs, because the next engineer who touches a geofence rule will otherwise assume "on the line" is undefined behaviour. Half-open semantics (min-latitude and min-longitude edges inclusive) are correct and standard, but they are only safe if written down.
Support surface: No API change means no developer retraining and no client-facing API contract change. Support risk concentrates in a single question: "why did this location's zone assignment change?" Pre-brief support/success teams that boundary and near-equator results may shift, and that the shift is a correction, not a regression.
Scaling: Ray casting is O(n) in vertices per query and re-evaluates geometry on every call. Practical limits:
ST_Contains if geofencing becomes a primary workload.Failure modes to monitor:
false — an admin saving a malformed polygon (fewer than three vertices) now yields "not contained" silently. Instrument this: log/alert on degenerate geometry at write time rather than discovering it as a coverage gap.Ramp-up: Very low for developers — no new API, no new concepts. The genuine ramp-up cost is organizational: establishing that geofence correctness is a business-critical invariant with fixtures and monitoring attached, not a UI nicety. Budget roughly a sprint-day for the regression fixture set, the flip-set comparison, and the convention documentation; treat the backfill decision separately if the flip set is non-trivial.
TPM recommendation: Upgrade, and prioritize doing so — the pre-2.1.1 behavior is a live silent-correctness defect in any application that geofences near the equator or along shared longitudes. Sequence it as a correctness change with an explicit audit step, not as a routine dependency bump. Confirm the 2.x vs 1.2.1 line mapping as the sole blocking gate before scheduling.
How can I help you explore Laravel packages today?