wm/map-multi-polygon
A Laravel/PHP package for managing multiple polygons on maps. Define, store, and render multi-polygon geometries with coordinate handling, boundary data, and map integration support, simplifying location-aware features and spatial datasets.
composer require wm/map-multi-polygon (confirm vendor/package name from the repository README). Pin at least ^1.0.4 — earlier patches lacked null handling in fillModelWithData().php artisan vendor:publish --tag=map-multi-polygon or check README.md for the exact tag.use Wm\MapMultiPolygon\MapMultiPolygon;
public function fields(Request $request)
{
return [
MapMultiPolygon::make('Area'),
];
}
README.md, src/, resources/js/components/, and config/ if present. The Vue component shows the expected value shape; the PHP field class shows meta() defaults, fillModelWithData() hydration behavior, and serialization.json or spatial column to a model, expose it through Nova with this field, draw one or more polygons, save, then inspect the stored payload in Tinker. Confirm it is GeoJSON MultiPolygon or an array of polygon coordinate rings before building further logic. Also test saving the field empty/null on both create and update to confirm your installed version behaves as expected.'area' => 'array' or a custom cast that normalizes the field output to GeoJSON MultiPolygon.DB::statement('ALTER TABLE areas ADD COLUMN geom geometry(MultiPolygon, 4326)');
Then in a saved observer: ST_GeomFromGeoJSON(?). For MySQL, use ST_GeomFromGeoJSON with SRID 4326 consistently.dependsOn, hideWhen, readonly) for workflows where geometry is only editable after a type/category is chosen.->onlyOnDetail() or ->exceptOnForms() if supported, or fall back to a custom Nova component.meta() or package config: tile URL, default center, zoom, drawing controls, and API key (if any).[longitude, latitude], not [latitude, longitude]. Most map errors come from swapped coordinates.fillModelWithData() null handling was only fixed in v1.0.4 (2025-05-27), so earlier versions can error when hydrating a record whose geometry is null. If you are on 1.0.3 or below, upgrade before relying on nullable columns, and still normalize deliberately — saving null, [], or an empty MultiPolygon may produce different database values or break spatial casts. Cover create, update, and clear-the-geometry flows in tests.1.0.4), read the changelog before upgrading, review the source, and wrap storage-format assumptions in tests. Expect limited community support.npm/Vite build output, Nova version compatibility, and browser console errors. Inspect the Nova field response in the network tab for the meta payload.meta(), config file, and model cast. Prefer a custom cast/validation rule over editing vendor code so upgrades remain possible.fill()/resolve()/fillModelWithData() and comparing it to what the map component expects. Most “map doesn’t load” bugs are shape or null mismatches, not map rendering bugs.How can I help you explore Laravel packages today?