1GeoIP2::Record::LocatioUns(e3r)Contributed Perl DocumentGaetoiIoPn2::Record::Location(3)
2
3
4
6 GeoIP2::Record::Location - Contains data for the location record
7 associated with an IP address
8
10 version 2.006002
11
13 use 5.008;
14
15 use GeoIP2::WebService::Client;
16
17 my $client = GeoIP2::WebService::Client->new(
18 account_id => 42,
19 license_key => 'abcdef123456',
20 );
21
22 my $insights = $client->insights( ip => '24.24.24.24' );
23
24 my $location_rec = $insights->location();
25 print $location_rec->name(), "\n";
26
28 This class contains the location data associated with an IP address.
29
30 This record is returned by all the end points except the Country end
31 point.
32
34 This class provides the following methods:
35
36 $location_rec->accuracy_radius()
37 The approximate accuracy radius in kilometers around the latitude and
38 longitude for the IP address. This is the radius where we have a 67%
39 confidence that the device using the IP address resides within the
40 circle centered at the latitude and longitude with the provided radius.
41
42 This attribute is returned by all end points and location databases
43 except Country.
44
45 $location_rec->average_income()
46 This returns a non-negative integer representing the average income in
47 US dollars associated with the requested IP address.
48
49 This attribute is only available from the Insights end point and the
50 GeoIP2 Enterprise database.
51
52 $location_rec->latitude()
53 The approximate latitude of the location associated with the IP
54 address. This value is not precise and should not be used to identify a
55 particular address or household.
56
57 This attribute is returned by all end points and location databases
58 except Country.
59
60 $location_rec->longitude()
61 The approximate longitude of the location associated with the IP
62 address. This value is not precise and should not be used to identify a
63 particular address or household.
64
65 This attribute is returned by all end points and location databases
66 except Country.
67
68 $location_rec->metro-code()
69 This returns the metro code of the location if the location is in the
70 US. MaxMind returns the same metro codes as the Google AdWords API
71 (<https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions>).
72
73 This attribute is returned by all end points except the Country end
74 point.
75
76 $location_rec->population_density()
77 Returns a non-negative integer representing the estimated population
78 per square kilometer associated with the requested IP address.
79
80 This attribute is only available from the Insights end point and the
81 GeoIP2 Enterprise database.
82
83 $location_rec->time_zone()
84 This returns the time zone associated with a location, as specified by
85 the IANA Time Zone Database (<http://www.iana.org/time-zones>), e.g.,
86 "America/New_York".
87
88 This attribute is returned by all end points except the Country end
89 point.
90
92 Bugs may be submitted through
93 <https://github.com/maxmind/GeoIP2-perl/issues>.
94
96 • Dave Rolsky <drolsky@maxmind.com>
97
98 • Greg Oschwald <goschwald@maxmind.com>
99
100 • Mark Fowler <mfowler@maxmind.com>
101
102 • Olaf Alders <oalders@maxmind.com>
103
105 This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
106
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109
110
111
112perl v5.36.0 2023-01-20 GeoIP2::Record::Location(3)