mapjfx

Note March 2022: I started mapjfx in December 2014 as a side project. In these seven years I learned quite some things by developing and maintaining it. But my focus has shifted and I don’t have the time anymore to take care of this project. So from March 2022 on, mapjfx will be out of maintenance. I’ll do no further development on it.

mapjfx is a project that offers a JavaFX8 component displaying a map. The component is based on the JavaFX WebView and on the OpenLayers library. All interaction of the program with the map is done by using Java calls and JavaFX properties; the user does not need to do any Javascript or HTML coding.

Java versions

Originally the project was written for OracleJDK8, as JavaFX 8 is contained in this version without the need to install or configure anything special.
The branch 1.x is built using OracleJDK8. This branch is not actively developed anymore. Starting in November 2018, the main branch 2.x is built against OpenJDK11 using OpenJFX as a dependency. This is not actively developed after the LTS release of Java 17.
From March 2021 on, branch 3.x is the main branch and is built using OpenJDK 17.

Note: versions 2.9 to 2.12 were built using Java 12 and 13. With 2.13. I switched back to Java 11 (LTS), as SceneBuilder is only available for the LTS version of Java!

Sources, releases and features

The sourcecode for the project is available on GitHub, comments and collaboration welcome.

Some information about the problem loading map tiles: </2018/02/mapjfx-problems/>

The actual version 3.1.0 is released to maven central, see the blog posts, the demo showing the possibilities and code samples is found here.

mapjfx at this time has the following features (listed in chronological order as they were applied):

  • display of a map with given center
  • resize the map together with the JavaFX component
  • provides map center info as JavaFX property
  • provides map zoom info as JavaFX property
  • optional animate center and zoom changes
  • SceneBuilder compatibility
  • display of a map so that a set of points is visible
  • change between different map sources
  • showing markers at different coordinates of the map
  • use custom icons for markers
  • sow/hide/move the markers
  • provide feedback to the Java app for user interaction like clicking in the map
  • display of lines/tracks
  • Map types
    • Open StreetMap
    • Bing Maps Road (with API Key) – 4 variants
    • Bing Maps Aerial (with API Key) – 2 variants
    • custom WMS servers
    • XYZ map sources (contribution by Erik Jaehne)
  • map labels
  • ability to cache map data for offline use
  • custom events for clicking and right-clicking in map, clicking on markers and labels
  • events for rightclick, doubleclick, mousedown, mouseup, mouseenetered and mousexited on labels and markers
  • when cmd-dragging (Mac OSX) or ctrl-dragging (Windows) a rectangle is spanned in the map which on release triggers an event that contains the selected extent.
  • when using the offline cache, it is possible to define regex patterns for urls not to be cached.
  • coordinates lines can be closed to polygons with a filling color
  • the base projection of the map can be set to WebMercator (EPSG 3857) or to WGS84 (EPSG 4326)
  • markers and labels can be rotated
  • circles can be added to the map (contribution by Hanwoo Kim)

Offline Cache and Java version > 8

In order to implement the offline caching mechanism it is necessary to call a private method of the java.net.Url class which must be made accessible by reflection. As the Java modules system does not allow this anymore, it is necessary to start the application with the argument --add-opens java.base/java.net=com.sothawo.mapjfx.

3D support

As per Michael Anderl’s suggestion from November 2015 I evaluated the integration of Cesium to support 3D rendering. This looked gorgeous in Chrome with a terrain map, but alas I cannot integrate it into mapjfx because the WebView Component from JavaFX does not support WebGL. Checking Bugtrackers and forums on OpenJFX it seems that there is no planned support yet.

One solution could be to change the rendering engine to JxBrowser, but as mapjfx should run on the standard JDK without any modifications, this seems not to be a solution.

Tested systems

Version 3.1.0 of the application is tested with the following configurations:

  • OpenJDK 17 (17+35-2724) on macOS 10.15.7
  • OpenJDK 17 (17+35-2724) on MS Windows 10 20H2, build 19042.804

Version 3.0.1 of the application is tested with the following configurations:

  • AdoptOpenJDK 15.0.2 on macOS 10.15.7
  • AdoptOpenJDK 15.0.2 on MS Windows 10 20H2, build 19042.804

Version 2.15.3 of the application is tested with the following configurations:

  • AdoptOpenJDK 11.0.10 on macOS 10.15.7
  • AdoptOpenJDK 11.0.10 on MS Windows 10 20H2, build 19042.804

Version 1.33.3 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_271 on macOS 10.15.7
  • Oracle JDK 1.8.0_241 on MS Windows 10 20H2, build 19042.804

See previous versions

  • AdoptOpenJDK 11.0.6 on macOS 10.15.6
  • AdoptOpenJDK 11.0.6 on MS Windows 10, build 1909

Version 1.33.2 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_251 on macOS 10.15.6
  • Oracle JDK 1.8.0_241 on MS Windows 10, build 1909

Version 2.15.1 of the application is tested with the following configurations:

  • AdoptOpenJDK 11.0.6 on macOS 10.15.6
  • AdoptOpenJDK 11.0.6 on MS Windows 10, build 1909

Version 1.33.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_251 on macOS 10.15.6
  • Oracle JDK 1.8.0_241 on MS Windows 10, build 1909

Version 2.15.0 of the application is tested with the following configurations:

  • AdoptOpenJDK 11.0.6 on macOS 10.15.6
  • AdoptOpenJDK 11.0.6 on MS Windows 10, build 1909

Version 1.33.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_251 on macOS 10.15.6
  • Oracle JDK 1.8.0_241 on MS Windows 10, build 1909

Version 2.14.0 of the application is tested with the following configurations:

  • AdoptOpenJDK 11.0.6 on macOS 10.15.2
  • AdoptOpenJDK 11.0.6 on MS Windows 10, build 1903

Version 1.32.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_241 on macOS 10.15.2
  • Oracle JDK 1.8.0_241 on MS Windows 10, build 1903

Version 2.13.1 of the application is tested with the following configurations:

  • AdoptOpenJDK 11.0.6 on macOS 10.15.2
  • AdoptOpenJDK 11.0.6 on MS Windows 10, build 1903

Version 1.31.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_241 on macOS 10.15.2
  • Oracle JDK 1.8.0_241 on MS Windows 10, build 1903

Version 2.13.0 of the application is tested with the following configurations:

  • OpenJDK 11.0.2 on macOS 10.15.2
  • OpenJDK 11.02 on MS Windows 10, build 1903

Version 2.12.0 of the application is tested with the following configurations:

  • OpenJDK 13 on macOS 10.15.2
  • OpenJDK 13 on MS Windows 10, build 1903

Version 1.31.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_241 on macOS 10.15.2
  • Oracle JDK 1.8.0_241 on MS Windows 10, build 1903

Version 2.11.0 of the application is tested with the following configurations:

  • OpenJDK 12.0.2 on macOS 10.14.6
  • OpenJDK 12.0.2 on MS Windows 10, build 1903

Version 1.30.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_221 on macOS 10.14.6
  • Oracle JDK 1.8.0_221 on MS Windows 10, build 1903

Version 2.9.0 of the application is tested with the following configurations:

  • OpenJDK 12.0.2 on macOS 10.14.6
  • OpenJDK 12.0.2 on MS Windows 10, build 1903

Version 1.28.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_221 on macOS 10.14.6
  • Oracle JDK 1.8.0_221 on MS Windows 10, build 1903

Version 2.8.0 of the application is tested with the following configurations:

  • OpenJDK 11.0.2 on macOS 10.14.6
  • OpenJDK 11.0.2 on MS Windows 10, build 1803

Version 1.27.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_212 on macOS 10.14.6
  • Oracle JDK 1.8.0_202 on MS Windows 10, build 1803

Version 2.7.3 of the application is tested with the following configurations:

  • OpenJDK 11.0.2 on macOS 10.14.6
  • OpenJDK 11.0.2 on MS Windows 10, build 1803

Version 1.26.3 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_212 on macOS 10.14.6
  • Oracle JDK 1.8.0_202 on MS Windows 10, build 1803

Version 2.5.0 of the application is tested with the following configurations:

  • OpenJDK 11.0.2 on macOS 10.14.2
  • OpenJDK 11.0.2 on MS Windows 10, build 1803

Version 1.24.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_202 on macOS 10.14.2
  • Oracle JDK 1.8.0_202 on MS Windows 10, build 1803

Version 2.4.0 of the application is tested with the following configurations:

  • OpenJDK 11.0.1 on macOS 10.14.2
  • OpenJDK 11.0.1 on MS Windows 10, build 1803

Version 1.23.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_192 on macOS 10.14.1
  • Oracle JDK 1.8.0_192 on MS Windows 10, build 1803

Version 2.3.0 of the application is tested with the following configurations:

  • OpenJDK 11.0.1 on macOS 10.14.1
  • OpenJDK 11.0.1 on MS Windows 10, build 1803

Version 1.22.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_192 on macOS 10.14.1
  • Oracle JDK 1.8.0_192 on MS Windows 10, build 1803

Version 2.2.0 of the application is tested with the following configurations:

  • OpenJDK 11.0.1 on macOS 10.14.1
  • OpenJDK 11.0.1 on MS Windows 10, build 1803

Version 1.21.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_192 on macOS 10.14.1
  • Oracle JDK 1.8.0_192 on MS Windows 10, build 1803

Version 2.1.1 of the application is tested with the following configurations:

  • OpenJDK 11.0.1 on macOS 10.14.1
  • OpenJDK 11.0.1 on MS Windows 10, build 1803

Version 1.20.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_192 on macOS 10.14.1
  • Oracle JDK 1.8.0_192 on MS Windows 10, build 1803

Version 2.1.0 of the application is tested with the following configurations:

  • OpenJDK 11.0.1 on macOS 10.14.1
  • OpenJDK 11.0.1 on MS Windows 10, build 1803

Version 1.20.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_192 on macOS 10.14.1
  • Oracle JDK 1.8.0_192 on MS Windows 10, build 1803

Version 1.19.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_181 on macOS 10.14
  • Oracle JDK 1.8.0_172 on MS Windows 10, build 1607

Version 1.16.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_162 on macOS 10.13.3
  • Oracle JDK 1.8.0_162 on MS Windows 10, build 1607

Version 1.15.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_162 on macOS 10.13.3
  • Oracle JDK 1.8.0_162 on MS Windows 10, build 1607

Version 1.14.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_152 on Mac OSX 10.12.6
  • Oracle JDK 1.8.0_152 on MS Windows 10, build 1607

Version 1.13.2 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_144 on Mac OSX 10.12.6
  • Oracle JDK 1.8.0_144 on MS Windows 10, build 1607

Version 1.13.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_131 on Mac OSX 10.12.5
  • Oracle JDK 1.8.0_131 on MS Windows 10, build 1607

Version 1.13.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_131 on Mac OSX 10.12.3
  • Oracle JDK 1.8.0_131 on MS Windows 10, build 1607

Version 1.11.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_121 on Mac OSX 10.12.3
  • Oracle JDK 1.8.0_121 on MS Windows 10, build 1607

Version 1.10.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_121 on Mac OSX 10.12.3
  • Oracle JDK 1.8.0_121 on MS Windows 10, build 1607

Version 1.10.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_121 on Mac OSX 10.12.3
  • Oracle JDK 1.8.0_121 on MS Windows 10, build 1607

Version 1.9.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_121 on Mac OSX 10.12.3
  • Oracle JDK 1.8.0_121 on MS Windows 10, build 1607

Version 1.8.2 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_112 on Mac OSX 10.11.6
  • Oracle JDK 1.8.0_112 on MS Windows 10, build 1607

Version 1.8.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_102 on Mac OSX 10.11.6
  • Oracle JDK 1.8.0_102 on MS Windows 10, build 1511

Version 1.7.3 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_92 on Mac OSX 10.11.5
  • Oracle JDK 1.8.0_92 on MS Windows 10

Version 1.7.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_77 on Mac OSX 10.11.4
  • Oracle JDK 1.8.0_77 on MS Windows 10

Version 1.7.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_77 on Mac OSX 10.11.4
  • Oracle JDK 1.8.0_77 on MS Windows 10

Version 1.6.2 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_74 on Mac OSX 10.11.3
  • Oracle JDK 1.8.0_74 on MS Windows 10

Version 1.6.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_74 on Mac OSX 10.11.2
  • Oracle JDK 1.8.0_74 on MS Windows 10

Version 1.6.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_66 on Mac OSX 10.11.2
  • Oracle JDK 1.8.0_65 on MS Windows 10.1
  • Oracle JDK 1.8.0_65 on MS Windows 8.1

Version 1.5.1 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_65 on Mac OSX 10.11.1
  • Oracle JDK 1.8.0_65 on MS Windows 10.1
  • Oracle JDK 1.8.0_65 on MS Windows 8.1

Version 1.5.0 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_65 on Mac OSX 10.11.1
  • Oracle JDK 1.8.0_65 on MS Windows 10.1
  • Oracle JDK 1.8.0_65 on MS Windows 8.1

Version 1.4.9 of the application is tested with the following configurations:

  • Oracle JDK 1.8.0_65 on Mac OSX 10.11.1
  • Oracle JDK 1.8.0_65 on MS Windows 10.1
  • Oracle JDK 1.8.0_65 on MS Windows 8.1