Giter Club home page Giter Club logo

spring-boot-spatial-example's Introduction

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 GeoDB/H2 (default) or MySQL, which supports basic spatial types. If you want to run this example on MySQL, prepare a "spatialdemo" database and change DB credentials in src/main/resources/application.properties. It should be rather easy to switch to another DB supported by Hibernate as well. Geometry types in DB are a bit non-standard, that is something you might need to adjust a bit.
  • Vaadin and V-Leaflet add-on to build the UI layer. V-Leaflet is a Vaadin wrapper for Leaflet, the awesome slippy map library. With V-Leaflet we use the Editable extension and its Vaadin Field implementations which make it dead simple to edit JTS data types directly from the JPA entities.
  • As base layer for maps, OpenStreetMap layer 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 MySQL's spatial queries.

Enjoy!

spring-boot-spatial-example's People

Contributors

dve avatar juan78 avatar mstahv avatar ramazansakin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-boot-spatial-example's Issues

Getting error while persisting Point Data

Using same code and getting below error. Using Mysql 5.7 + and Java 8

Hibernate: insert into spatial_event (version, date, location, route, title) values (?, ?, ?, ?, ?)
Hibernate: insert into spatial_event (version, date, location, route, title) values (?, ?, ?, ?, ?)
Jul 04, 2017 5:23:43 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Data truncation: Cannot get geometry object from data you send to the GEOMETRY field
[main] INFO org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer -

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
[main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:803)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:784)
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:771)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
at org.vaadin.example.SpatialSpringBootAppApplication.main(SpatialSpringBootAppApplication.java:15)

ST_Within not found Error!

@Query(value = "select resource from Resource resource where Within(resource.point, :circle) = true") List<Resource> test(@Param("circle") Geometry circle);

And I set all those confs in application.properties is as same as yours.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.