PHPackages                             swisnl/filament-geometry - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. swisnl/filament-geometry

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

swisnl/filament-geometry
========================

Geometry form field for Filament PHP

0.8.1(1mo ago)12.9k↑91.7%MITPHPPHP ^8.2CI passing

Since Jul 3Pushed 1w ago1 watchersCompare

[ Source](https://github.com/swisnl/filament-geometry)[ Packagist](https://packagist.org/packages/swisnl/filament-geometry)[ Docs](https://github.com/swisnl/filament-geometry)[ GitHub Sponsors](https://github.com/swisnl)[ RSS](/packages/swisnl-filament-geometry/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (45)Versions (20)Used By (0)

Filament geometry
=================

[](#filament-geometry)

[![Latest Version on Packagist](https://camo.githubusercontent.com/16960950d039964829116bea9a1efbbf3c5372be6e79d00e1d349dd49fd80e26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737769736e6c2f66696c616d656e742d67656f6d657472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/filament-geometry)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Buy us a tree](https://camo.githubusercontent.com/cec0a9b35a1c3235bdbe0d13ea8fbd866a23e30280ad6ca27078c1fd4ac1b709/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://plant.treeware.earth/swisnl/filament-geometry)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b17b8c79dc46911dddf2948b6f38afef50cf0873f696a727abf119e9fd34a471/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769736e6c2f66696c616d656e742d67656f6d657472792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/swisnl/filament-geometry/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/405d031d1e3bb0619ceda86be6c9ebabe4c55ea090a317e61c072d1cd1ff0f94/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769736e6c2f66696c616d656e742d67656f6d657472792f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/swisnl/filament-geometry/actions?query=workflow%3A%22Fix+PHP+Code+Styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a5d785f7d2aaae910fc31675e25a92f03094b5212dec3f255eaf6877380fb4b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737769736e6c2f66696c616d656e742d67656f6d657472792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/filament-geometry)[![Made by SWIS](https://camo.githubusercontent.com/ef6bdd6ab8d4f47bceb74dcf558b0915c6b419cbba320096324af0518e43091d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539412538302d6d6164652532306279253230535749532d2532333037333741392e7376673f7374796c653d666c61742d737175617265)](https://www.swis.nl)

[![Filament geometry screenshot](https://github.com/swisnl/filament-geometry/raw/main/art/screenshot.png)](https://github.com/swisnl/filament-geometry/blob/main/art/screenshot.png)

Warning

Work in progress, not stable yet!

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require swisnl/filament-geometry
```

Important

If you have not set up a custom theme and are using Filament Panels follow the instructions in the [Filament Docs](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) first.

After setting up a custom theme add the plugin's views to your theme css file or your app's css file if using the standalone packages.

```
@source '../../../../vendor/swisnl/filament-geometry/resources/**/*.blade.php';
```

Component
---------

[](#component)

### Geometry Field

[](#geometry-field)

The **Geometry** field displays a Leaflet map, with a set of configuration options.

[![Map Field](art/screenshot.png)](art/screenshot.png)

Usage
-----

[](#usage)

### Geometry Field

[](#geometry-field-1)

Important

This field is designed to be used in conjunction with a database column of type `(MULTI)POINT`, `(MULTI)LINESTRING`, `(MULTI)POLYGON` or `GEOMETRY`. It currently does not support geometries with mixed types i.e. `GEOMETRYCOLLECTION`.

The form field can be used with no options, by simply adding this to your Filament form schema:

```
use Filament\Forms\Form;
use Swis\Filament\Geometry\Enums\DrawMode;
use Swis\Filament\Geometry\Forms\Geometry;

public function form(Form $form): Form
{
    return $form
        ->schema([
            Geometry::make('location'),
        ]);
}
```

#### Full options

[](#full-options)

The full set of options is as follows. Some option methods support closures, as well as direct values.

```
use Filament\Forms\Form;
use Swis\Filament\Geometry\Bounds;
use Swis\Filament\Geometry\Enums\ControlPosition;
use Swis\Filament\Geometry\Enums\DrawMode;
use Swis\Filament\Geometry\Forms\Geometry;
use Swis\Filament\Geometry\GeoSearchProviders\OpenStreetMap;
use Swis\Filament\Geometry\Icons\Marker;
use Swis\Filament\Geometry\TileLayers\Carto;

public function form(Form $form): Form
{
    return $form
        ->schema([
            Geometry::make('location')
                ->label(__('Location'))

                // Map configuration
                ->maxZoom(16)
                ->minZoom(4)
                ->center(52.164206390898904, 4.491920969490259)
                ->zoom(15)
                ->bounds(Bounds::make(49.5, -11, 61, 2)) // Example for British Isles
                ->tileLayer(Carto::make())

                // Marker configuration
                ->markerIcon(Marker::make('#3b82f6'))

                // Controls
                ->showFullscreenControl(true)
                ->showZoomControl(true)
                ->showAttributionControl(true)
                ->geoSearch(OpenStreetMap::make())
                ->drawModes([
                    DrawMode::Polygon,
                    DrawMode::Rectangle,
                ])
                ->multipart(false)
                ->drawControlPosition(ControlPosition::TopRight),
        ]);
}
```

#### Casts

[](#casts)

The field automatically tries to detect the type of your attribute by checking the model's casts. We currently support the following casts out of the box:

- `string` (or `encrypted`)
- `array` (or `encrypted:array`)
- `object` (or `encrypted:object`)
- Geometries from [matanyadaev/laravel-eloquent-spatial](https://github.com/MatanYadaev/laravel-eloquent-spatial)

If we cannot detect the type automatically, you can specify it manually using one of the following methods:

```
use Filament\Forms\Form;
use Swis\Filament\Geometry\Forms\Geometry;

public function form(Form $form): Form
{
    return $form
        ->schema([
            Geometry::make('location')
                // Use one of the following state cast methods:
                ->asString()
                ->asArray()
                ->asObject()
                ->asEloquentSpatial()
                // Or use a custom state cast that implements \Filament\Schemas\Components\StateCasts\Contracts\StateCast:
                ->stateCast(new YourCustomStateCast()),
        ]);
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/swisnl/filament-geometry/blob/main/CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/swisnl/filament-geometry/blob/main/.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/swisnl/filament-geometry/security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Pjotr van der Horst](https://github.com/pjotrvdh)
- [Jasper Zonneveld](https://github.com/JaZo)
- [All Contributors](https://github.com/swisnl/filament-geometry/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/swisnl/filament-geometry/blob/main/LICENSE.md) for more information.

SWIS ❤️ Open Source
-------------------

[](#swis-️-open-source)

[SWIS](https://www.swis.nl) is a web agency from Leiden, the Netherlands. We love working with open source software.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance96

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Recently: every ~46 days

Total

17

Last Release

38d ago

PHP version history (2 changes)0.1.0PHP ^8.1

0.2.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8734305?v=4)[SWIS](/maintainers/swisnl)[@swisnl](https://github.com/swisnl)

---

Top Contributors

[![JaZo](https://avatars.githubusercontent.com/u/3475007?v=4)](https://github.com/JaZo "JaZo (113 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")[![pjotrvdh](https://avatars.githubusercontent.com/u/2292196?v=4)](https://github.com/pjotrvdh "pjotrvdh (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")

---

Tags

filamentphpgeomanhacktoberfestlaravelleafletlaravelfilamentphpswisnlfilament-geometry

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/swisnl-filament-geometry/health.svg)

```
[![Health](https://phpackages.com/badges/swisnl-filament-geometry/health.svg)](https://phpackages.com/packages/swisnl-filament-geometry)
```

###  Alternatives

[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)[biostate/filament-menu-builder

An Elegant Menu Builder for FilamentPHP

6528.1k2](/packages/biostate-filament-menu-builder)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[schmeits/filament-character-counter

This is a Filament character counter TextField and Textarea form field for Filament v4 and v5

34226.4k13](/packages/schmeits-filament-character-counter)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

6649.5k1](/packages/marcelweidum-filament-passkeys)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
