Mobile Location

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Mobile Location

Post by marcelloe » Fri Mar 14, 2014 6:53 pm

Can LC use the metadata of a picture to find the location the picture was taken?

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Mobile Location

Post by marcelloe » Fri Mar 14, 2014 7:17 pm

Am I on the right track with trying to use the following script to convert to a city?

Code: Select all

put  "http://maps.googleapis.com/maps/api/geocode/json?address="&tLocationArray&"&sensor=false" into tURL

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Mobile Location

Post by LCNeil » Sat Mar 15, 2014 2:12 pm

Hi Mark,

There are no direct functions for extracting the metadata of an image. However, there is a 3rd party library has been created by another LiveCode user which you may find useful-

http://tweedly.org/showpage.lc?page=EXIFLib

In regards to converting coordinates to a city, you are on the right path but you need to use the reverse Geocode as described on the Google maps api page

Code: Select all

https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false&key=API_KEY
The above also requires an API key. Google explain how to create this here-

https://developers.google.com/maps/docu ... g/#api_key

and the data that is returned will be in the JSON format. Elanor explains how to parse such data in Lesson 6 of the idea2app course.

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Mobile Location

Post by marcelloe » Mon Mar 17, 2014 3:13 pm

I have a couple of questions about the reverse lookup string. For the longitude and latitude would I use the "tLatitude" and "tLongitude" to get the coordinates? Would I put this string in the handler "showCurrentLocation"?

https://maps.googleapis.com/maps/api/ge ... ey=API_KEY

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Mobile Location

Post by LCNeil » Tue Mar 18, 2014 1:59 pm

Hi Mark,

tLatitude and tLongitute are temporary variables that used throughout functions within the maps card of the idea2app sample stack. You will have to be sure to correctly return these values to where you are generating the geocode url.

showCurrent location triggers display url which opens a ben browser with a given URL, so this might not be suitable for what you are trying to do. You may wish to look into creating a separate handler for this specific purpose.

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com

marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Mobile Location

Post by marcelloe » Tue Mar 18, 2014 3:00 pm

Let me see if I am on the right track to create a separate handler. I want to put the Longitude and latitude to a value. I want to use the reverse look up to get a city and put that city into a variable. I want to call that variable on the mouseUp handler to put the city into the corresponding field. Am I on the right track?

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Mobile Location

Post by LCNeil » Wed Mar 19, 2014 2:16 pm

Hi Mark,

Yes that does sound like a viable option fro what you are looking to achieve. As long as you have the longitue and latitued you will be able to post them to the Goolgle Geocode service. Google will then return JSON data according to your request which you will be able to parse to get the required data you need. This data can then be placed into a variable and then into a field.

so a break down would be-

1) Get Long and Lat of current location (mobileCurrentLocation)
2) Create Google Geocode URL and execute URL call
3) Parse returned JSON to extract data you need
4) Place this data into a variable and then place into the relevant field

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

Post Reply

Return to “idea2app and Coding School”