Android Question Find Real Address from Navigation on Google Map

Khairy Abdelhamid

Member
Licensed User
Dear All:
Greetings,
Hope to build deliver app, so i need to find destination address/location
The user navigate the Map until find his location, at this time, need the app find address and view it and also store its location

Example in the attached video.
https://files.fm/u/85r97dvd

There is any code make like that ?
Thanks on advance.
Best regards
 

BillMeyer

Well-Known Member
Licensed User
You are most likely looking for Geocoding and Reverse Geocoding.

Look here for the library: https://www.b4x.com/android/forum/threads/geocoder-library.17115/

Storing the location is your decision and will be based on your app design. You could use CKVS (cloud based), KVS2 (local to device) or MySQL (server based - preferably accessed with jRDC2).

If you need more information, please ask another question (preferably a new thread).

Enjoy your Coding !!!
 

Khairy Abdelhamid

Member
Licensed User
Dear Mr. Bill

Really many thanks for your interesting, and for your help, the link you mentioned work but not like what i need.

I need to navigate on google map, and at the cursor placed give me this address and location,

Example for what i need like the following video/link
https://files.fm/u/85r97dvd

Best regards
 

emexes

Well-Known Member
Licensed User
I used to use Google but now they seem to have no free option (having said that, I'm pretty sure that the geocoding function in Google Sheets still works, but... hmm)

These guys give 10,000 lookups/day free:

https://locationiq.com

What you would do is get the latitude and longitude of where the user clicked on the map, and then feed that via a http "web page" request to locationiq who return the corresponding nearest address in JSON. They have a demo/test form on their homepage for each direction (coordinates to address, and address to coordinates).

edit: if 10,000/day is too low for your use-case, then bear in mind that addresses don't change much, so you could keep a cache of the last say 1000 requests that an app instance has made, and then search that for already-obtained addresses within eg 10 metres of the click point. If you find nothing, *then* you ask locationiq.com.
 
Last edited:

emexes

Well-Known Member
Licensed User
These guys are free, for 250 requests per day per IP address:

https://geocode.farm/geocoding/free-api-documentation/

Sample request:

https://www.geocode.farm/v3/json/reverse/?lat=51.503844&lon=-0.127652

returns address:
B4X:
...
"formatted_address": "10 Downing Street, London, SW1A 2AA, United Kingdom",
"accuracy": "EXACT_MATCH",
"ADDRESS": {
    "street_number": "10",
    "street_name": "Downing Street",
    "locality": "SW1",
    "admin_2": "London",
    "admin_1": "England",
    "postal_code": "SW1A 2AA",
    "country": "United Kingdom"
},
...
 
Last edited:

emexes

Well-Known Member
Licensed User
If you are also planning to do navigation, then consider using intents with Google Maps, rather than rewriting what already works. Once your concept is working, then you can decide if you want to spend the effort to incorporate navigation to within your app.

Of course, I could be wrong: every now and again I see the wizards of this forum (WOTF?!?!) conjure up some implausibly-small code that results in some gobsmackingly-effective solution.
 
Last edited:

BillMeyer

Well-Known Member
Licensed User
....conjure up some implausibly-small code that results in some gobsmackingly-effective solution.

BIG CODE
small code

Sorry, I couldn't resist !!

Enjoy your Coding !!
 
Top