Does anyone know how to get accurate country/city data?

I've been attempting to use request.cf.country but sometimes it returns XX, and cities empty, despite having valid LAT, LONG values which can be used to find the correct location. I am using a vpn when testing other locations but I'm confusesd as to how the LAT,LONG values are correct but are not able to be geolocated in the other headers. Testing it again i see that the LAT,LONG values are incorrect but I am able to get the correct location from getting the Geolocation of the IP from
request.headers.get('CF-Connecting-IP')
request.headers.get('CF-Connecting-IP')
How do i get accruate country/city data? I don't want to use maxMind if there's a workers/cloudflare trasnform feature that I'm missing.
3 Replies
Hello, I’m Allie!
Geolocation data provided by Workers comes from MaxMind. For more accurate data, you would have to merge multiple sources together, or pull it from the browser when available
Dahoom4030
Dahoom403011mo ago
Thanks
Tin Cap
Tin Cap11mo ago
FWIW, I worked at a very large tech company that used MaxMind data as well. Eventually they put together a team to wrap MaxMind and augment it with some of their own custom location data. Not sure if that means MaxMind is good data, but just a bit of info.