ScalingFactorX = Canvas.Width / (MaximumLat - MinLat)
ScalingFactorY = Canvas.Height / (MinLon - MinLon)
ScalingToUse As Double = Min(ScalingX, ScalingY)
Dim X As Int = (Location.Latitude-MinLat) * ScalingToUse...
If you want to measure distances and curves you must use an external provider such as:
Googlemaps
polylines
Sample:
Again, in the description says that the data capture and distance measurement is already working. (among other reasons, This has to work in an OFF LINE.)GpsLastLocation.DistanceTo
Precision, intervals or complex calculations with the bearing, can loose a couple meters each turn, for this app tha is not a good trade for a couple of taps on the screen.Why always click when you turn? Just write a time log (every 5 seconds?)
No, it is a good recap, calculating the bounding box of the coordinates set, scale the canvas and draw the llines, you are right, this can be done without the need of external apps or APIs, pure math, that is where Im looking help for.I hope I have not completely missed the point and have perhaps not understood something correctly.
you are right, this can be done without the need of external apps or APIs, pure math, that is where Im looking help for.
how to interpolate the data that lies between the measuring points but is missing from the measuring protocol
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.
x_scale = canvas_width / x_range
y_scale = canvas_height / y_range
scale = minimum of x_scale and y_scale 'same scale for x and y is usually a good thing ?
x = (longitude converted to x meters - minimum x meters) * scale
y = (latitude converted to y meters - minimum y meters) * scale
Public Sub CoordenateToPixels(Lat As Double, Lng As Double, Width As Int, Height As Int) As Object
Dim x As Float = (Lng + 180) * (Width / 360)
Dim y As Float = (Height / 2) - (Width * Logarithm(Tan((cPI / 4) + ((Lat * cPI / 180) / 2)),cE) / (2 * cPI))
Return Array As Double(x, y)
End Sub
GPS readings are usually at least one-per-second, so treating the path as a collection of one-second-long straight line segments should be close enough.
The original post talked of clicking a button to mark each corner, and the diagram shows straight-line segments, so the talk of interpolation and curves is probably moot.
Phone GPS is accurate to +/- 1 meter if you're lucky.
Ehhh, you're a little too optimisticPhone GPS is accurate to +/- 1 meter if you're lucky.
My experience says that a few tens of meters is a better approximation
The meter is approached only with telephones with dual frequency GPS receivers and there are very few
The meter is approached only with telephones with dual frequency GPS receivers and there are very few
Phone GPS is accurate to +/- 1 meter if you're lucky.
You got me intrigued about what a newer phone might do.
Ehhh, you're a little too optimistic
My experience says that a few tens of meters is a better approximation
The meter is approached only with telephones with dual frequency GPS receivers and there are very few
ScalingFactorX = Canvas.Width / (MaximumLat - MinLat)
ScalingFactorY = Canvas.Height / (MinLon - MinLon)
ScalingToUse As Double = Min(ScalingX, ScalingY)
Dim X As Int = (Location.Latitude-MinLat) * ScalingToUse
Dim Y As Int = (Location.Longitude)-MinLon) * ScalingToUse
I would like to see the result of your solution.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:
B4X:ScalingFactorX = Canvas.Width / (MaximumLat - MinLat) ScalingFactorY = Canvas.Height / (MinLon - MinLon) ScalingToUse As Double = Min(ScalingX, ScalingY)
3. For Each location, get the X and Y
B4X:Dim X As Int = (Location.Latitude-MinLat) * ScalingToUse Dim Y As Int = (Location.Longitude)-MinLon) * ScalingToUse
4. Use the coordinates to Draw the points, Lines, labels, current position , etc.
Note: It needs a little more aritmetic to work with negative lat and Lon
Note. It needs an offset to center the path depending on which ScalingFactor was used (X or Y)
I would like to see the result of your solution.
... the longest one is like 650 meters ... calc the distances beetween those points. ...
Anyway, for the original question. It makes no sense at all the convertion to meters.
Note: It needs a little more aritmetic to work with negative lat and Lon
Note. It needs an offset to center the path depending on which ScalingFactor was used (X or Y)
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?