B4A Library Geocoder library

warwound

Expert
Licensed User
Longtime User
Geocoder updated to version 2.01

This is a bug fix.
It fixes a bug where events were not correctly raised if you used more than one instance of the Geocoder object.

Version 2.01 is attached to the first post in this thread.

Martin.
 

PhilipBrown

Active Member
Licensed User
Longtime User
Sub _geocodedone was not found

Hi Martin,

Thanks for your fantastic work on OSMDroid. I'm planning to use it in a new app.

I'd like to use Geocoder too but am having problems. I downloaded the library and tried to run GeocoderDemo. It did not run as it seemed to be written for an older version of GetFromLocation with only 3 arguments and without an event. I modded the code but now I get the error:

java.lang.Exception: Sub _geocodedone was not found.

I attach my effort.
 

Attachments

  • GeocoderDemo.zip
    9.1 KB · Views: 383

warwound

Expert
Licensed User
Longtime User
Look at the exception logged:

java.lang.Exception: Sub _geocodedone was not found.

The Geocoder is being initialized with an empty string as the event name, so the Sub being called is _geocodedone and NOT Geocoder1_GeocodeDone.

Update your code so that Geocoder is initialized with the EventName that you need:

B4X:
Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
      Geocoder1.Initialize("Geocoder1")
   End If
   
   Activity.AddMenuItem("GetFromLocationName", "GetFromLocationName")
   Activity.LoadLayout("GetFromLocation")
   
   ResultsList.TwoLinesLayout.ItemHeight=ResultsList.TwoLinesLayout.ItemHeight*2
   ResultsList.TwoLinesLayout.Label.Height=-2
   ResultsList.TwoLinesLayout.SecondLabel.Height=-2
   
End Sub

Martin.

[edit]I've now fixed the demo code in the attachment in the first post[/edit]
 
Last edited:

benji

Active Member
Licensed User
Longtime User
I want use ReverseGeoCoding, and it's works excellent. But i need use this offline, can i do this? how?
 

corwin42

Expert
Licensed User
Longtime User
I want use ReverseGeoCoding, and it's works excellent. But i need use this offline, can i do this? how?
No, this is not possible.

Ok, it would be possible with a large locally stored database but I don't know if there are out of the box solutions for this. At least there is no free solution.
 

warwound

Expert
Licensed User
Longtime User
There is a relatively new project GraphHopper that is trying (or has succeeded) in using open street map data for offline routing.
Not sure if it also provides offline geocoding and reverse geocoding.

Martin.
 

javiers

Active Member
Licensed User
Longtime User
On this page: http://wiki.openstreetmap.org/wiki/Query-to-map
shows a query that allows a list of OSM objects defined by a rectangle.

"Query-to-map is a script to show the results of an database query in a map. The used database is the same like used for Mapnik. The script is designed to work in real-time, so it Should be used with queries small relativamente returning only results. "

Html should be extracted from the object information.
 

padvou

Active Member
Licensed User
Longtime User
Geocoder library


If either of the two Geocoder methods Get??? fail then the GeocodeDone event will simply be passed an array of zero Address objects.
Any exceptions will be caught and sent to the log.

Martin.

So, what can I do if both methods return empty?
 

warwound

Expert
Licensed User
Longtime User
Do you see anything reported in the log - uncheck the 'filter' checkbox.

Does everything still fail even after rebooting your device?

Martin.
 

warwound

Expert
Licensed User
Longtime User
Read this thread all the way through and you'll see it's not uncommon for the Geocoder to fail to return a result.
Sometimes a device reboot fixes the problem, sometimes the problem just fixes itself.
And presumably other times it just fails to work whatever you do - but i've never experienced this myself.
 
Last edited:

George Anifantakis

Member
Licensed User
Longtime User
Hi I initilize using Geocoder1.Initialize2("Geocoder1" , "en") but i got the results in Greek instead English. Should i do somethnig diffrent?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…