Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Metamod and GeoIP latitude and longitude recipe

Metamod and GeoIP latitude and longitude recipe

I have 10 cities in Jordan I want to display weather modules for.  I think the most accurate way is to specify by lat/long but the recipe is not clear.  The example shows something similar to this:
// $geoip->31.0000: return 307

This is for latitude only...how accurate can it be if it is lat only with no long?  Can anyone provide a suggestion as to how I can specify certain lats and longs to show a specific module?

EDIT: Joomla 1.5.22 and Metamod v2.6

Edited By: abugabby
06-Apr-11 16:54:19

abugabby
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Metamod and GeoIP latitude and longitude recipe

Hi abugabby,

I just checked the accuracy ratings for Jordan for the GeoLiteCIty database:

http://www.maxmind.com/app/geolite_city_accuracy

The ratings are 59% correctly resolved within 25 miles of destination, and 88% correct if excluding ones that don't have city data at all.

This is quite low, although among the higher rates for any other countries - e.g. higher than the UK.

Back to your question: if you want to identify people by city, then I would suggest doing it by city name rather than by latitude/longitude. If the city name is incorrect or missing, then the lat/long values will also be wrong.

Therefore I suggest doing the following sort of rule:

(download the GeoLite City database, uncompress it and install it in /geoip, and enable GeoLiteCity in your MetaMod)

if ( $fromCountryId == 'JO' ) {
  if ( $geoip->city == 'Amman' ) return XXX;
  if ( $geoip->city == 'Az Zarqa' ) return YYY;
  if ( $geoip->city == 'Irbid' ) return ZZZ;
// etc
}

// replace XXX, YYY, ZZZ etc with the module id to show for each city.


Bear in mind that this is not going to be very accurate. Is there some way you could get people to enter their own city name if the code above does not get it right?

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10137
Newest User:
lexispoker1
Members Online:
0
Guests Online:
344

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked