Conversion to and from Cartesian Coordinates
Page 1 of 1

Author:  bolaboy [ 22 Sep 2018, 19:18 ]
Post subject:  Conversion to and from Cartesian Coordinates

Hey guys,

I'm not sure exactly where this belongs, but I'm trying to externally insert bookmarks into the bookmark file, but it looks like they need to be in cartesian format. I've been digging around, trying to find the formula for converting to and from cartesian, and I think I found it in transform.c ( ... #L264-L304), but I was trying it out, and it wasn't matching the examples given on the "Coordinate format" page ( ... ate_format).

Here's what I tried:
0x13a3d7, 0x5d6d6d -> 1287127, 6122861 == 48.82356, 11.345252

lat = navit_atan(exp(c->y/6371000.0))/M_PI*360-90 = atan(exp(6122861/6371000.0))/PI*360-90 = 48.1373
long = c->x/6371000.0/M_PI*180 = 1287127/6371000.0/PI*180 = 11.5754

Which is close, but not great. I also tried it with coordinates automatically put in the bookmarks file and it was off by a ton. I don't have access to those numbers right now, but I'll post a comment later, when I do.

Am I doing something wrong? Is there a different formula out there, or am I missing a step beforehand?

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group