Android Question webview google maps

merlin2049er

Well-Known Member
Licensed User
Longtime User
Hi,

I'm passing the url to a webview...as follows.

WebViewmap.LoadUrl("https://maps.google.com/maps/"& "@" & lat & "," & lon)

I'm picking up the lat/long from the satellite no problem. The google maps page loads, but doesn't actually bring up the location.

I tried that in a desktop browser, and it seems to be fine...
 

Air

Member
Licensed User
Longtime User
Hi,

I'm passing the url to a webview...as follows.



I'm picking up the lat/long from the satellite no problem. The google maps page loads, but doesn't actually bring up the location.

I tried that in a desktop browser, and it seems to be fine...

Try...

B4X:
https://maps.google.com/maps?q=" & lat & "," & lon & "&t=Default&iwloc=A"
 
Last edited:
Upvote 0

Air

Member
Licensed User
Longtime User
Hmmm,
tried it on my app and it works.

Did your lat / lon have a "," inside? If yes, replace it with "."

B4X:
lat = lat.Replace(",",".")
lon = lon.Replace(",",".")
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
ok, I've got a ":" in side of it. I'll try.

B4X:
lat = lat.Replace(":",".")
lon = lon.Replace(":",".")
 
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
Please try this:
B4X:
Log("https://maps.google.com/maps?q=" & lat & "," & lon & "&t=Default&iwloc=A")

But........
if you write that I've got a ":" in side of it may be that the coords inside lan and lon are in Sexagesimal format, not in decimal format (see here for an explanation).

If it is true, you need to convert it, not only replace ":" with "."

Sergio
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
But........
if you write that I've got a ":" in side of it may be that the coords inside lan and lon are in Sexagesimal format, not in decimal format (see here for an explanation).
If it is true, you need to convert it, not only replace ":" with "."

That bring us back to

What is "exactly" in the variables lat and lon?

 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
ok, after replacing the : with a .

I've got the following co-ordinates...

lat = 43.41.929
lon = -79.26.5548
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
Hmm, my gps on the phone must be off quite a bit. If I use the co-ordinates above I land in lake Ontario. lol

I geocoded my address and it's...
43.6988297, -79.4425964
 
Upvote 0

Air

Member
Licensed User
Longtime User
I geocoded my address and it's...
43.6988297, -79.4425964

Tested. It works. I see Toronto, Kanada

What is the Variable-Type of lat / lon?

It must be String, if you use my HTTP-Link
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
Ok, I'll check the variable type. Thanks.

But this is the location my phone was picking up, and it seems way off.

lat = 43.41.929
lon = -79.26.5548
 
Upvote 0

Air

Member
Licensed User
Longtime User
lat = 43.41.929
lon = -79.26.5548

Ooops,
These Koordinates show me a point in Germany

if i delete the second points to
lat = 43.41929
lon = -79.265548

i am in Lake Ontario
 
Upvote 0

merlin2049er

Well-Known Member
Licensed User
Longtime User
I'm going to try the location manager. No luck with the gps, maybe it's my phone? I'll try another android phone if possible.
 
Upvote 0

sirjo66

Well-Known Member
Licensed User
Longtime User
Ok, I understand that you don't have read my above post.

Air write to you:
What is "exactly" in the variables lat and lon?
but you don't answer

So, I suppose that
B4X:
lat = "43:41.929"
lon = "-79:26.5548"
but this is the same as
B4X:
lat = 43.6988297
lon = -79.4425964

When you have 43:41.929, this is the same as 43° 41.929', so you need to convert it into decimal value.

In fact, if I tell to you "an hour and an half", you can write "1:30" or "1.5" (it's the same !!)

So, you need to convert 1:30 to 1.5 !!!

How to do it ??
Very simple !!

Take the value after ":" (in your case is 41.929) and divide by 60, that is 0.6988
Add the value before ":", and your decimal coords will be 43.6988

Same with lon
-26.5548 / 60 + (-79) = -79.4426

Best regards
Sergio

P.S.: Belgravia Ave ??
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…