I´m looking at measuring some small routes using GPS, the longest one is like 650 meters, this routes can have several corners. The idea is to have the GPS on and walk the path, click a button on each corner and calc the distances beetween those points. This is already working.
Has anyone drawn GPS data on a canvas? Is there a library or some example code to draw the route scaled to use all the canvas.
Anyway, for the original question. It makes no sense at all the convertion to meters. The steps are:
1. Find the bounding box. (the smallest Lat and smallest Lon in the list, the largest Lat and largest Lon in ther list).
2. Find a scaling factor to avoid distorting the image so we calculate the scaling factor for the x coordinate and the y coordinate:
Green line moves as you walk, all the lines are drawn in the same rect so it "zooms" as you move. It works now, Needs a little work on positioning labels, better graphics and maybe later some interaction.
Each location point can be added only if the GPS accuracy is <= 5
I take it either you're either closer to the equator than Spain, or decided that converting degrees to meters makes more sense than it did at first glance.
Latitude degrees are longer than longitude degrees.^ In Spain around latitude 42°, longer by about a third.
But if you're not worried about equal horizontal and vertical movement being displayed as equal-length lines, then: sure, you can skip that adjustment.
But you just referred to "loss of accuracy", so presumably an out-by-one-third issue is of interest to you.
^ unless you are sitting within about 3.3° of the equator, thanks to the earth being oblate
Latitude degrees are longer than longitude degrees.^ In Spain around latitude 42°, longer by about a third.
But if you're not worried about equal horizontal and vertical movement being displayed as equal-length lines, then: sure, you can skip that adjustment.
Now that you've added that longitudinal adjustment to your solution, I agree. Not sure why you didn't fix the other two issues while you were there.
Originally you were looking for a non-pure-math solution, so I kept things easy and step by step. And you were calculating distances in meters (presumably using Location.DistanceTo) and it was just as easy to have the equal-scale intermediate cartesian coordinates in meters as in degrees of 60 nautical miles. Whatever unit suits your purpose best, use that. I don't mind. Although I do agree with:
The way that I track anything is with Lat/Long coordinates. I parse the results to fit on the screen. I use minutes if I'm tracking cars or airplanes or anything else that going to cover miles. I need to use seconds if I'm tracking people or sailboats or something that's moving over small distances. An application can use a generic substitute for degrees and minutes if you are using a small area and only use seconds for an application that works just about anywhere. Using some heavy math between hits of "LocationChanged(Location1 As Location)" will give you all the accuracy most people need for distance.
Location.DistanceTo in smaller walking applications using seconds isn't very accurate. The course part of the GPS library works well to identify turns or changes in direction. There are some good examples of heavy math on the forum. They give consistent reliable results. The graphic below uses Location.DistanceTo and has good accuracy because of its size. The red line is a finger swipe giving the user the distance of the red line. Everyone needs to know how many miles until they get to their next location or stop.
I think the lack of distance accuracy is due to scale. Using DistanceTo in the GPS Library works great for driving and in almost all programs like that use the "minutes" function. When we want feet or yards or maybe even meters, and the scale is small, we use the "seconds" function of the GPS Library. I have measured 94 feet from the back door to the shop. Also, it appears that some supermarkets have WiFi with GPS. My walking program works inside my food store. There may be some business opportunities for programmers using this technology.
To answer some other questions. Yes, you can draw track lines on a canvas. You can use a map or not. Fitting a map to the screen takes some time when you change devices. The map has to be scaled to the device. I'm doing it the same way I did it using Java Script and Pearl. I guess I'm old school. Code sippets are available on request. Whole programs are big and not very portable.