support for alternate map projections in mapjfx

The latest versions of mapjfx – 1.22.0 and 2.3.0 – have the possibility to have different projections for the map used in OpenLayers. The possible projections are:

  • Web Mercator (EPSG:3857); this is used if no other projection is specified and is the projection that was hardcoded up to now
  • WGS84 (EPSG:4326); this can be set when initializing the MapView object.

Check the mapjfx-demo description and the source code. The actual versions are available in maven central:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.22.0</version>
  </dependency>
  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>2.3.0</version>
  </dependency>

The two screenshots show the different map projections:

EPSG:4326

EPSG:3857

mapjfx now supports filled polygons

I just released mapjfx versions 1.21.0 and 2.2.0, they will be available in maven central:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.21.0</version>
  </dependency>
  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>2.2.0</version>
  </dependency>

Now it is possible to close CoordinateLines to polygons with a fill color:


Comments and contributions welcome.

mapjfx 2.1.1 and 1.20.1 using OpenLayers 5.3.0

I just released mapjfx versions 1.20.1 and 2.1.1, they will be available in maven central:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.20.1</version>
  </dependency>
  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>2.1.1</version>
  </dependency>

mapjfx now uses OpenLayers version 5.3.0.

Version 1.20.1 is built using OracleJDK8, whereas version 2.1.1 is built with OpenJDK11.

mapjfx 2.1.0 and 1.20.0 released, now built with JDK8 and JDK11

The new versions are 1.20.0 and 2.1.o, available in maven central:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.20.0</version>
  </dependency>
  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>2.1.0</version>
  </dependency>

Version 1.20.0 is built using OracleJDK8, whereas version 2.1.0 is built with OpenJDK11.

mapjfx 1.19.0 adds support for XYZ map sources

I released mapjfx version 1.19.0 it can be found at maven central, the artifact coordinates are:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.19.0</version>
  </dependency>

The source is available at GitHub.

This version adds support for XYZ map sources. The code was contributed by Erik Jaehne, thanks a lot for that.

mapjfx 1.18.0 has MAP_POINTER_MOVED event and uses OfflineCache singleton

I just released mapjfx version 1.18.0 it should be found shortly at maven central, the artifact coordinates are:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.18.0</version>
  </dependency>

The source is available at GitHub.

The first change in this verison is that the OfflineCache instance now is a Singleton and shared between all instances of MapView objects in an application. This allows for more than one MapView to use the offline cache mechanisms.

The other change is that now for a pointer (mouse) move detetction when the pointer is over the map, an appropriate event is generated.

Java regular expression matching with some parts being case insensitive

I just came upon the possibility that in Java it is possible within regular expressions to turn case sensitivity on and off. This is no new feature, it has been there since Java 1.4, but I never saw it before and thought it might be worth a post.

So let’s assume I want to have a regular expression which matches the three words “goodbye bLuE SKIES” – the first in lowercase, the second mixed and the last in uppercase. This can be done with the following regular expression:

goodbye (?i)blue(?-i) SKIES

The “(?i)” switches the pattern to case insensitive, and “(?-i)” switches it back to case sensitive.

The java API doc https://docs.oracle.com/javase/8/docs/api/ lists these as “Special constructs”. And although they use the parenthesis, thesi constructs do not capture anything in a group.

mapjfx version 1.17.0 reporting the map’s extent and using OpenLayers 4.6.5

I just released mapjfx version 1.17.0 it should be found shortly at maven central, the artifact coordinates are:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.17.0</version>
  </dependency>

The source is available at GitHub.

mapjfx now ow uses OpenLayers 4.6.5.

As a new feature, the MapView object now emits events whenever the extent of the map changes. This happens when the center of the map is changed, the zoom value is changed or when the map’s window size is changed. The event can be processed like this:

// add an event handler for extent changes and display them in the status label
mapView.addEventHandler(MapViewEvent.MAP_BOUNDING_EXTENT, event -> {
  event.consume();
  labelExtent.setText(event.getExtent().toString());
});