dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasgoMobi

Posted by akoenzen 3 years 34 weeks ago

pic
 akoenzen
mobiForge Newbie
Posts: 1
Joined: 4 years ago
[offline]

Hello to all,

This is my first post here at mobiForge.com... I would like to contribute to this forum by explaining how to use Lat/Long coordinates retrieved using Google GeoLocation API and to calculate the radius, which of course can be used in many ways into mobile web applications.

Step #1 - Retrieve Lat/Long from Google using PHP5:

function geoLocateUser($location) {
  $location = $this->urlEncode(' ', '+', $location); // encode url here...
 
  $request  = 'http://maps.google.com/maps/geo?';
  $request .= 'q='.$location.'&';
  $request .= 'key='YOUR_KEY_HERE&';
  $request .= 'output='.$config_ga['format'].'&';
  $request .= 'oe=utf8';
 
  $response  = file_get_contents($request);
 
  $result = simplexml_load_string($response);
 
  $latLong = (string)$result->Response->Placemark->Point->coordinates;
 
  return $latLong;
}// End of geoLocateUser()

This will return the Lat/Long coordinates from the location you have entered. i.e. Your address 12345, New York, US

Step #2 - Calculate the radius using MySQL:

"SELECT [columns] FROM [column] WHERE 1=1 AND 3963.191 * ACOS((SIN(PI() * [latitude] / 180) * SIN(PI() * [column].latitude / 180)) + (COS(PI() * [latitude] /180) * cos(PI() * [column].latitude / 180) * COS(PI() * [column].longitude / 180 - PI() * [longitude] / 180)) ) <= 10"

This MySQL formula will return results within a radius of 10 miles from the Lat/Long coordinates given by the user.

I have use this method of calculating distances and radius when I developed Dating.mobi, and this was extremely useful to retrieve users within a certain distance to each other.

Anyway, this was a brief article/tutorial but I hope you find it useful. This article is also available at my company's website at www.apkc.net

Regards,

Posted by acgaskin72 3 years ago

pic
 acgaskin72
mobiForge Newbie
Posts: 3
Joined: 3 years ago
[offline]

Please help I'm looking to develop a .mobi application where I can email an address to my server and retrieve all the traffic from a half mile radius of the address and deliver the information back into an report I currently run my application on google maps @
www.badgercounts.com Simply want to deliver the same info in a report format on a handheld device. How do I get started. PLLLLLLEASE Help Anyone

I would like to do something like this company did but with traffic counts.
Thanks
ex. report

Example Mobile Report

Here are the results of your emailed Property Search:
{101 Spear Street San Francisco CA}
Matching Address #1: 101 Spear Street (One Rincon Center)
City: San Francisco
Status: For Lease Property
Type: Office
Min SF: 2851
Max SF: 7239
Furnished: N
Terms: Quoted rate to be determined. Term: 5-10 yrs.
Agent 1: Jon Cecconi ,
415.292.4917
Agent 2: Jim Ousman , 415.291.4917
Agent 3: Chisty McRoskey , 415.291.1728

Posted by acgaskin72 3 years ago

pic
 acgaskin72
mobiForge Newbie
Posts: 3
Joined: 3 years ago
[offline]

Please help I'm looking to develop a .mobi application where I can email an address to my server and retrieve all the traffic from a half mile radius of the address and deliver the information back into an report I currently run my application on google maps @
www.badgercounts.com Simply want to deliver the same info in a report format on a handheld device. How do I get started. PLLLLLLEASE Help Anyone

I would like to do something like this company did but with traffic counts.
Thanks
ex. report

Example Mobile Report

Here are the results of your emailed Property Search:
{101 Spear Street San Francisco CA}
Matching Address #1: 101 Spear Street (One Rincon Center)
City: San Francisco
Status: For Lease Property
Type: Office
Min SF: 2851
Max SF: 7239
Furnished: N
Terms: Quoted rate to be determined. Term: 5-10 yrs.
Agent 1: Jon Cecconi ,
415.292.4917
Agent 2: Jim Ousman , 415.291.4917
Agent 3: Chisty McRoskey , 415.291.1728

Posted by acgaskin72 3 years ago

pic
 acgaskin72
mobiForge Newbie
Posts: 3
Joined: 3 years ago
[offline]

Please help I'm looking to develop a .mobi application where I can email an address to my server and retrieve all the traffic from a half mile radius of the address and deliver the information back into an report I currently run my application on google maps @
www.badgercounts.com Simply want to deliver the same info in a report format on a handheld device. How do I get started. PLLLLLLEASE Help Anyone

I would like to do something like this company did but with traffic counts.
Thanks
ex. report

Example Mobile Report

Here are the results of your emailed Property Search:
{101 Spear Street San Francisco CA}
Matching Address #1: 101 Spear Street (One Rincon Center)
City: San Francisco
Status: For Lease Property
Type: Office
Min SF: 2851
Max SF: 7239
Furnished: N
Terms: Quoted rate to be determined. Term: 5-10 yrs.
Agent 1: Jon Cecconi ,
415.292.4917
Agent 2: Jim Ousman , 415.291.4917
Agent 3: Chisty McRoskey , 415.291.1728

Posted by ronanhigg 3 years ago

pic
 ronanhigg
mobiForge Newbie
Posts: 9
Joined: 3 years ago
[offline]

That SQL query looks like the Haversine "Great Circle" formula , right?

Ronan Higgins
Locle

~ location-aware mobile software
www.locle.com or m.locle.com