Download the PHP package doode/filament-map-picker without Composer

On this page you can find all versions of the php package doode/filament-map-picker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-map-picker

Filament V3 Map Picker + Geoman Drawing Plugin

Latest Version on Packagist Total Downloads Software License

Introduction

Map Picker is a custom field of Filament designed to simplify the process of selecting a location on a map and obtaining its geo-coordinates with the ease of having the Geoman plugin embedded in the map.

GeoMan Integration

This package now includes integration with GeoMan, a powerful tool for creating and editing geometries on maps. GeoMan allows users to draw various shapes, edit existing geometries, and perform advanced map editing tasks.

GeoMan Features:

Supported Maps

Map Picker currently supports the following map:

  1. Open Street Map (OSM)
  2. Google Maps

Installation

You can easily install the package via Composer:

Basic Usage

Resource file:

clickable Option

This will allow you to set the point on the map with a click. Default behaviour has the marker centered as the map is dragged underneath. You could, with this, keep the map still and lock the zoom and choose to click to place the marker.

rangeSelectField Option

The rangeSelectField Option allows you to specify another field on your form which specifies a range from the point identified by the marker. That field must be in meters. So for example you could do this:

In this case, as you change the value on the Select a circle of that radius centered on the marker will change to match your drop down.

liveLocation Option

The liveLocation method accepts three parameters:

  1. bool $send: Determines if the user's live location should be sent.
  2. bool $realtime: Controls whether the live location should be sent to the server periodically.
  3. int $milliseconds: Sets the interval (in milliseconds) at which the user's location is updated and sent to the server.

Example:

boundaries Option

The idea here is that you can set a boundary box by defining two points, the southwest most point and the north east most point, and your map will pan back into the panned area if you drag away, such that the points can only be selected if you stay in the map.

You will want to set the minZoom() along with this if you set showZoomControl(true). To choose a good value for minZoom() you will need to consider both the size of the map on the screen and the size of the bounding boxm, and you may find trial and error is the best method.

To turn it off again - possibly a strange use case - boundaries(false) is what you want.

setBoundsToBritishIsles Option

This is a convenience function that uses the boundaries option above, setting the boundary box to (49.5,-11) and (61,2)

Options Table

Here's a table describing all available options and their default values:

Option Description Default Value
draggable Allow map dragging true
showMarker Display marker on the map true
tilesUrl URL for map tiles 'http://tile.openstreetmap.org/{z}/{x}/{y}.png'
attribution Map attribution text null
zoomOffset Zoom offset -1
tileSize Tile size 512
detectRetina Detect and use retina tiles true
minZoom Minimum zoom level 0
maxZoom Maximum zoom level 28
zoom Default zoom level 15
markerColor Color of the marker '#3b82f6'
liveLocation Enable live location updates [false, false, 5000]
showMyLocationButton Show "My Location" button false
default Default location ['lat' => 0, 'lng' => 0]
geoManToolbox.show Enable GeoMan false
geoMan.editable Allow editing with GeoMan true
geoMan.position Position of GeoMan controls 'topleft'
geoMan.drawCircleMarker Allow drawing circle markers true
geoMan.rotateMode Enable rotate mode true
geoMan.drawText Allow drawing text blocks false
geoMan.drawMarker Allow drawing markers true
geoMan.drawPolygon Allow drawing polygons true
geoMan.drawPolyline Allow drawing polylines true
geoMan.drawCircle Allow drawing circles true
geoMan.dragMode Enable drag mode true
geoMan.cutPolygon Allow cutting polygons true
geoMan.editPolygon Allow editing polygons true
geoMan.deleteLayer Allow deleting layers true
geoMan.color Stroke color for drawings '#3388ff'
geoMan.filledColor Fill color for drawings '#cad9ec'

New feature to capture image from the map

This is an example of the code in how to trigger the function in the map in order to capture the snapshot. Note: Latitude and longitude are not mandatory, you can move the map and trigger the action to capture the image.

“If you have Geoman shapes drawn on your map, they will be included in the generated image.”

In your web.php file is necessary to add the route, i.e you can use a custom Controller The map feature will post the blob image to this url /upload-map-image

If you wish to update the map location and marker either through an action or after altering other input values, you can trigger a refresh of the map using the following approach:

Usage As Infolist Field

The MapEntry Infolist field displays a map.


Usage Guide for Handling Map Locations

This section explains how to handle and display map locations within your application using this package.

Step 1: Define Your Database Schema

Ensure your database table includes latitude and longitude columns. This is essential for storing the coordinates of your locations. You can define your table schema as follows:

Step 2: Retrieve and Set Coordinates

When loading a record, ensure you correctly retrieve and set the latitude and longitude values. Use the following method within your form component:

Step 3: Add Form Fields for Latitude and Longitude

Add hidden form fields for latitude and longitude to your form. This ensures the values are present but not visible to the user:

If you prefer to display these values in a read-only format, replace hidden() with readOnly().

Alternative Approach: Using a Single Location Attribute

If you prefer to handle the location as a single field, you can define a custom attribute in your model. This method avoids the need for separate latitude and longitude columns:

This approach encapsulates both latitude and longitude within a single location attribute, streamlining your code.

Updates for version 1.4.0 and above

User can customize marker icons now, It is possible to use SVG or base64 encoded value

User can set the marker size using ->iconSize()

Example in how to use custom SVG Icon when "edit" a record from database

Another way to update in real time if you have a list of icons in a dropdown list You can display the icon in the list as well and use this icon to set as a marker in the map, like the example below.

You can do it in your way, just call $livewire and pass the parameter 'updateMarkerIcon'

License

MIT License © Doode

Security

We take security seriously. If you discover any bugs or security issues, please help us maintain a secure project by reporting them through our GitHub issue tracker. You can also contact us directly at [email protected].

Contribution

We welcome contributions! contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

All versions of filament-map-picker with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.2
spatie/laravel-package-tools Version ^1.15.0
illuminate/contracts Version ^10.0 || ^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package doode/filament-map-picker contains the following files

Loading the files please wait ....