B4J Library jGoogleMaps library

Not open for further replies.
This library is similar to B4A and B4i GoogleMaps libraries.


It is based on this open source project: http://rterp.github.io/GMapsFX/
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.

v1.10 - New AddPolyline method.

Dim l1, l2, l3 As LatLng
l1.Initialize(20, 20)
l2.Initialize(25, 25)
l3.Initialize(30, 20)
gmap.AddPolyline(Array (l1, l2, l3), 4, fx.Colors.Red)

v1.20 - New AddPolygon method.

v1.21 - Fixes a crash that happens after clicking on the Google link. Note that it will cause the map to reset.

V1.50 - Based on the latest version of GMapsFX. New Initialize2 method allows setting the API key:

V1.55 - Reapplied most of the changes done by Informatix in v1.28.

V1.61 - Fixes an issue related to the API key.

V1.62 - Removed the new full screen control (which doesn't do anything in desktop apps).
V1.65 - Adds PolylineClick (SelectedPolyline As MapPolyline) event.
V1.70 - Fixes the font issue on Macs.
V1.71 - Fixes an issue with MapCircle.Radius.
V1.75 - Polygons, Polylines and Circles are only clickable if the relevant click event is handled.
V1.80 - Adds compatibility with B4JPackager11. You need to set AdditionalModuleInfoString to "exports com.lynden.gmapsfx.javascript.event;"
V1.81 - Marker.Position property is read / write property (was write only).
V1.82 - Changes the way the map is loaded internally as the previous method no longer works.

Note that due to a bug in the native WebView the map can disappear if the user drags it too fast. For that reason it is important to show a "reset map" button that resets its position.

The map will not work properly without an API key.

If you are using Java 9 then you need to call Form.Show before adding the map (https://www.b4x.com/android/forum/threads/java-9-and-webview-and-googlemaps.85353/).


  • GoogleMapsExample.zip
    2.7 KB · Views: 1,157
  • jGoogleMaps.zip
    147.5 KB · Views: 848
Last edited:


Well-Known Member
Licensed User
Longtime User
I remember similar problems when the API_KEY was wrong or undeclared. Did you check it ?
Not open for further replies.