Where to start... location awareness? - geolocation

I'm working on a restaurant reviews app and I'm not sure what to use for location awareness.. I am developing it in ruby on rails. What I wan't it to do is have the ability to search for places nearby a user's entered location or guess the user's location based off their ip address as well as off of geo coordinates or w/e too. Honestly I don't know where to start anyone have any good api / gem / article suggestions?

Check out the geokit gem for the backend, and the WC3 Geolocation API for getting location info from users.

Related

What is the best way to show location in Rails 4 app?

I'm building an app for a client. The client want to be able to display street map with its location on the contact page.
I've never used maps in a web app before and I've been googling around.
there are so many options to use and I´m not sure which one to use.... this is just for displaying the streetmap, with a pin or something at the address, nothing too fancy.
should I use geokit-rails?
or rubygeocoder?
or Google Maps API?
or is there something else I can use?
what do you guys/girls recommend?
any suggestions would be great
thanks in advance
D
I use gem geocoder which I like. Just gem install geocoder. It supports geocoding and reverse geocoding, distance queries, rails 3-5. It is on github and website is here
Try gmaps4rails gem.
It is simple and easy to intregrate in rails application.
Check the Docs here.

Proximity Based Search without user location swift

I'm working on an app which utilizes Google Places API in order to find locations based on a users search. I've implemented the search with the help of the UIAutocomplete (Google Places), but unfortunately, it is not location based (until the user provides authorization). I was wondering if there is a way to get the users location through their IP address or otherwise using Swift. I don't need a precise location, the city would be enough.
I've searched for a while and there doesn't seem to be any other way of doing this, so if you know of an API which can return the city the user is currently in, that would be great.
Thanks for all the help,
Vlad
I don't think the system frameworks allow you to get the user's remote IP address anymore. A solution for you might be to use a website like http://mylocation.org/, which shows your IP address and location. Perhaps you can make a request to this website and parse out the HTML that comes back to get the location. Please note, this isn't the most accurate way of getting the user's location and you would be much better off using the CoreLocation framework.

Geolocation and getting a city from an input address (Rails)

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.

Google Maps V3 Geolocation Rails 3 gem 'geocoder' addresses not correct

I'm using Google Maps V3 and it's not only having trouble getting exact geolocations, it's sometimes not finding the correct city (even missing by more than 50 miles in some cases).
The way I'm using google maps is in my Rails 3 app with the gem 'geocoder'. I feel pretty sure it's not the geocoder gem that's causing google maps to be off, I think I've had this problem in google maps V3 before.
My question: is there a better experience for determining the user's location? Should I use the browser's built in geolocation features? Or should I be using a combination of Google Maps Geolocation and the browser's geolocation functions?
I imagined a scenario where I could ask the user if the town was correct, and if not they could enter their town, then store their town in the database, but it seems like a poor user experience. I hope to make this a app on mobile devices in the future, where it wouldn't be much of a problem, but for now it's a web app.
Anybody else have a good system for dealing with apps that rely on a user's location? Thanks!
I ran into the same problem with Geocoder. For me it appeared to not interpret the address correctly in certain cases. If I sent it '250w 450n' as the street address I would get back the coords for *formatted_address":"250 E 450 S,*. If I sent '250 w 450 n' I got back the exact location I was looking for. Try checking the json response you get back from Geocoder, it will tell you "partial_match":true,"types":["street_address"]}} if it "guessed" at something, and you can check the returned *formatted_address* to see what it came up with.
you can use their website as a quick check on what response you would get for a given address string.

How to scale a geolocation web application

I am building a geolocation web application and I am really in the blur how I am going the handle the geolocation.
Briefly my app lets you create adverts on a specific city. The idea is to avoid the basic form with the city name, zipcode, country and just have an autocomplete field based on the city name.
I have a few idea how to handle that but I am not sure which one is the best.
There first one is to get a world cities database from maxmind (3M cities) and select from my database.
The other one is to use YQL and the geo API from yahoo...
I really don't know what is the best practice for this kind of app...
Greg
I have done some geolocation using the geokit plugin and gem. It works well with multiple geolocation providers (google and yahoo).
https://github.com/andre/geokit-gem

Resources