B4J Question OSM Open Street Map for B4J?

ValDog

Active Member
Licensed User
Longtime User

I run the demo OK, but when I use essentially the same code in my application (as a separate dialog) I also get this error - anyone have any ideas?
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
Can you post the full error message?

Have you tried to run it in release mode?

Erel, thanks for responding. I found my problem. I was adding markers using locations from a database file and did not sequence the ImageMapMarker statements correctly.
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User

Hi,,,
You get the latitude and longitude with this library!
Thank 1000
 
Upvote 0

MichalK73

Well-Known Member
Licensed User
Longtime User
I have a problem with OSM for B4J.
When I do this code:
B4X:
Dim parser As JSONParser
parser.Initialize(res)
Dim m As Map=parser.NextObject
x=m.Get("x")
y=m.Get("y")
lista_sn.Items.Add(m.Get("nazwa"))
MapPane1.SetDisplayPositionByLatLon2(x, y,18)

Data x, y, name properly downloaded from the server B4J.
I have error:

B4X:
Program started.
Cannot get methods of class: uk.co.martinpearman.b4j.jfxtras.labs.map.MapPane, disabling cache.
java.lang.NoClassDefFoundError: uk/co/martinpearman/b4j/java/awt/Point
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at anywheresoftware.b4a.shell.Shell$MethodCache.getMethod(Shell.java:864)
    at anywheresoftware.b4a.shell.Shell.getMethod(Shell.java:524)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:653)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:232)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:462)
    at anywheresoftware.b4a.keywords.Common.access$0(Common.java:442)
    at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:516)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: uk.co.martinpearman.b4j.java.awt.Point
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 26 more
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: uk/co/martinpearman/b4j/java/awt/Point
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:471)
    at anywheresoftware.b4a.keywords.Common.access$0(Common.java:442)
    at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:516)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: uk/co/martinpearman/b4j/java/awt/Point
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:462)

Any ideas?
 
Upvote 0

Philip Prins

Active Member
Licensed User
Longtime User
Hello,
How can i get the coordinates in Lat and Lon when some one clicks the mouse in the map, i don't mean on a marker but the point the user has clicked on in the map?

Regards,
Philip
 
Upvote 0

Philip Prins

Active Member
Licensed User
Longtime User
Found it;
B4X:
Sub MapPane1_MouseClicked(EventData As MouseEvent)
    Log(MapPane1.GetCoordinate(EventData.X,EventData.Y))
   
    Log(EventData)
End Sub
 
Upvote 0

Artigala

Member
Licensed User
Longtime User

Dear Martin,
When I try to use your example or create mine, the sub Mouseclicked (EventIcon_MouseClicked (ImageMapMarkerlocal As ImageMapMarker, MouseEvent1 As MouseEvent) ") works only with the right button, not with the left.
In addition, is it possible to add an EventName_MouseMoved (ImageMapMarkerlocal As ImageMapMarker, EventData As MouseEvent) method?
Thank you very much,
 
Upvote 0

Starchild

Active Member
Licensed User
Longtime User
Just downloaded the OSM library wrapper for JFxtras and demo. Post #14
Really amazing.
I have just gone down the road of evaluating using Google Maps JavaScript API (thru jGoogleMaps b4j lib) and after discussion with google I discovered the outrageous license costs.
Is the current version B4j library still (0.10)?
 
Last edited:
Upvote 0

Philip Prins

Active Member
Licensed User
Longtime User

Hello Martin,

With Mobile Atlas Creator what format should i choose to make the custom map?

Regards,
Philip
 
Upvote 0

javiers

Active Member
Licensed User
Longtime User

I would like to be able to execute your code to incorporate offline tiles, but I can not download the example in the offline tiles used in this example can be downloaded from
http://b4j.martinpearman.co.uk/jfxtras.labs.map/tiles/map_of_the_uk.zip

With MOBAC, in what format should I create the offline map?

Thanks in advance!
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Upvote 0

javiers

Active Member
Licensed User
Longtime User
THANKS!!

Thank you. It works perfectly. However I thought that it allowed to see aerial images offline, but I see that the coordinates are not "real".
Is there any way to have tile source (aerial images) locally created with MOBAC?
OpenStreetMap does not have a hybrid mode ... and I would like to make an app with this control, not with GoogleMap (may be paid)
 
Upvote 0

js486dog

Active Member
Licensed User
Longtime User
Please is it possible to use zip map file format like in Osmdroid for B4A ? - I can use zip file in Osmdroid for B4A. I do not have to unzip it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…