Closed elgs closed 10 years ago
Actually it is not returning only country data, try calling getGeoData with the IP 128.101.101.101
, I think the DB is still missing pointers for a city close to the IP :confused:
@oschwald can you confirm this? or test this with an commercial mmdb? (I don't have access to a not lite one)
128.101.101.101
should have city data in GeoLite2. Here is the output using the C API:
{
"city":
{
"geoname_id":
5037649 <uint32>
"names":
{
"de":
"Minneapolis" <utf8_string>
"en":
"Minneapolis" <utf8_string>
"es":
"Mineápolis" <utf8_string>
"fr":
"Minneapolis" <utf8_string>
"ja":
"ミネアポリス" <utf8_string>
"pt-BR":
"Minneapolis" <utf8_string>
"ru":
"Миннеаполис" <utf8_string>
"zh-CN":
"明尼阿波利斯" <utf8_string>
}
}
"continent":
{
"code":
"NA" <utf8_string>
"geoname_id":
6255149 <uint32>
"names":
{
"de":
"Nordamerika" <utf8_string>
"en":
"North America" <utf8_string>
"es":
"Norteamérica" <utf8_string>
"fr":
"Amérique du Nord" <utf8_string>
"ja":
"北アメリカ" <utf8_string>
"pt-BR":
"América do Norte" <utf8_string>
"ru":
"Северная Америка" <utf8_string>
"zh-CN":
"北美洲" <utf8_string>
}
}
"country":
{
"geoname_id":
6252001 <uint32>
"iso_code":
"US" <utf8_string>
"names":
{
"de":
"USA" <utf8_string>
"en":
"United States" <utf8_string>
"es":
"Estados Unidos" <utf8_string>
"fr":
"États-Unis" <utf8_string>
"ja":
"アメリカ合衆国" <utf8_string>
"pt-BR":
"Estados Unidos" <utf8_string>
"ru":
"США" <utf8_string>
"zh-CN":
"美国" <utf8_string>
}
}
"location":
{
"latitude":
44.975900 <double>
"longitude":
-93.216600 <double>
"metro_code":
613 <uint16>
"time_zone":
"America/Chicago" <utf8_string>
}
"postal":
{
"code":
"55414" <utf8_string>
}
"registered_country":
{
"geoname_id":
6252001 <uint32>
"iso_code":
"US" <utf8_string>
"names":
{
"de":
"USA" <utf8_string>
"en":
"United States" <utf8_string>
"es":
"Estados Unidos" <utf8_string>
"fr":
"États-Unis" <utf8_string>
"ja":
"アメリカ合衆国" <utf8_string>
"pt-BR":
"Estados Unidos" <utf8_string>
"ru":
"США" <utf8_string>
"zh-CN":
"美国" <utf8_string>
}
}
"subdivisions":
[
{
"geoname_id":
5037779 <uint32>
"iso_code":
"MN" <utf8_string>
"names":
{
"en":
"Minnesota" <utf8_string>
"es":
"Minnesota" <utf8_string>
"ja":
"ミネソタ州" <utf8_string>
"ru":
"Миннесота" <utf8_string>
}
}
]
}
@oschwald
Sorry, I said that 128.101.101.101
is actually returning such data, but other IP's not. for example, try 83.162.253.8
. that won't return any city data, neither will 8.8.8.8
. on some American IP's you can try to replace the last number with a 0 and it may return city data but only with IPv4. so is this a code bug? or is this a limitation of the GeoLite2 DB?
Ah, I misunderstood you. Some IP addresses do not have city-level data in both GeoLite2 and the commercial database. In the commercial database, 8.8.8.8
does not have city-level data while 83.162.253.8
does. The latter does not appear to have city-level data in GeoLite2 though.
I remember that that GeoLite(1) DB gave City data anyway (even if it was inaccurate). is this still a behaviour we can get? (I think alot of people download the City db for city data not getting any city data is pretty dissapointing)
GeoLite Legacy also didn't include city-level data for such IPs. Here is the output for 8.8.8.8
GeoIP City Edition, Rev 1: US, N/A, N/A, N/A, N/A, 38.000000, -97.000000, 0, 0
ipaddr: 8.8.8.8
range_by_ip: 8.7.233.0 - 8.8.32.255
network: 8.8.0.0 - 8.8.31.255 ::19
ipnum: 134744072
range_by_num: 134736128 - 134750463
network num: 134742016 - 134750207 ::19
Oh I thought it did, well then this issue can be closed! Thanks for the help and fast responses @oschwald, It's appreciated!
Thanks for sample code that runs successfully. However, it seems the getGeoData(ipAddress) function will only return the country data. Is there any chance to add any functions for the city data?
Thanks, Elgs