Geolocation function

3 replies [Last post]
d3mac123
User offline. Last seen 1 week 5 days ago. Offline
Joined: 12 Feb 2010

Hi guys, I am starting to play with Corona and I need to develop a function that allows people to find (for example) the closest pharmacy. Considering I have the current location and a list with all lat/long of pharmacies around the world in my database, how could I discover the "nearest" one? Can I calculate it inside Corona or should I call the Google Map API to do it? Any examples or links with more info?

Thanks,
Alex

Replies

Eric
User offline. Last seen 1 year 9 weeks ago. Offline
Joined: 23 Jun 2009

Corona can return your GPS location. I guess you'd do a search on your table of all pharmacies and compute the nearest one by distance.

fpassa's picture
fpassa
User offline. Last seen 20 hours 27 min ago. Offline
Joined: 17 Sep 2009

Hi,

The only missing or pending function in corona would be the support of MapKit framework to allow you to make and show annotation on it regarding your pharmacies.

Up now, the only similar way to show them on a map is by using webpopup by calling google map with all of its parameters to show annotations into the map, but preserving the ability to stay inside your CORONA application.

The Geolocation sample code already provided by Ansca staff, only call the external safari browser in you phone to redirect the call to google map URL. This method lacks the ability to return to your CORONA app as it is not running anymore when you launch safari. That's the reason why MapKit framework support was requested as desired support in CORONA next release.

Regards,

Flavio

fpassa's picture
fpassa
User offline. Last seen 20 hours 27 min ago. Offline
Joined: 17 Sep 2009

My above explanation is related to in case you wish to show pharmacies locations in the map.

The rest of the functionality is performed according to Eric comment.

Flavio.

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.