mapjfx problems

Since some time now users have reported that mapjfx does not properly display the maps. I wrote a small JavaFX application which is just a WebView and a textfield to edit an URL. This application as well shows buggy behaviour in not loading the map tiles properly. This is the plain JavaFX WebView, with no adddition, custom Javascript code or things that mapjfx does:

Other browsers have no problem with these pages. I do not know if this is some bug in WebView – or more probably in WebKit that’s used internally, but there is nothing I have found up to now that I could do to work around.

This map-tile loading problem only seems to happen with OpenStreetMap servers, I have up to now found no problems when using Bing Maps.

Edit 29.03.2018: At the moment I do not see these issues when running with Oracle JDK 10, feedback about this is very welcome!

21 thoughts on “mapjfx problems

    • Hi Ben,
      this is not necessary, the 1.x current version has the identical functionality as the 2.x branch, the only difference is the used Java version

  1. Hi,
    Mapjfx is excelente job!
    I have one problem, righclick on the map automatically shows the web view scroll bar, then map is rescaling (makes markers’ coordinates incorrect), and “reaload page” context menu appears. Is any way to disable the righclickevent or catch them?
    Method “mapView.addEventFilter(MapViewEvent.MAP_RIGHTCLICKED, event -> {));” doesnt work.

    Best regards

    • Hi Chris,

      this is a known problem with the WebView browser at the moment. I have code in the Javascript that should prevent the standard context menu, and this used to work. I noticed this behaviour in April (see this issue)

    • Edit: I found the error I introduced in the code (need to blame myself, not WebView); I will release a fixed version today or tomorrow

  2. Hello, i have the same problem… with JavaFX doesn’t show anything… i have investigate the html code of map view.html and other code from open layers, and i can run the map view.html in safari, chrome, firefox and opera, but not with JavaFX webview. I think the problem is produced by javascript cross domain… i’ve tried to activate the usage of javascript cross domain but doesn’t run correctly… 🙁

    if you need the map view.html file, send me email 🙂


    • I have just again tested the actual mapjfx lib with the demo program, both with Java 8 and Java 11. It works, with OSM and the other map types as well. The problem described on this page sometimes happens when some tiles are not loaded from OSM.

      mapjfx has no problems in so far that nothing at all is shown, if there were a basic problem with the Javascript of mapjfx and the JavaFX WebView, this would happen regardless of the selected map type.

      Which view.html file are you talking about?

      • First of all: Thank you for this very useful component. I faced the same type of problems regardless if I used OSM or bing map. I run tests, also with mapjxf demo program, on different machines and java versions from 11 – 14. In my examination the problems appeared deterministically when setting up high screen resolutions (more than “1090p”) on the machines, also when using different OS versions. Every time I configured “4K” or similiar the bug appears, even if reduced the max size of the view in the code to a much smaller value. After switching back to “1090p” or below the bug disappears and everthing works fine – with OSM and bing maps. I guess there is some low level bug in the OL implementation or, as you supposed, in the Webkit. I hope that helps to solve this problem. I like your component very much, great work!

          • Tiles are only shown in a rectangle in the upper left corner of the view and the tiles are loaded slowly. The second problems varies from time to time but the first appears every time I used high screen resolution. I noticed, that also the transformation of the coordinates (mapping between screen and map coordinates) within the visible part (in the upper left corner) of the map wents wrong.

            • The different effects of the resolution are hard for me to reproduce, my iMac has a max of 2560×1440 and sometimes some tiles are loading slower, but it’s not that the top left loads, and others not.
              In the _src/main/test_ directory of the 2.x branch I have added a minimal browser app with which I took the screen shot from the top of this post, can you start this (using the Launcher class), then go to (you need the full address and return is not working, only the go button) and check if the examples are working on your machine?

              What is this you wrote about the wrong coordinate transformation in the visible part? (although I don’t know if this is related)

              • I will check the openlayers website with the “minimal browser app” within the next days.

                About the coordinate transformation problem: When I added markers (using geo coordinates) to the “incomplete map” they are displayed at wrong positions. Additionally when I checked the result of the “map clicked event” it turns out that wrong coordinates are returned, which don’t releates correctly to the clicked position in the displayed map. In both cases there were significant deviations from the correct positions. I’m not sure if these problems are related to the use of the zoom feature on an incomplete map. I have to examine it in more detail.

              • I can confirm that the descripted problems happen also with the plain javafx browser application, when using high screen resolution (more than 1080p). So, it seems that it’s really some kind of incompatibility between the standard javafx browser engine and the open layers code when using high screen resolutions on certain platforms.

                • Thank you very much for testing this. I’m not quite sure, how to address this further. I might be able to test this on a different monitor, once I get back to work in the office and not from home.

    • Thank you for the hint, but this is a different problem, where the map does not load at all. We have the problem that the part of the times tiles are not loaded when using OSM, but with other map providers it works; So the integration of OL and OSM works

      kind regards Peter

  3. Hi,

    I have the same problem with JDK 10.

    I am basically initializing the MapView with type OSM and set center and zoom after initialization like its done in your example.

    It only renders map in the top left corner.

    Kind regards,

    java –version
    java 10.0.2 2018-07-17
    Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
    Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

    javac –version
    javac 10.0.2

Leave a Reply

Your comment will only be visible after moderation. Your email address will not be published.