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.
Related
I'm attempting to retrieve locations around a user upon retrieving their current location. Is anyone familiar with which API's/Frameworks are best to accomplish this? I've tried Foursquare2 but it seems that half the locations don't return addresses. I need a better API to use, preferably one that will return addresses, and can't seem to find any others. I came across Google Places, but it appears to be in beta and not available unless I submit a form and wait. Is there a way to do this with Google Maps or the Facebook graph perhaps?
Depending on which device you use. For example if you want to retrieve location data from android use this api, for an ios device, use read the my location section in this doc. Hope this gives you some idea.
I need to implement street view, but it seems that google does not have that capability for India.
I want that The map should be dynamic and the customer should be able to see point of interest near a specified point and within a given radius or zip code.
I need to geocode and reverse geocode
Can somebody share an idea and one quick example of this.
if you want to get places of interest near by some location, then I would suggest using HERE PLACES API for that task. The site should also include nice examples for the API. Also its simple REST API, so it would work in any platform really.
I am developing an iPhone app for iOS 6.1 or later. I would like to have a feature that would provide the user a list of addresses that are nearby. I know I can use a geocoder with a reverseGeocodeLocation call to get the address of a specific latitude/longitude. But what I need is not just that address, but also, a few (maybe 10) addresses that are near that address.
The MKLocalSearchRequest doesn't seem to support any kind of search request that would return that information. (I am not searching for hotels, or restaurants, etc., just any valid nearby addresses) Does anyone know of a way to do this?
There's no API for that, the only thing I can think of is using a for loop and increasing manually latitude/longitude and reverse geocoding.
After doing more research into other map API's from third parties (Google, Mapquest, Bing) I have still been unable to find one that provides this functionality. The answer to my question therefore appears to be that it currently can't be done. The only solution to my problem was to have a complete list of addresses geocoded in a database. (Fortunately for me, my organization has such a database available.)
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.
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.