https://github.com/xdev-software/vaadin-maps-leaflet-flow
A Vaadin Flow Java API for Leaflet Maps 🗺️ Component (https://leafletjs.com/)
https://github.com/xdev-software/vaadin-maps-leaflet-flow
leaflet maps vaadin vaadin-addon
Last synced: 8 months ago
JSON representation
A Vaadin Flow Java API for Leaflet Maps 🗺️ Component (https://leafletjs.com/)
- Host: GitHub
- URL: https://github.com/xdev-software/vaadin-maps-leaflet-flow
- Owner: xdev-software
- License: apache-2.0
- Created: 2019-12-04T14:44:17.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2025-05-05T04:15:53.000Z (8 months ago)
- Last Synced: 2025-05-09T00:07:33.295Z (8 months ago)
- Topics: leaflet, maps, vaadin, vaadin-addon
- Language: Java
- Homepage: https://vaadin.com/directory/component/leafletmap-for-vaadin
- Size: 8.02 MB
- Stars: 42
- Watchers: 4
- Forks: 19
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://vaadin.com/directory/component/leafletmap-for-vaadin)
[](https://mvnrepository.com/artifact/software.xdev/vaadin-maps-leaflet-flow)
[](https://github.com/xdev-software/vaadin-maps-leaflet-flow/actions/workflows/check-build.yml?query=branch%3Adevelop)
[](https://sonarcloud.io/dashboard?id=xdev-software_vaadin-maps-leaflet-flow)

# LeafletMap for Vaadin
A Vaadin Flow Java API for [Leaflet](https://leafletjs.com/)

## Usage
This API wraps the Leaflet API in a Vaadin friendly way.
It uses a similar structure (classes, methods) as the [Leaflet JavaScript API](https://leafletjs.com/reference.html).
To get started it's recommended to have a look at the [demo](./vaadin-maps-leaflet-flow-demo), notably the [minimalistic example](./vaadin-maps-leaflet-flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/MinimalisticDemo.java).
> [!NOTE]
> **The API only supports sending instructions to the client**
> Due to data integrity retrieving client-side data (that can be modified by users) is not supported.
>
> Event listeners can still be registered but this needs to be done manually. An example is available [in the demo](./vaadin-maps-leaflet-flow-demo/src/main/java/software/xdev/vaadin/maps/leaflet/flow/demo/EventDemo.java).
>
> The following code snippet is a simplification of an even more complex example which sends (unvalidated!) client side data back to the server (click to expand)
>
> ```java
> this.map.on("click", "e => document.getElementById('" + ID + "').$server.mapClicked(e.latlng.lat, e.latng.lng)");
> ...
> @ClientCallable
> public void mapClicked(double lat, double lng)
> {
> LOG.info("Map clicked - lat: {}, lng: {}", lat, lng);
> }
> ```
>
## Installation
[Installation guide of the latest release](https://github.com/xdev-software/vaadin-maps-leaflet-flow/releases/latest#Installation)
#### Static resources
Please note that Leaflet uses a few default icons for various components (e.g. Markers).
These are also shipped with the library and can be found inside [``META-INF/resources``](./vaadin-maps-leaflet-flow/src/main/resources/META-INF/resources/).
You might have to fine tune your security configuration to allow these.
#### Compatibility with Vaadin
| Vaadin version | vaadin-maps-leaflet-flow version |
| --- | --- |
| Vaadin 24+ (latest) | ``3+`` |
### Spring-Boot
* You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages)
## Run the Demo
* Checkout the repo
* Run ``mvn install && mvn -f vaadin-maps-leaflet-flow-demo spring-boot:run``
* Open http://localhost:8080
Show example

## Support
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
## Contributing
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
## Dependencies and Licenses
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/vaadin-maps-leaflet-flow/dependencies)