I am using ipinfodb.com to get geolocation info for IPs, but it only gives postal codes for US addresses.
I am also getting GPS coods from mobile devices, but I need to get more useful information from these GPS coods, that is the country, state, city and postalcode of that GPS coods.
Two questions, 1) is there a more comprehensive database than ipinfodb.com that will get postal codes for IPs outside of the US? 2) is there a way to get address information from GPS coods (including places outside the US).
MaxMind offers a free version of their GeoCity database.
http://www.maxmind.com/app/geolitecity
Also, there is an open source, free-to-use web service at:
http://hostip.info
Both should provide comprehensive location data.
Google does reverse Geocoding but IIRC, according to the Terms and Conditions, the results are to be used only in a Google Map.
Related
In the docs, I see I can get a Country, but is there a way to get a bit more, like a subdivision or even a city, from Cloudflare?
Cloudflare users on Business or Enterprise plans have access to more granular geolocation fields in the Ruleset Engine (which powers many different Cloudflare features)
ip.geoip.subdivision_1_iso_code: Represents the ISO 3166-2 code for the first level region associated with the IP address.
ip.geoip.subdivision_2_iso_code: Represents the ISO 3166-2 code for the second level region associated with the IP address.
See this documentation page for the full list.
Looking at the latest release of geokit-rails (2.1.0), it looks like they have removed the method geo_scope (https://github.com/geokit/geokit-rails/commit/781c4dc62d3b044196efbfad269d4780e6afbe6b).
However, the README on the github account still says to use it.
If the example they provide in the README -- "Location.geo_scope(:origin => '100 Spear st, San Francisco, CA')" -- no longer works whats the new method?
Problem I am trying to solve:
When users register for my site, I collect their mailing address, I need to convert that to lat/long and store it in my database.
As an alternative you could use an address verification service. Some of these include, SmartyStreets (where I work), Melissa Data, and Lob. I'm not a huge expert with the other providers, but I know with SmartyStreets you can use the street API to get latitude and longitude from an address and have the comfort of knowing that the address exists. SmartyStreets has both a US Street API and an International Street API
If you use a non address verification service like Google Maps, you run the risk of approximate latitude and longitude coordinates being returned to you.
I am using MaxMind GeoIP2 database to determine client's location (longitude, latitude, city, country) based on IP address.
For that I'm using Python library geoip2 and local GeoLite2-City.mmdb database.
In order to get more precise result I want to use HTML5 geolocation in addition which returns only coordinates of the client.
I want to use the already existing MaxMind local database to get the country and city based on the coordinates from HTML5 method.
Is it possible and how?
You might want to check the services they provide (I did not see them having what you are looking for), and then maybe contecting their support for more assistance.
Anyways, you could easily use any Reverce Geocoding service which provides REST interface for determining the country (and actuall more accurate address), thus I would suggest you reconsider the requirements on utilizing the original provider for the purpose.
If for some reason you need to have a certain Geo-location for all users in same city, then after reverce geocoding the city & country, use those values (without any actual street address) with geocoding service to get the 'center' of the city.
The app I'm building needs to be able to match up users to events based on the city/town they're in. I'm still relatively new to Rails and completely new to Geolocation and using locations in an app. I'd figured on a design where users have one or many cities, and events would have one city which I'd hoped to extract without specifically asking the user for it, by getting it from the event address entered.
Mostly to provide some outside checking to help get the address entered correctly and consistently, but also to show a map, I installed this jquery address picker (https://github.com/sgruhier/jquery-addresspicker). Unfortunately the data returned by Google doesn't include a city but a "locality" or an "administrative area" that doesn't correlate reliably to city names. The localities being returned are more like what we in my home town would call "suburbs". What I need to procure is a city so I can allow users to search all events in their city rather than just the ones in their suburb.
Can anyone offer advice on how I could go about doing this? Many thanks.
Edit: Should maybe add that I'm wanting to do geocoding client-side so I don't run into problems with Google Maps limits or have to pay for geocoding etc.
There are some gems that provide you with that and may others geo related features, like calculating distances.
Here are the 2 most famous: https://github.com/alexreisner/geocoder and https://github.com/imajes/geokit
In the future I highly recommend you to head to https://www.ruby-toolbox.com/ to see what is available as a gem already and see what is the most popular at the moment.
For raw address info, use Google Maps API Reverse Geocoding which accepts lat/lon inputs and returns street address components. Modern browsers support location awareness (geolocation), with user permission, and will give you a lat/lon that "tends to be close" to where the browser is. That will probably get you a correct city/town in most cases.
The maps API is part of Google's broad suite of API tools -- there are gems that handle any Google API (well, most of them), or check out Google Maps for Rails, which will at the very least give you a good head start on how to use the API.
But if you're looking to validate postal code, this method will come up short, since the location awareness will vary in accuracy depending on browser, device (more accurate for mobile), the connection, population density, network coverage, and so on. Also, calling the
If you can get GPS-accurate lat/lon then it will be much more accurate ... except in some cases like in large cities, a single building will have its own postal code, so a few feet one way or the other might matter.
There are a lot of geocode services out there (like http://geo-autocomplete.googlecode.com/svn/trunk/demo/ui.demo.html for example) where user can write a location (or part of it) and it will be resolved to real existing location.
There is also a lot of info provided with the search result (like country ISO code, coordinates, etc..), but none of the services seem to provide country and city code.
What I mean is a code used to phone to certain are. For example Country code for Germany will be 49 and for city of Dusseldorf will be 211.
Is there any service, where I can get this info from the user input. Or is there any way to combine the two. For example I get city name from google geocode service and the try it on some city codes database. If yes, can anyone please provide me with links.
You can use for instance Yahoo's GeoPlanet. For more elaboration on services to solve your problem you might want to check out this answer on gis.stackexchange.com, which seems to cover the kind of service you need.