Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Metamod and GeoIP latitude and...
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
06-Apr-11 15:54:19
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
- Index
- » MetaMod
- » MetaMod General Support
- » Metamod and GeoIP latitude and...
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5965
- Posts this week:
- 3
- User Info:
- Total Users:
- 8012
- Newest User:
- grant1ab
- Members Online:
- 0
- Guests Online:
- 196
- 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