I know this question has been asked but most answers were a few years old and not all for a Ruby on Rails project. In my current project, I am using the Geocode gem (via Ruby on Rails) and anyone is able to search users by their location (which I also use the Carmen gem for country, subregion).
Anyway, I've been receiving this issue lately (Google Geocoding API error: over query limit.). After reading up on it, I see that this is quite common. Most of the resolutions seem to involve caching but others say that it does not work much/well.
I wanted to pose the question to many here and see what various people think is a good resolution. Ideally it would be great to keep the Geocoding gem within the project, but if it is not worth it, please let me know of an alternative. If you know of a resolution to this issue, please let me know too.
Thank you and simply looking to receive feedback for this situation =)
PS: I do not use the Google Maps API. The project is setup so that a user enters their information (using Carmen gem) and typing the cit. The location is geocoded and others can type in a city, state/region to find users within that region.
EDIT
Additional Question: When this limit is met, would that also cause the longitude and latitude value to be nil when a user signs up? Since it is as the limit, it will not geocode the location entered and so it keeps the value at nil? I've had this happen before so I just want to make sure this is why =P
EDIT 2 - ANSWER?
After speaking a bit (in comments below), it seems the best option is to cache the information. With that being said, after researching I see that there are a lot of legalities when it comes to caching with google? Again I do not use the Google Map API so the legal aspect may not be relevant?
Would this be a good solution to implementing the cache (https://github.com/codeforamerica/ohana-api/wiki/Customizing-the-geocoding-configuration)?
Just want to make sure I implement the cache aspect properly =P Thanks!
Joe
ANSWER
So after some research and help from japed (see comments above), I found this documentation (https://github.com/codeforamerica/ohana-api/wiki/Customizing-the-geocoding-configuration) which clearly explained how to setup Redis with Geocoding for caching purposes. It also provided another link with more information to test it in development before deploy.
Thank you!
Joe
Related
Hi I would like to implement a function in Rails that serves both to have an autocompletely of the location (I saw that I need the Google API but I have not understood how to do this specifically) and I would like to implement a function for which it suggests a current user list of "nearby" users based on the location they have chosen as their residence.
Can you tell me which gem to use and if there is any example of similar use?
Your question is very vague, and we are not going to code everything for you. You should at least have a look at the google-maps gem https://github.com/zilverline/google-maps
and read the maps API docs
https://developers.google.com/maps/documentation?hl=en (for Places, Maps, Routes etc...) to see if you find anything that could work for you.
You can also search StackOverflow first to see if you find anything interesting as well!
Maybe once you started coding or understanding some concepts you can come back with a less vague question and we will help you!
So I am writing a rails application for my friends food truck business.
The functionality that I am trying to create with this specific application is the ability for him to update the google map by posting a Geo-location tag on twitter.
A lot of the ruby gems that deal with google maps seem to be depreciated so I'm a bit lost at the moment. If anyone could just point me in the correct direction I would appreciate it.
I realize that this feature is just a quality of life feature but id like to be able to do it with embedded ruby and not have to break out the JavaScript (ugh). Ideal this kind of automation would be great for this particular type of website because my friend won't always have access to the back-end of the website when he is on the move. (Already able to update a map from an admin backend but its not good enough for a business that moves multiple places in a given day.)
anyways, thanks in advance. (if anyone wants me to post any of my code I will.)
So after reading your question, I thought it would be fun to tinker with the Twitter API again since I haven't used it in a while.
I went ahead and created a sample application for you that basically does what you were asking for. It looks for recent tweets from a user, grabs the latest one, then updates a Google map with a marker on that location.
Keep in mind that this was quickly thrown together, so it's far from perfect. But all the concepts should be there!
Feel free to reach out if you have any questions about the app or anything else. I'm always happy to help.
I'm working with rails, geocoder and gmap4rails. Trying to figure out how to show boundaries of an ward district area in UK. Found mapit - Mapit by mySociaty . Would be amazing if anyone could suggest or point me in the direction for creating a similar functions in rails. I'm especially interested in functions like 'Touching this area' as showed in the mapit.mysociety.org site.
Google maps also show boundaries of an area e.g. google map example Shows boundaries for 'Roath' area. is there anyway retrieve that data from google ?
I also tested a lot of addresses with geocoder, looking up in google. Tried to Geocode from address administrative_area_level_1 2 and 3 as well as in locality or sublocality.
The results were very unreliable. Tried at least 20 addresses from birmigham city - only some of them returned administrative_area_level1,2,3 or locality or sublocality and most of the time it was wrong data.
Another website that is sort of showing ward areas with in a city is www.streetlife.com I think it only works for UK users. basically it takes a postcode from a user and then in their map they show users district and other district around it, which is pretty cool :) Does anyone know how it works ? or how to get something like that working in rails ?
I would really love to discuss this topic in more depth and figure out the best answers for it.
This question at gis.stackexchange is probably of use to you if you wish to use rails. The "touching" feature is fundamentally a PostGIS query, so you could build on top of anything that allowed you to make SQL queries to a PostgreSQL database - GeoDjango (on which MapIt is built) makes this nice, but you could certainly accomplish the same in rails with work.
You won't be able to get those boundaries you see out of Google Maps, I believe, as it's proprietary.
Geocoding is a separate topic - you may want to look at things like OpenStreetMap's Nominatim (MapQuest have a version) or GeoNames, which could supply a dataset you could use with geocoder - Ordnance Survey also publish GB datasets that could be of use.
Currently I am building a rails application using the gmaps4rails gem. I have only been working on this for ten days,
http://greenearth.herokuapp.com/
I apologize I only have one dyne up so it may be quite slow on heroku.
I understand that the gem interacts with google js api v3 for me. Basicly I am making an rails application where I want to display trash bins locations on a google map. I have a table with an address as a column in the table, the gem allows me to take the address column and spit out markers on a map. I have to query all the address, translate them to json with a method provided by the gem (and its added to my model), then bring it out to my view. It will generate the required javascript.
I am quite tempted to switch to the geocoder gem because its a lot better documented. This gem just isn't well documented. I can't find questions on stackoverflow related to this gem.
My next step is to add a feature, where anybody can put in their most immediate address on a form and the map (google api) will calculate which of my trash bin location is nearest to this input address.
The gem's wiki is not well documented. I am not quite well versed with the google map api. In the mean time can someone point me to the correct tutorial? or the right direction?
After looking into it a bit more it seems the developer (apneadiving) is actually quite active, just not in the same place, see these guides on features: http://www.youtube.com/watch?v=Yg5-33zedqM
There is a second video as well.
Looking into it further I can't see a method in the documentation that calculates distance.
I recommend trying this tutorial:
http://briancray.com/posts/how-to-calculate-the-distance-between-two-addresses-with-javascript-and-google-maps-api
Or just following the Distance Matrix service from Google.
I haven't tried to use these alongside the gem so you may have to change the code based on existing variables. It should* be easier because you have addresses and Lats/longs saved already.
Also have you set the App to initally geolocate the user?
I'm working on a similar issue myself so will update when I get there.
OK so after looking at the different gems I would recommend using both geocoder and gmaps4rails to achieve what you want. I would recommend gmaps4rails for the map rendering and marker addition and to use Geocoder for the distance calculations. Unfortunately neither gem is fully comprehensive in these features.
There is a good railscast on how to display nearby locations via a form using geocoder: http://www.youtube.com/watch?v=mUvGAcaW3bA
The method in geocoder is simply:
#address.nearbys(20)
Where '20' is a radius within which results will be displayed based on your other entries. Alternatively you could grab the user's current location using:
request.ip / request.location
Declare this as a variable then display nearby bins results in the show view (covered in rails cast). Just note that current location will not work in test/dev environment because of the webrick address as it says on the gem's homepage.
Hope that helps!
Are there any ways to get information about different places (cities, mountains, rivers , etc) via latitude/longtitude?
I'm planning to use it in my rails project.
Of course, it will be perfect to use information from wiki. Any example of searching over wiki via lat/lon?
May be any other technology/website/api?
You may also check the Geocoder gem to find address by latitude and longtitude. Then you can use wiki api to find articles, like this:
en.wikipedia.org/w/api.php?action=opensearch&search="place_name"&prop=info&format=xml
Or, maybe wikilocation will help you
Check out the Open Street Map API http://wiki.openstreetmap.org/wiki/API They tend to discourage read-only queries, but you can probably find someone else's API for that data.
Also check out http://www.gisgraphy.com/ They have a free webservice here http://www.gisgraphy.com/documentation/user-guide.htm#geolocwebservice that looks like it has what you are looking for.