Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-01-2009, 01:51 AM   #1 (permalink)
New Member
 
Join Date: May 2009
Location: St. Louis, MO
Posts: 17
Newbie09 is on a distinguished road
Question CLLocation - getDistanceFrom

Is anybody using this Class?
Here is my problem
<CODE>
CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:+29.640426 longitude:-090.599039]; //70301
CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:+38.637002 longitude:-090.650024]; //63005

double distance = [loc1 getDistanceFrom: loc2] / 1000;

NSLog(@"Distance between CoreLoc 70301 & 63005 = %g", distance);
</CODE>

Distance = 999.756

This returns a different value than google maps.

from: Chesterfield, MO 63005 to: THIBODAUX,LA - Google Maps

All in Kms. Is there a way to increase the acccuracy?

Thanks
Newbie09 is offline   Reply With Quote
Old 06-01-2009, 10:36 AM   #2 (permalink)
Registered Member
 
Join Date: Apr 2009
Location: Reading, UK
Posts: 50
kendolondon is on a distinguished road
Send a message via MSN to kendolondon Send a message via Yahoo to kendolondon Send a message via Skype™ to kendolondon
Default

Google maps is giving you the actual road distance travelled between the two locations whereas CLLocation is giving you straight line distance between the two.

I don't think there's anyway of getting turn-by-turn directions (and hence road distance) between two points in CLLocation and that's not supported in V3 either.
kendolondon is offline   Reply With Quote
Old 06-01-2009, 11:54 AM   #3 (permalink)
New Member
 
Join Date: May 2009
Location: St. Louis, MO
Posts: 17
Newbie09 is on a distinguished road
Exclamation

Quote:
Originally Posted by kendolondon View Post
Google maps is giving you the actual road distance travelled between the two locations whereas CLLocation is giving you straight line distance between the two.

I don't think there's anyway of getting turn-by-turn directions (and hence road distance) between two points in CLLocation and that's not supported in V3 either.
Thanks kendolondon. Yelp Apps - Does it mean that the distance provided in Yelp's restaurant search is just a Straight distance? I just compared the distance between Yelp's distance and Goolge maps distance. They are way off. How does this sound? May sound stupid, but no other go. Can I increase the straight distance by 10% to derive the road distance?
Newbie09 is offline   Reply With Quote
Old 06-01-2009, 12:23 PM   #4 (permalink)
Registered Member
 
Join Date: Apr 2009
Location: Reading, UK
Posts: 50
kendolondon is on a distinguished road
Send a message via MSN to kendolondon Send a message via Yahoo to kendolondon Send a message via Skype™ to kendolondon
Default

I'm not familiar with Yelp's App but, at a guess, they're probably querying a database that's off the device and the results are being returned with the distance already calculated - that's how I'd do it anyway! They could be using any method to calculate the distance although I doubt that they're doing a full route plan for every hit as that's quite a lot of processing just to get an accurate distance!

Whether adding an arbitrary 10% is a suitable option really depends on your application. You'll probably tend to find that the error between straight line and road distance actually increases the closer together the two items are. For example, in my town which has a large number of one way & pedestrian streets, getting to a location that's only 1km away in a straight line could easily be 2-3km by road! As you get up to 'big' distances, however, the percentage error is likely to become smaller.

I suspect most applications display their search results based on straight line distance and then compute the actual route distance only on demand so users are going to be used to this behavior.
kendolondon is offline   Reply With Quote
Old 06-01-2009, 01:06 PM   #5 (permalink)
New Member
 
Join Date: May 2009
Location: St. Louis, MO
Posts: 17
Newbie09 is on a distinguished road
Smile

Quote:
Originally Posted by kendolondon View Post
I'm not familiar with Yelp's App but, at a guess, they're probably querying a database that's off the device and the results are being returned with the distance already calculated - that's how I'd do it anyway! They could be using any method to calculate the distance although I doubt that they're doing a full route plan for every hit as that's quite a lot of processing just to get an accurate distance!

Whether adding an arbitrary 10% is a suitable option really depends on your application. You'll probably tend to find that the error between straight line and road distance actually increases the closer together the two items are. For example, in my town which has a large number of one way & pedestrian streets, getting to a location that's only 1km away in a straight line could easily be 2-3km by road! As you get up to 'big' distances, however, the percentage error is likely to become smaller.

I suspect most applications display their search results based on straight line distance and then compute the actual route distance only on demand so users are going to be used to this behavior.
Hey kendolondon. Thank you veru much. I just checked few apps that shows distance and all are straight line distance. I think I am gonna go with this approach until Apple comes with a Maps API that will give the road distance. Thanks a lot

Last edited by Newbie09; 06-01-2009 at 01:07 PM. Reason: added API
Newbie09 is offline   Reply With Quote
Reply

Bookmarks

Tags
map

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 339
5 members and 334 guests
givensur, ipodphone, jbro, mer10, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,881
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:10 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0