1 year ago
#369306
Ecko
longitude and latitude to position on map
I'm trying to implement a function, which takes a pair of longitude and latitude values and calculates a position on a map. It's a map of Germany as an svg . So when I google the longitude and latitude values of Berlin, I want it to show me the position of Berlin on the map.
So I'm having the coordinate-system of the map, it's origin beeing in the top-left corner. Than I'm having the longitude and latitude coordinate system (see ) which, has its origin to the bottom-left.
My Idea was as follows: Flip all latitude values, so that the ll-coordinate-system is flipped on the x-axis. Then subtract the longitude and (negative) latitude from the origin of my map, to align both coordinate systems. Then calculate a transformation Matrix by knowing the longitude and latitude coordinates of to points on my map and solving the linear equation system. My problem: The Matrix calculates coordinates on the map, which are off by 24 or so. So it seems to work somehow, but it's not that precise. It seems there are some errors on the way or my measurements were off. It was really tricky to measure the anchor points. Is there an easier way to do the calculation?
javascript
gps
coordinates
linear-algebra
0 Answers
Your Answer