Skip to content

mstahv/spring-boot-spatial-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Spring Boot example editing spatial data in relational database

Alt text

This is a small example app that shows how one can use:

  • Spring Boot and Spring Data
  • Latest Hibernate with spatial features. At the application API, only standard JPA stuff (and Spring Data) is used.
  • The example also uses QueryDSL spatial query as an example. QueryDSL contain excellent support for spatial types. QueryDSL example replaced with plain JPQL(with Hibernate spatial extensions) as the latest version is not compatible with latest JTS/Hibernate. See querydsl/querydsl#2404. If you want to see the example of QueryDSL usage in this setup, check out a bit older version of the example.
  • Relational database, like PostGis (default, Postgres + extentiosn), H2GIS or MySQL, which supports basic spatial types. The example automatically launches Docker image with PostGis for the demo using TestContainers, if run via TestApp class in src/test/java/org/vaadin/example. Not that Hibernate might need tiny adjustments for other databases.
  • Vaadin and MapLibreGL }> add-on to build the UI layer. MapLibre add-on is a Vaadin wrapper for MapLibre GL JS slippy map widget and mapbox-gl-draw. Its Vaadin field implementations which make it dead simple to edit JTS data types directly from the JPA entities.
  • As base layer for maps, crisp vector format OpenStreetMap data via MapTiler is used, but naturally any common background map can be used.

...to build a full-stack web app handling spatial data efficiently.

As the data is in an optimized form in the DB, it is possible to create efficient queries to the backend and e.g. only show features relevant to the current viewport of the map visualizing features or what ever you can with the spatial queries.

Enjoy!

About

A Spring Boot example editing spatial data in MySQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages