GeoIP2...cation(3pm)

๐Ÿ“ฆ
version 2.006002 ยท 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

๐Ÿ’– GeoIP2::Record::Location โ€” the location record glow-up ๐Ÿ’–

okay bestie, so this is a Perl manpage (section 3pm, user-contributed Perl docs, iykyk) and it's all about GeoIP2::Record::Location โ€” the lil class that holds the location record that comes back attached to an IP address. sit down, hydrate, let's go ๐Ÿซถ


โœจ NAME โœจ

GeoIP2::Record::Location โ€” it contains data for the location record associated with an IP address. that's the whole assignment, and it ate. ๐Ÿ’…


๐ŸŒธ VERSION ๐ŸŒธ

version 2.006002

(yeah, she's on 2.006002, write it down, don't be weird about it) ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

the vibe check, in code:

use 5.008;

use GeoIP2::WebService::Client;

my $client = GeoIP2::WebService::Client->new(
    account_id  => 42,
    license_key => 'abcdef123456',
);

my $insights = $client->insights( ip => '24.24.24.24' );

my $location_rec = $insights->location();
print $location_rec->name(), "\n";

likeโ€ฆ make a client, ask for insights on '24.24.24.24', grab ->location(), print ->name(). iconic, no notes. โœจ


๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

This class contains the location data associated with an IP address. that's it, that's the job, and she does it flawlessly. ๐Ÿ‘‘

๐Ÿšจ important tea: this record is returned by all the end points except the Country end point. so if you're on Country, don't come looking for this record, bestie, she's not there. ๐Ÿ’€

๐ŸŽ€ METHODS ๐ŸŽ€

This class provides the following methods. one bullet per method, no crumbs left behind:

๐Ÿ’ซ $location_rec->accuracy_radius()

The approximate accuracy radius in kilometers around the latitude and longitude for the IP address. This is the radius where we have a 67% confidence that the device using the IP address resides within the circle centered at the latitude and longitude with the provided radius. so like, a circle of "probably here-ish", not a pinpoint. ๐ŸŽฏ

This attribute is returned by all end points and location databases except Country.

๐Ÿ’ฐ $location_rec->average_income()

This returns a non-negative integer representing the average income in US dollars associated with the requested IP address.

This attribute is only available from the Insights end point and the GeoIP2 Enterprise database. so if you're not on one of those two, don't even ask. ๐Ÿ™ˆ

๐Ÿ“ $location_rec->latitude()

The approximate latitude of the location associated with the IP address. This value is not precise and should not be used to identify a particular address or household. it's giving "general area", not "ding dong, we know which house". ๐Ÿ 

This attribute is returned by all end points and location databases except Country.

๐Ÿ“ $location_rec->longitude()

The approximate longitude of the location associated with the IP address. This value is not precise and should not be used to identify a particular address or household. same energy as latitude, her twin sister. ๐Ÿ’ž

This attribute is returned by all end points and location databases except Country.

๐Ÿ—บ๏ธ $location_rec->metro-code()

This returns the metro code of the location if the location is in the US. MaxMind returns the same metro codes as the Google AdWords API (<https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions>). yes, the hyphen in the method name is real, that's just how she is, we don't question it. ๐Ÿ’…

This attribute is returned by all end points except the Country end point.

๐Ÿงฎ $location_rec->population_density()

Returns a non-negative integer representing the estimated population per square kilometer associated with the requested IP address. crunching numbers, respectfully. ๐Ÿ“Š

This attribute is only available from the Insights end point and the GeoIP2 Enterprise database.

๐Ÿ•ฐ๏ธ $location_rec->time_zone()

This returns the time zone associated with a location, as specified by the IANA Time Zone Database (<http://www.iana.org/time-zones>), e.g., "America/New_York". so you finally know what time it is over there, slay. ๐ŸŒ

This attribute is returned by all end points except the Country end point.


๐Ÿซถ SUPPORT ๐Ÿซถ

Bugs may be submitted through <https://github.com/maxmind/GeoIP2-perl/issues>. found a bug? tell the girlies on GitHub, they'll handle it. no cap. ๐Ÿ›


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

the main characters, in order:

  • Dave Rolsky <drolsky@maxmind.com>
  • Greg Oschwald <goschwald@maxmind.com>
  • Mark Fowler <mfowler@maxmind.com>
  • Olaf Alders <oalders@maxmind.com>

absolute legends, all four of them. ๐ŸŒŸ


This software is copyright (c) 2013 - 2019 by MaxMind, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so like, go off, remix it, it's free โ€” just keep the same terms as Perl 5 itself. periodt. ๐Ÿ’–


and that's the whole page, bestie!! ๐ŸŒˆ she's perl v5.36.0, dated 2022-11-21, and honestly? iconic for it. mwah, take care, go read your IP data responsibly ๐Ÿ’…๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from