GeoIp

GeoIP cities

2 years 2 months ago #60369

Danny Malouin's Avatar Danny Malouin

Hi,

I was reading up on the MaxMind database and it apparently supports cities.

I don't see the city selector in the module assignment panel.

Is this something that's planned ?

Amazing extensions BTW, thanks for existing !

Danny
BeNu Web

2 years 2 months ago #60377

Peter van Westen's Avatar Peter van Westen Admin

You could do this via the PHP assignment with some custom php code:

require_once JPATH_LIBRARIES . '/geoip/geoip.php';
$geo = new GeoIp($ip);
$location = $geo->get();
return $location->country == "Canada" && $location->city == "L'Île-Perrot";

2 years 2 months ago #60386

Danny Malouin's Avatar Danny Malouin

Thanks
I was hoping more of a feature addition to your module (an additional filter like continents, countries, regions, postal)
However, for "our" needs, we expect to use the postal code match up for now. I am a little curious to see it's performances in large scale postal ranges (like 100+ sometimes).
Danny

2 years 2 months ago #60388

Peter van Westen's Avatar Peter van Westen Admin

The range of the postal codes does not influence the performance.
The amount of postal codes or ranges in the field may influence the performance a little. How much? Probably not noticeable.
10000-90000 is lighter than 10000,10001,10002,10004.

2 years 2 months ago #60422

Danny Malouin's Avatar Danny Malouin

Ok thanks
As for the cities thing:
Is there a way to add cities as a filter between the region and postal code options/filters ?
Danny

2 years 2 months ago #60423

Peter van Westen's Avatar Peter van Westen Admin

You could use the normal Geo assignments and the PHP assignment (only for the city) together.

2 years 2 months ago #60424

Danny Malouin's Avatar Danny Malouin

Oh i c,
That's what you meant in your first reply. OK, i'll try that.
I imagine MaxMind has a list of available cities somewhere ?
Thanks again for your support
Danny

2 years 2 months ago #60426

Peter van Westen's Avatar Peter van Westen Admin

I don't think they have a public list. That would be a long list!

2 years 2 months ago #60428

Danny Malouin's Avatar Danny Malouin

Ya they do actually
dev.maxmind.com/geoip/geoip2/geolite2

There's indeed about 40k entries in there ;-)

Danny

2 years 2 months ago #60429

Peter van Westen's Avatar Peter van Westen Admin

Ah, yes, forgot they also have a CSV version.

2 years 2 months ago #60452

Danny Malouin's Avatar Danny Malouin

OK so that will probably work for proper GeoIP based banner displaying.

Currently, If I understand well, you are using the "GeoLite" version of MaxMind's product.

Is there a way we can bind the "GeoIP2" version ? I believe (not 100% sure here) that It has a more complete list of cities in there ?

PS: Sorry about all the questions ... it seems so darn difficult to get a good geolocation concept going to for a Joomla solution ... Your's is by far the best i've found ;-)

Thanks
Danny

2 years 2 months ago #60455

Peter van Westen's Avatar Peter van Westen Admin

The free GeoLite (The GeoIP2 version) is less complete than the full GeoIP2, which is not free.
You would have to manually place the GeoIP2 database on your server and customise code so you can reference it.
You could access that database via the PHP assignment, but not with the API (simple php functions) I have created for the free GeoIP version that comes with the Regular Labs GeoIP plugin.

So of course, it is possible, but not simple and requires a bunch of custom coding.
Also you would need to regularly update the database.