Open Google Map with Address

Is it possible to send an address to Google Maps with the OpenURL function? I’m not sure how to format such a URL, and it doesn’t need to send the users current location. I just want to show a spot on Google Maps base on an address. Thanks!

Ex.
local function homeButton (event)
print( “Home Button pushed.” )
print(data[id].address1)
print(data[id].address2)

local url = “http://maps.google.com/…”…data[id].address1…", "…data[id]address2

system.openURL( url )

end

[import]uid: 150151 topic_id: 33778 reply_id: 333778[/import]

Yes, you can. Have a look at sample app “Hardware/GPS” that is included with the Corona SDK on how to call do this via the [lua]system.openURL()[/lua] function. That sample code does it via latitude and longitude taken from the GPS. [import]uid: 32256 topic_id: 33778 reply_id: 134259[/import]

I understand I can send a GPS coordinate to Google Maps via openURL, but is there any way to send an address, without the GPS coordinate? I would ultimately have to use Google Maps to locate an address, to find the GPS coordinate, so Google can handle addresses. And looking up hundreds, if not thousands of addresses by hand to get GPS coordinates is not economical for building my business app. Is there any other way? [import]uid: 150151 topic_id: 33778 reply_id: 134261[/import]

Oh, and my data[id].address1 and data[id].address2 are the two lines of an address for a person depending on which row was tapped.

ex.
1234 N Ave
Cityville, CA 12345 [import]uid: 150151 topic_id: 33778 reply_id: 134262[/import]

I’ve personally never set up a Google Maps URL with an address before, but it looks like it may be possible according to Google’s documentation here…
https://developers.google.com/maps/documentation/staticmaps/#Addresses

Also, if it is any easier on you, you can use Corona’s native MapView to display a map within your own map. Please see sample app “Interface/MapView” included with the Corona SDK on how to do this. Also see the following API documentation…
http://docs.coronalabs.com/api/library/native/newMapView.html
[import]uid: 32256 topic_id: 33778 reply_id: 134264[/import]

Yes you can easily do that. This link open a market at the white house :slight_smile:

http://maps.google.com/?q=1600 Pennsylvania Avenue Northwest, Washington, DC 20500, United States

Nick [import]uid: 28795 topic_id: 33778 reply_id: 134266[/import]

All, I have gotten the openURL method to work with an address, based off of your help! Thank you. Here is what the code finally looked like to make it work. The problem was that there could not be any spaces in the URL.

Ex.

local mapButton( event )
if event.phase == “release” then
url = “http://maps.google.com/maps?q="..data[id].address1..","..data[id].address2…”,+United+States"
system.openURL( url )
else
– nothing
end

where
data[1].address1 = “1234+N+Ave”
data[1].address2 = “Seattle,+WA+980101” [import]uid: 150151 topic_id: 33778 reply_id: 134293[/import]

Yes, you can. Have a look at sample app “Hardware/GPS” that is included with the Corona SDK on how to call do this via the [lua]system.openURL()[/lua] function. That sample code does it via latitude and longitude taken from the GPS. [import]uid: 32256 topic_id: 33778 reply_id: 134259[/import]

I understand I can send a GPS coordinate to Google Maps via openURL, but is there any way to send an address, without the GPS coordinate? I would ultimately have to use Google Maps to locate an address, to find the GPS coordinate, so Google can handle addresses. And looking up hundreds, if not thousands of addresses by hand to get GPS coordinates is not economical for building my business app. Is there any other way? [import]uid: 150151 topic_id: 33778 reply_id: 134261[/import]

Oh, and my data[id].address1 and data[id].address2 are the two lines of an address for a person depending on which row was tapped.

ex.
1234 N Ave
Cityville, CA 12345 [import]uid: 150151 topic_id: 33778 reply_id: 134262[/import]

I’ve personally never set up a Google Maps URL with an address before, but it looks like it may be possible according to Google’s documentation here…
https://developers.google.com/maps/documentation/staticmaps/#Addresses

Also, if it is any easier on you, you can use Corona’s native MapView to display a map within your own map. Please see sample app “Interface/MapView” included with the Corona SDK on how to do this. Also see the following API documentation…
http://docs.coronalabs.com/api/library/native/newMapView.html
[import]uid: 32256 topic_id: 33778 reply_id: 134264[/import]

Yes you can easily do that. This link open a market at the white house :slight_smile:

http://maps.google.com/?q=1600 Pennsylvania Avenue Northwest, Washington, DC 20500, United States

Nick [import]uid: 28795 topic_id: 33778 reply_id: 134266[/import]

All, I have gotten the openURL method to work with an address, based off of your help! Thank you. Here is what the code finally looked like to make it work. The problem was that there could not be any spaces in the URL.

Ex.

local mapButton( event )
if event.phase == “release” then
url = “http://maps.google.com/maps?q="..data[id].address1..","..data[id].address2…”,+United+States"
system.openURL( url )
else
– nothing
end

where
data[1].address1 = “1234+N+Ave”
data[1].address2 = “Seattle,+WA+980101” [import]uid: 150151 topic_id: 33778 reply_id: 134293[/import]