Location Based Application for iphone - iphone

I want to create an application which retrieves the latitude and longitude value of the current position of the iphone, give those values to some 3rd party server and gets details about that place, if possible show a map of that area on an imageview. I've done for the part of getting the locale information, ie to get the latitude and longitude value. I don't know about the providers those who are serving for the latter part. If anyone knows about this, pls help.

You can use the CLLocationManager class to retrieve longitude and latitude, then use a MKMapView to render it.

If I understand correctly you have the long and lat of the phone from CoreLocation and you want a server to retrieve some information from based on that location.
It's a bit of a broad question but here goes: If you want to build your own geo server, you should look at SimpleGeo. If you want to build something more complex, you are going to have to start building your own server. I would suggest Django-geo or if you have really specialised needs, the PostGIS extensions for Postgres as your foundation.
If you just want to build a simple test app, the Twitter geo apis are a good test bed.

In case you're working with the 3.0 SDK, this page may help you on your way.

Related

How to find the long and lat of a city on the iphone?

I am trying to find the long and lat of a city on the iphone. Say the user is searching for London, I would call some function that would retrieve the long and lat of London. I have looked on the web and found you can use a Google API but there must be an Apple function somewhere to handle this?
I have come accross the MKReverseGeocoder which takes the long and lat and tells you what city you are near. e.g.
// reverse geocode the user location
geocoder = [[[MKReverseGeocoder alloc] initWithCoordinate:mapView.userLocation.location.coordinate] autorelease];
If it can reverse the process there must be some form of MKGeocoder class?
but there must be an Apple function somewhere to handle this
Why must there be? Because there isn't.
There are a number of web services you can use (e.g. Google) or you could download a place name database such as http://www.geonames.org/ and import it into your app. It's probably best to import it into an SQL database which you can then search from your app.
See OpenStreetMap. It gives you more flexibility in accessing its data. You could pre-populate a CoreData store with the informations you need.
There are some api-clients, i.e. route-me or cloudmade.
The iOS5 SDK has added support for both forward and reverse geocoding. Take a look at at the CLGeocoder class class for more info.
First, give up that there "must be" an Apple way. There really isn't. If you don't believe me and my nearly 2k of experience points, listen to Ole and his 13k.
There are three services I've seen.
I tried Google's geocoding API. It's decent, but a bit complicated, and they throttle your queries pretty harshly.
Then I tried MapQuest's, which I found to be surprisingly excellent. I have two apps bound for the app store in the next month or so that use MapQuest's API.
Then I found Geonames, which I'm very impressed by but haven't had the opportunity to use yet. Note that Geonames DOES allow you to download their data, so if you really need network-free service, this might be a solution.
Apart from that, you're going to be calling something off the device. Which, by the way, you are when you use MKReverseGeocoder--that's just a wrapper around Google's reverse geocoding service.

Find Location of Iphone (GeoCoding)

I am using http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
for getting the location using Iphone.(It gives Latitude & Longitude)
Now i want the cities/zipcode based on these Latitude & Longitude in Iphone.
So please suggest me for the above.
Sample code/tutorial will be much better(if possible)...as I am very new to this Iphone development.
Thanks.
You can use the builtin MKReverseGeocoder class in UIKit. You will however have to adhere to Googles license terms, e.g. that you have to show the results on a Google map, etc.
Alternatively you can use the various services available from GeoNames, for your need especially the postal code lookup could be of interrest. They are provided both as xml and json formats. They have a lot less restrictive licens term than Google.

Displaying nearby businesses in mapkit

Is it possible to display nearby businesses in mapkit? If not, how else can that be done?
Is there a way to display by category - restaurant, retail, museums?
Also, I don't think displaying traffic flow is available. Can anyone confirm?
The current version of MapKit does not support such features.
It's main capabilities currently are:
a scrollable/zoomable map
reverse geocoding (get the address for some given lat/long coordinates)
add annotations (pins) at a given lat/long
show phone's current location
show Standard, Satellite, or Hybrid view
To display nearby businesses, you would have to:
query a third-party for that information which would ideally return lat/long coordinates
add annotations to the map using the returned coordinates
This is an interesting and emerging business idea!
I live in Nordic region and there is an open Mashups especially for sweden.
By open i mean, any one can request and get access to the content to find nearby Cafe / WiFi / Sushi restaurants etc..
BEGIN PLUG WARNING
Check my iphone application which fetches content from the mashups and display using MapKit!
END PLUG WARNING
And there is a commercial content provider called Info24 for nordic countries at the moment.
Like DyingCactus said, it's not currently possible without using your own calls to one of the mapping service providers. There are options available, though.
One of them is CloudMade. They have a good iPhone library and support almost all of your requirements.
Check out the API at Cloudmade.com
I know this thread is kind of old, but i figured out a free alternative to do what you are looking for, more or less. You just nee to tap into a maps.google.com service and get a kml or JSON output. I used KML (XML) becuase i found the filesize to be consistently smaller. I wrote a 3 part series on my blog about how to do this for anyone that is interested.
http://www.zen-sign.com/finding-business-listings-and-displaying-with-mapkit-part-1/
http://www.zen-sign.com/finding-business-listings-and-displaying-with-mapkit-part-2/
http://www.zen-sign.com/finding-business-listings-and-displaying-with-mapkit-part-3/

find nearest places in iPhone

Hello all iPhone developers,
I am developing an iPhone application.
In this application i want to find nearest places related to current CLLocation that I am getting from the iPhone device.
I have currently a database in different server .
I am accessing it via .NET web service.
In the database for testing purpose i have created some records with fields of latitude and longitude that I have taken from google maps.
Now ,My Question is that:
How can I determine that the location in the database is near by( within a range of kelometers) the current location ?
I have my options as below:
if
i have to get a address based and currentLocation.latitude and
currentLocation.longitude and pass it
to the service where i compare it
with the available address ( i have
read somewhere "geocoding").
else if
i can pass the latitude and longitude directly to the web-service
and do (what type of i want some
suggestion if any one knows) some
calculations there and give back the
nearest places data back to iPhone.
else
or this solution is completely
logical and if anyone have solution
reagrding it or a tutorial then it
will be useful.
It's true, there are a lot of reverse geocoding services out there (Google, Yahoo!, GeoNames, etc.) to convert from a lat/lon pair to a street address.
But if you have lat/lon pairs in your database already, then I don't think you ever need to convert to a street address. Calculating distances is much easier if all your points are represented by lat/lon, you can use the Haversine formula.
And in fact, if your database natively supports spatial types (for example, MS SQL 2008 appears to), then you can push that calculation into the database layer and not have to worry about it. That seems like the right approach to me: have your iPhone app send lat/lon to your web service and have the database calculate the nearest points-of-interest.

Perform reverse geolocation lookup

I'm pretty new to iPhone SDK and Cocoa development. I'd like to know how to call a web service which will take the lat and long values from my iPhone and feed them to a webservice so I can retrieve the City,State. I already have the phone location stuff squared away. I'm only looking for where I should pass this info to and how I can parse this data back into my app.
Essentially, I only want "City,State" to be visible in a label on one of my views.
The first time I tried this was with geonames.org and it put my returned lat/lng location in the middle of nowhere many many many miles from where I actually was. I tried the same lat/lng values with google maps api and it was in the right place. The only problem I've had is parsing the JSON data back into my app. The returned info seems to have multiple versions of the same info which I can't seem to understand how that works.
So once again. Just looking for a simple HTTP style string I can pass somewhere with my lat/lng values and it returns "City,State". If the example you mention involves parsing data. Please refer to an example I can dissect - I'm a noob.
Oh and one last thing, I know this was made possibly easier with the iPhone 3.0 SDK but I'm currently building this project on 2.2.1 - and for more than enough reason HAVE to do it this way until the rest of the app is ported to 3.0.
Look at the replies here and here