With GeoIP one can get a location from an IP address.
Databases from MaxMind: http://dev.maxmind.com/geoip/legacy/geolite/.
Free databases are mostly limited to resolve a country only; if one needs a better resolution one needs to pay for the service. Then an IP address can be resolved even into postalcodes, more or less exact.
Sometimes an IP address is being resolved into a wrong country; to update it, use https://staging.maxmind.com/en/correction.