How do I update a MapView with an address? - iphone

I want to update a MapView in an iPhone app. Using a geocordinate, this is trivial. But what if I don't know the coordinate? I want to update it using an address string, like you would enter in the text box of google maps.
To give a little more background, in my app a MapView is displayed with the user's current location. After the location is retrieved, I use the ReverseGeocoder to translate it into a human readable address, that is displayed in a TextView below the map.
But the location is often wrong - this app will mainly be used in New York City and the iPhone GPS is often inaccurate here (due to tall buildings?). In this case, the user can tap the text view and put in the actual address. At this point, I want the MapView to update with the address they entered. But it's not obvious to me how to make that happen.

The iPhone SDK doesn't provide that functionality. You will need to use a geocoding service like Google Geocoding API.
Google API provides an HTTP service to look up geolocation. For example, to determine the location for Google headquarter, you can query
http://maps.google.com/maps/geo?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&output=csv&oe=utf8&sensor=true_or_false&key=your_api_key
You can also change the results format.

Related

iOS: ReverseGeocoding Using CLGeocoder Vs. Google Geocoder API

I am building an iOS application that in one of its functions implements reverse geocoding for obtaining street addresses from user gesture tap on a map.
When running the app using CLGeocoder's reverse geocoding features, I was only able to get the city and country details. In some cases in main roads I was able to get the main road name.
I thought that this limitation is from the Google Maps api.
But when I tested this example, (http://gmaps-samples.googlecode.com/svn/trunk/geocoder/reverse.html) I was able to get much more accurate and detailed information such as street number and name and zip code.
Is this a limitation of CLGeocoder? if so, how can I implement the Google Maps api on my app?
It's my understanding that CLGeocoder has not used Google for data for around the last year; When it did use Google there was a substantial limitation on number of users per day.
You may also want to try the same CLGeocoder call in an iOS6 simulator to see if you get more data.
You could use the Google API calling directly from your app, but be carful to read the TOS for limitations in regards to users.
Well, it would appear that yes, Apple's CLGeocoder is nothing like as accurate for forward geocoding (address -> coordinates) as the Google Maps Geocoding API, particularly outside of the USA. Using an Address Dictionary with all the fields filled out as fully as possible works a lot better than a simple address string, but it's still no where near good enough. Where Google will (usually) give you coordinates within 5-10m of the street number, Apple will give you coordinates somewhere in the right street, if you're lucky.
Found Apple Developer Technical Note TN2289 which details Supported Countries for CLGeocoder.
Further iOS6 would stop the support to use of Google Maps

Covering a MKMapView with an image

I want to create kind of a map view, just without the map..
Sound strange? I'll explain - I have a bunch of coordinates representing users location that I want to show on screen with there relative location from one another and from the user location (in center of the screen). But I don't want to show the map itself because I don't won't to expose the real address for privacy issues.
The map should look something like this:
I though of using the regular map kit so I have all of its functionality but I'm not sure how to do that. and I'm not sure if this is a violation of the google service license...
Any ideas?
You might want to consider to just ignore the mapkit and go with just location and images as pins. You can easily calculate where a person is standing in relation to another by just the longitude and latitude. it is not a violation of the terms as the gps from the iphone has nothing to do with google. Only the actual maps do.
(however if you are using google api related stuff without showing a map it might be a violation, for example you cannot query for altitude to google itself without showing a map. But then again the phone's gps gives you the altitude.)
Well, First of all it will be the violation of Google, as MKMapView by default will query map tiles from Google server behind your hidden Overlay. So don't do that,
What I would suggest is to look into third party customize map solution for iOS. Something like MapBox.
See : MapBox
iOS SDK of MapBox : SDK
In which you can customize the color and look and feel of your Maps and location. There are paid option and free options too. Regarding the privacy issue I suggest you shoot an Email to MapBox people and ask if you can just hide the street names from the App.

google maps in UIWebView passing data from core

I want to use to UIWebView to display google maps mobile website for my app. However; I need the current user location to be passed into the webview so that it may show a route. What steps must I take in order to not only pass the current location to the google maps url but also pass what I want it to route(for example, Costco)?
Second, my app is going to be a paid app and I was wondering if it is even possible to use google maps due to this? The app does not only have gps but other sections as well that I created myself.
Thank you so much
I think you dont want to show google-maps in an UIWebView. You should use either the MapKit-Framework or any other maps-framework like for instance route-me.
In both framework it is possible to draw polylines (links: MapKit, route-me) (which represents a route) and any other stuff like pins and a bubble with a circle around it which indicates the current location (links: MapKit, route-me (should be somewhere in the sample-programs)).

geo location and blocking access to my app on iPhone

I am working on a radio player for iPhone.
What I need is to provide my position before playing stream.
I am thinking of using CoreLocation, it's ok, but how to determine geo position if user does not allow CoreLocation when asked ?
What would be the best way to determine the position of the iPhone?
I was thinking of getting IP address, but it could be an address from another country. For exemple, user has an iPhone account in United States, and is using my application in 3G in Canada, IP address will be provided by his cell carrier right ?
So I was wondering how to get cell carrier name, without success... using a private framework is not possible.
I am waiting for your great suggestions!
thierry
I would just use core location. If for whatever reason the user declines the core location popup, then just prompt them to enter their location manually (e.g. choose country and city).
You could use the IP address, but then you run into other problems as well (for instance if they are using WiFi on their iPhone or are on an iPod touch.
I think this is not allowed, and by design. If the user doesn't want your app to know where they are, why do you think you have the right to ignore their wishes?

Is there a way to place a pin into the google maps iphone app using openURL?

I would like to create an iPhone app that can open the google maps app and place a pin on the map.
I have the exact location of the pin, specified by its longitude and latitude.
I also have a name for the pin e.g. 'location 1' that should be displayed along with the pin.
I know that UIApplication:openURL can be used for this but I don't know the exact url format.
So, is there a way to do what I described above? If, yes, what is the correct url format?
You can use a URL of the format: http://maps.google.com/maps?q=Your+Location+name#latitude,longitude
http://maps.google.com/maps?q=This+is+near+Lake+Shore+Drive#41.9288,-87.6315
You can drop up to 100 pins using KML. There is an example of this on http://appsamuck.com look at the example for day 8 (http://appsamuck.com/day8.html)
Why should your user have to exit your app to see a map. You can embed a Google map in your application easily. You can even drop multiple pins for which you have lat & long information.
In fact, in my opinion your user should never have to leave your application to view a google map.
An example of how to do this is included as an example application at https://sourceforge.net/projects/quickconnect/.
Download the QuickConnectiPhone zip file and you will find it in the Examples directory.