How to get latitude and longitude of a city? - iphone

I am designing a project in which I have used two text fields. One is for source address and another one is for destination address.
Now, I want to get latitude and longitude of both addresses and then draw it on map view.
How can I accomplish that?

check this post for geocoding
http://fredandrandall.com/blog/2011/03/23/geocoding-on-the-iphone-getting-the-latitude-and-longitude-of-an-address/
How do I do geocoding (NOT reverse geocoding) on iPhone?

Do check out SVGeocoder. It's able to perform both forward and reverse gecoding via Google API. Not to mention it's also very easy to use.

Related

How to get address,city name from longitude and latitude in iphone

How to get location details from a longitude/latitude value? Is there anyone who can help me with this situation.
You can use CLGeocoder to get the details from latitude and longitude.
Check out the CLGeoCoder Class Reference
You should take a look at a MaxMind GeoIP API available for many languages:
Here
Take a look at the google maps apis reverse geocoding functionality.
https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding
you would make a request like this:
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true
and receive a json encoded object containing a guess on the address (including city of course)
This is called 'reverse geocoding', see http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKReverseGeocoder_Class/Reference/Reference.html

reverse geocoding on the IPhone - getting exact street numbers

We are building a series of applications for the IPhone (IOS5), where we use reverse geocoding. Most of the time, CLGeocoder returns a range for the address number (eg. "someaddress 2-5"). We want to retrieve the exact street number for every reverse geocoding request.
As I have come to understand, this is not controlled by me as a developer but rather by Apple, which makes a call to Google and returns the results (the range of street numbers). Has anybody else encountered the same problem and found a solution?
One solution I was advised to do is purchase the google maps API for business. In its documentation it states that it offers "advanced geocoding", but no details are given for reverse geocoding and street numbers. Has anybody had any experience with this API?
Another thing that comes in mind is to use some third-party service that does reverse geocoding. But the thing I am not sure is if Apple will accept it. Does anybody has to suggest a third-party service that does reverse geocoding and returns the exact street number for a given position on the map?
Thank you in advance
It looks like GeoNames would fit your needs well.
From the Wikipedia page:
GeoNames is a geographical database available and accessible through
various Web services, under a Creative Commons attribution license.
I myself have been using CLGeocoder, and haven't experienced any issues with it returning a range of street numbers.

Google Maps API: Requesting any place labels given longitude and latitude?

I am working on an iPhone map application and wanted to know whether it was possible to request any labels visible on Google Maps given a longitude/latitude and radius?
For example if I gave the following location to this Google Maps API, I would get back McCullough Hall, Moore Hall, etc. The list would be any place labels visible on the map (doesn't have to be just restaurants, businesses).
If this is possible can you direct me to where I can learn more about this. If this isn't possible, can you direct me towards another API where it is possible?
Look into Googles reverse geocoding, I think that's what you're looking for.
The short answer, you cannot!.
The only way is to search for places by name and get a reference key to query the place details including lat/lng. Not the other way around.
IMHO, this is mainly a policy of Google instead of being technical limitation.

how to get latitude and longitude from the address in MKMapkit?

I have implemented one application .In which i want to get latitude and longitude from the address.I dont want to use java script.Is it possble then please help me.
AFAIK, MKMapKit does not support this.
MapKit has no geocoding support (only reverse geocoding) but Google offers a HTTP Geocoding service that's very easy to use – assuming you comply with their license terms:
Note: the geocoding service may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited.
Use the example from Apple’s «Location Awareness Programming guide: Geocoding Location Data» to pinpoint your location on the map, then call Google Geocoding Service (post a request, parse the result json/xml data) to get the address.

iPhone development - Locate address from user's position

Is it possible to get the street/area where the user currently is by using the CoreLocation framework? So if I get the user's longitude and latitude position, can I get the address (xx street, yy city, z state) from that position?
Thanks.
Someone had already posted the question before. Just found out Get street address at lat/long pair
What you would need is a reverse geocoding service, that will translate a lat/lon coordinate set in to an address. I doubt that this, or access to one, is included in CoreLocation.
You could look into a third-party provider such as Google Maps:
http://nicogoeminne.googlepages.com/documentation.html
There are also other work-arounds that might get you close. For example by using Multimap's routing API as described in the following:
http://forums.multimap.com/viewtopic.php?f=1&t=51
Agreed - you need a reverse geocoding service - this is not included in Core Location. There is a fairly complete list of reverse geocoders here link text