Skip to content

Example project that uses v-leaflet to edit JPA entities in a basic Vaadin app

Notifications You must be signed in to change notification settings

mstahv/vleafletexample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

V-Leaflet example project

This is a small usage example of V-Leaflet in a small Vaadin application. It is built to show how easy it can be to add some GIS features into typical Vaadin application - even without setting up a separate geoserver or its various commercial competitors. The app uses simple "domain driven JPA backend". The UI itself is rather rude and e.g. error handling is minimal, but the code should be easy to understand as a Leaflet usage example.

This example app is not trying to demonstrate all V-Leaflet features, but just to give an overall picture. For relevant V-Leaflet specific code examples, see at least these classes:

  • GisUI : The main UI that contains basic map, OSM base layer and data queried from the JPA backend
  • JTSField and its subclasses PointField and LineStringField
    • These implement Vaadin Field interface to edit JTS data types that are used in model objects. They demonstrate usage of Leaflet.Draw features. In EventEditor form these fields are used to do normal Vaadin bean binding to edit JPA entities. Field implementations might be useful in your own apps as well, feel free to use them.

The app uses work in progress version of Hibernates spatial extensions, but that is by no means necessary with v-leaflet. The JPA session is used in J2SE style, but should be easy to adapt to e.g jboss, just use extended persistence context. This is fine for at least apps with moderate concurrent users. The used database is h2 (for portability), but I'd bet using PostgreSQL/PostGIS is a more tested combination for production usage.

To play with the project you just need to import it into your favorite IDE, execute "mvn package" and deploy it into server (or use "mvn jetty:run").

Things planned to improve the demo:

  • JTS support (and built in Field implementations) to v-leaflet add-on
  • Example of spatial query so that only relevant entities are selected from database to maps viewport.

Links to projects that "make this possible"

About

Example project that uses v-leaflet to edit JPA entities in a basic Vaadin app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages