Search the web
Sign In
New User? Sign Up
yws-maps-ajax · | Yahoo! Maps Ajax API
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Distance Calculator   Message List  
Reply | Forward Message #214 of 255 |
Distance is so wrong in YGeopoint....

Finally: a bright moment. the "distance" method has property "kilometers",
"miles" etc. according to the manual.
So:

var g1 = new YGeoPoint(52.4264895, 4.8389139);
var g2 = new YGeoPoint(52.3539378, 4.9302562);
var d = g1.distance(g2);
alert(d.kilometers);

This works, but is SO WRONG!!! According to the lon/lat's of the two geopoints
(which I retrieved by using:
http://developer.yahoo.com/maps/rest/V1/geocode.html), the distance from my
office to HQ is about 10 kilometers, while in fact it's almost 20 (about 19.5)!
Am I doing something wrong here (probably!).

If so, can anyone point me in the right direction, cause it looks like the
Haversine formula was used, which is never too accurate.

Too bad this forum does not seem to be a very active one, and pretty sure that
Yahoo will never respond themselves....

--- In yws-maps-ajax@yahoogroups.com, "connectcasenl" <cees@...> wrote:
>
> So far, I came up with:
>
> var g1 = new YGeoPoint(52.426520,4.839082);
> var g2 = new YGeoPoint(52.354187,4.929902);
> var d = g1.distance(g2);
>
> I just want the var d to be outputted, but don't know how. It keeps telling me
it is an object.....
>
> --- In yws-maps-ajax@yahoogroups.com, "connectcasenl" <cees@> wrote:
> >
> > Hi there,
> >
> > anyone know if it's possible to create a distance calculator with the Ajax
API? Been searching the Developer Network site all night long, but I could only
find that it's possible with the AS3 API.
> >
> > Regarding the Ajax API, there is a YMapDistance-constructor, but that seems
to be some sort of convertor....
> >
> > What I want is basically: enter two adresses, calculate distance and output
that in a div. Preferrably no loading of any (graphical) maps.....
> >
> > Thanks for any points into the right directioN!
> >
>





Tue Mar 24, 2009 12:46 pm

connectcasenl
Offline Offline
Send Email Send Email

Forward
Message #214 of 255 |
Expand Messages Author Sort by Date

Hi there, anyone know if it's possible to create a distance calculator with the Ajax API? Been searching the Developer Network site all night long, but I could...
connectcasenl
Offline Send Email
Mar 23, 2009
7:20 pm

So far, I came up with: var g1 = new YGeoPoint(52.426520,4.839082); var g2 = new YGeoPoint(52.354187,4.929902); var d = g1.distance(g2); I just want the var d...
connectcasenl
Offline Send Email
Mar 24, 2009
8:19 am

Finally: a bright moment. the "distance" method has property "kilometers", "miles" etc. according to the manual. So: var g1 = new YGeoPoint(52.4264895,...
connectcasenl
Offline Send Email
Mar 24, 2009
12:49 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help