Jul 30, 2015 Replies: 106 The latest version of Google Maps isn't compatible with JavaFX WebView. Don't use this library. Alternative solution: https://www.b4x.com/android/forum/threads/jsd_openmaps.166066/#content This library is similar to B4A and B4i GoogleMaps libraries. It is based on this open source project: https://github.com/dlsc-software-consulting-gmbh/GMapsFX/ (Apache 2 license). Under the hood it uses JavaFX WebView with GoogleMaps JavaScript API V3. Using the map is quite simple. You need to initialize GoogleMap and then wait for the Ready event. GoogleMap.AsPane returns the pane that holds the map. You should add this pane to the nodes tree. Once the ready event is fired you can add markers or change the position. Updates: V2.01 - Sets the Google Maps Javascript SDK version to 3.56. There is currently an issue with JavaFX and Google Maps v3.57. A big thank you to @Star-Dust for helping with solving this issue! V2.00 - Depends on OpenJDK 19. Previous versions will not work. 1. OpenJDK 19.0.2 + OpenJFX 17.0.6: https://www.b4x.com/b4j/files/jdk-19.0.2.7z 2. Add to main module: Code: #PackagerProperty: IncludedModules = javafx.web #PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx; exports com.lynden.gmapsfx.javascript; exports com.lynden.gmapsfx.javascript.event; #PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.javascript.object; exports com.lynden.gmapsfx.service.directions; exports com.lynden.gmapsfx.service.elevation; #PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.service.geocoding; exports com.lynden.gmapsfx.shapes; exports com.lynden.gmapsfx.zoom; 3. Add reference to jOkHttpUtils2. Tip: to fix logging encoding issues with Java 19+, add this: Code: #VirtualMachineArgs: -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 #PackagerProperty: VMArgs = -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 The standalone package will not work without steps 2 and 3. Attachments GoogleMapExample.zip GoogleMapExample.zip 2.8 KB · Views: 1,055 jGoogleMaps.zip jGoogleMaps.zip 199.3 KB · Views: 875 Last edited: May 22, 2025 Click to expand...
The latest version of Google Maps isn't compatible with JavaFX WebView. Don't use this library. Alternative solution: https://www.b4x.com/android/forum/threads/jsd_openmaps.166066/#content This library is similar to B4A and B4i GoogleMaps libraries. It is based on this open source project: https://github.com/dlsc-software-consulting-gmbh/GMapsFX/ (Apache 2 license). Under the hood it uses JavaFX WebView with GoogleMaps JavaScript API V3. Using the map is quite simple. You need to initialize GoogleMap and then wait for the Ready event. GoogleMap.AsPane returns the pane that holds the map. You should add this pane to the nodes tree. Once the ready event is fired you can add markers or change the position. Updates: V2.01 - Sets the Google Maps Javascript SDK version to 3.56. There is currently an issue with JavaFX and Google Maps v3.57. A big thank you to @Star-Dust for helping with solving this issue! V2.00 - Depends on OpenJDK 19. Previous versions will not work. 1. OpenJDK 19.0.2 + OpenJFX 17.0.6: https://www.b4x.com/b4j/files/jdk-19.0.2.7z 2. Add to main module: Code: #PackagerProperty: IncludedModules = javafx.web #PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx; exports com.lynden.gmapsfx.javascript; exports com.lynden.gmapsfx.javascript.event; #PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.javascript.object; exports com.lynden.gmapsfx.service.directions; exports com.lynden.gmapsfx.service.elevation; #PackagerProperty: AdditionalModuleInfoString = exports com.lynden.gmapsfx.service.geocoding; exports com.lynden.gmapsfx.shapes; exports com.lynden.gmapsfx.zoom; 3. Add reference to jOkHttpUtils2. Tip: to fix logging encoding issues with Java 19+, add this: Code: #VirtualMachineArgs: -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 #PackagerProperty: VMArgs = -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 The standalone package will not work without steps 2 and 3.
rbghongade Well-Known Member Licensed User Longtime User Nov 11, 2016 #61 Dear friends, Is it possible to display the marker label continuously? Say I want to display the temperature associated with a marker which gets updated on new data. Currently the marker label is displayed only when we have a mouse over action. Got the solution: As indicated in previous posts by Erel and others, I used a sub called "ShowInfoWindow". But now the new label gets created on top of the old one , instead of replacing it. Any suggestion to resolve this problem? Last edited: Nov 12, 2016
Dear friends, Is it possible to display the marker label continuously? Say I want to display the temperature associated with a marker which gets updated on new data. Currently the marker label is displayed only when we have a mouse over action. Got the solution: As indicated in previous posts by Erel and others, I used a sub called "ShowInfoWindow". But now the new label gets created on top of the old one , instead of replacing it. Any suggestion to resolve this problem?
Erel B4X founder Staff member Licensed User Longtime User Nov 13, 2016 #62 Please start a new thread for this in the questions forum and also post a link to the post which describes ShowInfoWindow.
Please start a new thread for this in the questions forum and also post a link to the post which describes ShowInfoWindow.
Informatix Expert Licensed User Longtime User Nov 15, 2016 #63 Here's the version 1.26 of jGoogleMaps: - I fixed the bug of the event name (upper or mixed case is now allowed); - I added the LatLongBounds class; - I added Bounds, FitBounds, PanToBounds, IsReady, RemovePolyline, RemovePolygon, Zoom. Attachments jGoogleMaps_1_26.zip jGoogleMaps_1_26.zip 248 KB · Views: 1,106
Here's the version 1.26 of jGoogleMaps: - I fixed the bug of the event name (upper or mixed case is now allowed); - I added the LatLongBounds class; - I added Bounds, FitBounds, PanToBounds, IsReady, RemovePolyline, RemovePolygon, Zoom.
R rboeck Well-Known Member Licensed User Longtime User Nov 15, 2016 #64 Do you have some information or examples how to use the new possibilities. I have tried to use googlemapsextras to use LatLngBoundsBuilder, but i think it is only useable with android. So we have to find out the borders by an own subroutine or are there any other possibities?
Do you have some information or examples how to use the new possibilities. I have tried to use googlemapsextras to use LatLngBoundsBuilder, but i think it is only useable with android. So we have to find out the borders by an own subroutine or are there any other possibities?
Informatix Expert Licensed User Longtime User Nov 15, 2016 #65 rboeck said: Do you have some information or examples how to use the new possibilities. Click to expand... All functions are documented. Example for FitBounds: Code: Dim NE, SW As LatLng NE.Initialize(MaxLatitude, MaxLongitude) SW.Initialize(MinLatitude, MinLongitude) MyBounds.Initialize(NE, SW) GMap.FitBounds(MyBounds) rboeck said: I have tried to use googlemapsextras to use LatLngBoundsBuilder, but i think it is only useable with android. So we have to find out the borders by an own subroutine or are there any other possibities? Click to expand... I didn't try GoogleMapExtras. What do you mean by "find out the borders"?
rboeck said: Do you have some information or examples how to use the new possibilities. Click to expand... All functions are documented. Example for FitBounds: Code: Dim NE, SW As LatLng NE.Initialize(MaxLatitude, MaxLongitude) SW.Initialize(MinLatitude, MinLongitude) MyBounds.Initialize(NE, SW) GMap.FitBounds(MyBounds) rboeck said: I have tried to use googlemapsextras to use LatLngBoundsBuilder, but i think it is only useable with android. So we have to find out the borders by an own subroutine or are there any other possibities? Click to expand... I didn't try GoogleMapExtras. What do you mean by "find out the borders"?
R rboeck Well-Known Member Licensed User Longtime User Nov 15, 2016 #66 In GoogleMapsExtras exists a class called LatLngBoundsBuilder, which is used to calculate the optimal size from a list of markers; then you can use AnimatetoBounds to show the optimal zoomfactor.
In GoogleMapsExtras exists a class called LatLngBoundsBuilder, which is used to calculate the optimal size from a list of markers; then you can use AnimatetoBounds to show the optimal zoomfactor.
Informatix Expert Licensed User Longtime User Nov 16, 2016 #67 rboeck said: In GoogleMapsExtras exists a class called LatLngBoundsBuilder, which is used to calculate the optimal size from a list of markers; then you can use AnimatetoBounds to show the optimal zoomfactor. Click to expand... There is no AnimateToBounds in the Google Maps API. Anyway, you can use the code in post #68 to do something similar. With a simple loop, you can set the expected params: Code: Dim MinLatitude as Double = 99 'Latitude cannot go higher than 90 Dim MaxLatitude as Double = -99 For Each Marker As LatLon in MyListOfMarkers If Marker.Latitude < MinLatitude then MinLatitude = Marker.Latitude If Marker.Latitude > MaxLatitude then MaxLatitude = Marker.Latitude ...
rboeck said: In GoogleMapsExtras exists a class called LatLngBoundsBuilder, which is used to calculate the optimal size from a list of markers; then you can use AnimatetoBounds to show the optimal zoomfactor. Click to expand... There is no AnimateToBounds in the Google Maps API. Anyway, you can use the code in post #68 to do something similar. With a simple loop, you can set the expected params: Code: Dim MinLatitude as Double = 99 'Latitude cannot go higher than 90 Dim MaxLatitude as Double = -99 For Each Marker As LatLon in MyListOfMarkers If Marker.Latitude < MinLatitude then MinLatitude = Marker.Latitude If Marker.Latitude > MaxLatitude then MaxLatitude = Marker.Latitude ...
Informatix Expert Licensed User Longtime User Dec 19, 2016 #68 Here's the version 1.27 of jGoogleMaps: - I added the ScrollWheel option to set whether the scroll wheel can zoom in/out; - I added MoveCamera2(NewPosition As LatLng); - I added the MapCircle class; - I added the AddCircle and RemoveCircle functions; - I renamed Polygon and Polyline to MapPolygon and MapPolyline to avoid naming issues with other libs; - I added the RemoveMarker function. Attachments jGoogleMaps_1_27.zip jGoogleMaps_1_27.zip 251 KB · Views: 939
Here's the version 1.27 of jGoogleMaps: - I added the ScrollWheel option to set whether the scroll wheel can zoom in/out; - I added MoveCamera2(NewPosition As LatLng); - I added the MapCircle class; - I added the AddCircle and RemoveCircle functions; - I renamed Polygon and Polyline to MapPolygon and MapPolyline to avoid naming issues with other libs; - I added the RemoveMarker function.
Informatix Expert Licensed User Longtime User Dec 20, 2016 #69 Here's the version 1.28 of jGoogleMaps: - Markers have a label now and their position can be read; - I added the AddMarker3 function, which allows to specify an origin and an anchor position for the marker icon; - I added the MapInfoWindow class; - I added the AddInfoWindow, AddInfoWindow2, AddInfoWindowToMarker, and CloseInfoWindow functions; - I added the CircleClick and PolygonClick events; - I reduced the JAR size by removing unused files. This version should cover most needs, so I don't think there will be another one from me before long. Note to Erel: I made several changes to the original source code to add the missing functions/features, so be careful if you update this source code. Attachments jGoogleMaps_1_28.zip jGoogleMaps_1_28.zip 235.7 KB · Views: 1,055
Here's the version 1.28 of jGoogleMaps: - Markers have a label now and their position can be read; - I added the AddMarker3 function, which allows to specify an origin and an anchor position for the marker icon; - I added the MapInfoWindow class; - I added the AddInfoWindow, AddInfoWindow2, AddInfoWindowToMarker, and CloseInfoWindow functions; - I added the CircleClick and PolygonClick events; - I reduced the JAR size by removing unused files. This version should cover most needs, so I don't think there will be another one from me before long. Note to Erel: I made several changes to the original source code to add the missing functions/features, so be careful if you update this source code.
Erel B4X founder Staff member Licensed User Longtime User Dec 21, 2016 #70 I've added a link to post #72 from the first one. It is better if you always upload the latest version to this post.
I've added a link to post #72 from the first one. It is better if you always upload the latest version to this post.
JTmartins Active Member Licensed User Longtime User Jan 24, 2017 #71 Hi, Just tryed to use this library. When I run from the IDE in release mode it works ok. However, when I run the jar file that is generated in the objects folder, I cant see any map. It just shows a blank window. No proxy or anything similar. Just a normal computer connected to the Internet. What can cause this ? Many thanks ****************** SOLVED. Just had to move a few lines to other sub in my test app. However is weird. Works when launched from the IDE, and was not working when launched directly. ****************** Last edited: Jan 24, 2017
Hi, Just tryed to use this library. When I run from the IDE in release mode it works ok. However, when I run the jar file that is generated in the objects folder, I cant see any map. It just shows a blank window. No proxy or anything similar. Just a normal computer connected to the Internet. What can cause this ? Many thanks ****************** SOLVED. Just had to move a few lines to other sub in my test app. However is weird. Works when launched from the IDE, and was not working when launched directly. ******************
R rboeck Well-Known Member Licensed User Longtime User Jan 30, 2017 #72 Two days ago i bought my first iMac for testing. Before i tried an b4j app on windows and linux and now on an freshly installed iMac with El Capitan. My problem, only on this machine: the font, which is used inside google maps is ? All text inside InfoWindows is unreadable, also the text, when you touch something inside google maps. Maybe its only a problem of this one machine, the i forget it; but if future customers have the same problem? Also in webview i get the same strange results. I have looked through the fonts listing and didn't found anything strange. In webview maybe we could change the standard fonts with css.files, but in google maps i have no idea, where the problem comes from.
Two days ago i bought my first iMac for testing. Before i tried an b4j app on windows and linux and now on an freshly installed iMac with El Capitan. My problem, only on this machine: the font, which is used inside google maps is ? All text inside InfoWindows is unreadable, also the text, when you touch something inside google maps. Maybe its only a problem of this one machine, the i forget it; but if future customers have the same problem? Also in webview i get the same strange results. I have looked through the fonts listing and didn't found anything strange. In webview maybe we could change the standard fonts with css.files, but in google maps i have no idea, where the problem comes from.
Erel B4X founder Staff member Licensed User Longtime User Jan 31, 2017 #73 I see it too. Can you post the html that you use to reproduce it with WebView?
R rboeck Well-Known Member Licensed User Longtime User Jan 31, 2017 #74 Its easiert to post the url: http://www.firmenabc.at/result.aspx...&inTitleOnly=false&l=&si=0&iid=&sid=&did=&cc= Attachments Screenshot 2017-01-31 08.25.57.png 50.4 KB · Views: 1,023
Its easiert to post the url: http://www.firmenabc.at/result.aspx...&inTitleOnly=false&l=&si=0&iid=&sid=&did=&cc=
Erel B4X founder Staff member Licensed User Longtime User Jan 31, 2017 #75 It looks like a bug in the native WebView on Mac. Might be related to OS X 10.11 changes. I've tested GMapFX example to make sure that it is not an error caused by B4J and the result is the same. The info window text as well as in other fields is gibberish.
It looks like a bug in the native WebView on Mac. Might be related to OS X 10.11 changes. I've tested GMapFX example to make sure that it is not an error caused by B4J and the result is the same. The info window text as well as in other fields is gibberish.
R rboeck Well-Known Member Licensed User Longtime User Mar 19, 2017 #76 I have a problem with version 1.50; all LatLng variables are getting red, it seems, that there was something lost in the new library. I went back to the last version and my program compiles ok.
I have a problem with version 1.50; all LatLng variables are getting red, it seems, that there was something lost in the new library. I went back to the last version and my program compiles ok.
Informatix Expert Licensed User Longtime User Mar 19, 2017 #77 rboeck said: I have a problem with version 1.50; all LatLng variables are getting red, it seems, that there was something lost in the new library. I went back to the last version and my program compiles ok. Click to expand... I confirm there's a lot of (my) code removed in the last version.
rboeck said: I have a problem with version 1.50; all LatLng variables are getting red, it seems, that there was something lost in the new library. I went back to the last version and my program compiles ok. Click to expand... I confirm there's a lot of (my) code removed in the last version.
Erel B4X founder Staff member Licensed User Longtime User Mar 20, 2017 #78 V1.55 is released. It includes most of the changes from Informatix version. It doesn't include methods that depend on changes to GMapFX code.
V1.55 is released. It includes most of the changes from Informatix version. It doesn't include methods that depend on changes to GMapFX code.
R rboeck Well-Known Member Licensed User Longtime User Mar 20, 2017 #79 Sorry for the problems; now i get Code: Error description: Property: Position is writeonly. Occurred on line: 325 Dim Point As LatLng = K(i).M.Position it worked with all previous versions.
Sorry for the problems; now i get Code: Error description: Property: Position is writeonly. Occurred on line: 325 Dim Point As LatLng = K(i).M.Position it worked with all previous versions.
Erel B4X founder Staff member Licensed User Longtime User Mar 20, 2017 #80 It is not possible to get the position. Informatix will correct me if I'm wrong, but I assume that he modified GMapFX code to implement the getter. As a workaround you can use a Map that maps between markers and any additional information you need to store.
It is not possible to get the position. Informatix will correct me if I'm wrong, but I assume that he modified GMapFX code to implement the getter. As a workaround you can use a Map that maps between markers and any additional information you need to store.