GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sebasbaumh/postgis-java-ng: PostGIS Java bindings

BranchesTags
Open more actions menu

Latest commit

 

History

709 Commits
709 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.settings
.settings
 
 
src
src
 
 
.classpath
.classpath
 
 
.gitignore
.gitignore
 
 
.project
.project
 
 
AUTHORS
AUTHORS
 
 
ClassHierarchy.png
ClassHierarchy.png
 
 
ClassHierarchy2.png
ClassHierarchy2.png
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 
postgis-java-ng dependencies.launch
postgis-java-ng dependencies.launch
 
 
postgis-java-ng only release (MacOS).launch
postgis-java-ng only release (MacOS).launch
 
 
postgis-java-ng only release (Windows).launch
postgis-java-ng only release (Windows).launch
 
 
postgis-java-ng package.launch
postgis-java-ng package.launch
 
 
postgis-java-ng release (MacOS).launch
postgis-java-ng release (MacOS).launch
 
 
postgis-java-ng release (Windows).launch
postgis-java-ng release (Windows).launch
 
 

Repository files navigation

PostGIS Java bindings (Next Generation)

CodeQL Maven Central javadoc License

Lines of Code Security Rating Reliability Rating Maintainability Rating

This project contains Java bindings for using PostGIS geometries coming from a PostgreSQL database.
It is originally based on postgis-java and I want to thank its authors for their work.

Project goals and improvements:

  • Support for geometries containing arcs like CIRCULARSTRING or CURVEPOLYGON
  • Support for PostGIS geography datatype
  • Extended support for bounding boxes, i.e. box2d/box3d PostGIS data types (as PGbox2d/PGbox3d)
  • Support for wrapped connections (like used in WildFly and c3p0 connection pooling)
  • Use generic Java types where possible and simplify/streamline API
  • Clean up code to basically only work on WKB/EWKB implementations to reduce code duplication and focus on the actual database format
  • Support for binary transfer of geometry data (if enabled in PostgreSQL JDBC driver)
    • use PostgreSQL JDBC driver 42.5.1 or later to enable it automatically
  • Support for the latest PostgreSQL and PostGIS versions
    • Recommended are PostgreSQL 15.1 and PostGIS 3.2.2
    • Supported are versions starting from PostgreSQL 9.6 and PostGIS 2.3
  • Support for current JDKs
    • JDK 21 (main branch)
    • deprecated branches
      • JDK 17
      • JDK 11
      • JDK 8
  • The license is still LGPL
  • The authors are listed here

Supported geometry types:

  • Point
  • LineString
  • CircularString
  • CompoundCurve
  • Polygon
  • CurvePolygon
  • MultiPoint
  • MultiLineString
  • MultiCurve
  • MultiPolygon
  • MultiSurface
  • GeometryCollection
  • box2d
  • box3d

How to use it

There is a Maven artifact in the official Maven repository, so just add this to your Maven POM:

<dependency>
	<groupId>io.github.sebasbaumh</groupId>
	<artifactId>postgis-java-ng</artifactId>
	<version>25.1.1</version>
</dependency>

The version reflects the year of the release, e.g. 25.1.1 is a version released in 2024.

The API differs a bit from postgis-java with the main point being a different namespace (io.github.sebasbaumh.postgis) as publishing a project to Maven Central requires to own that namespace. In addition the class structure is a bit different (see below) to support arc geometries and reduce boilerplate code, but you should be able to adapt to it easily. The implementations of the parser and writer for the geometries have been heavily reworked to speed up processing and reduce complexity.

Hierarchy of geometry classes:

Hierarchy of geometry classes

Hierarchy of bounding box classes

How to run tests utilizing a PostgreSQL server

You will need a PostgreSQL server with installed PostGIS extension for some of the tests.

In this example the server is named MyServer and the database UnitTestDB. The database can be empty except installing the PostGIS extension.

You should set up a database user for the unit tests, which has access rights to this database and only to this one. In this example the user is called unittest and has the password CHANGEME.

To run the unit tests accessing the server, add the following to your VM arguments (eclipse Run Configuration->Arguments->VM arguments):

-DtestJdbcUrl="jdbc:postgresql://MyServer/UnitTestDB" -DtestJdbcUsername="unittest" -DtestJdbcPassword="CHANGEME"

Or add the following Maven build parameters to the launch configuration in eclipse:

Parameter Name Value
testJdbcUrl jdbc:postgresql://MyServer/UnitTestDB
testJdbcUsername unittest
testJdbcPassword CHANGEME

If it works, you will see this line in the build output:

Tests are running with a database

else

Tests are running without a database

There are also local tests contained in the project, so you are still able to test most parts without specifying a PostgreSQL server. And the test console output will show if tests were run with or without a database.

About

PostGIS Java bindings

Topics

databasegeometryjavajava-bindingsjdbcjdk21postgispostgresql

Resources

Readme
LGPL-3.0 license
Activity

Stars

23 stars

Watchers

1 watching

Forks

3 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.