Assumption when calculating distance between 2 lat-lngs using haversine formula? - gps

I am would like to check if a pair of lat-lngs are within 10 meters of distance between each other. Is there any part after the decimal that we can ignore when calculating distance using haversine formula?
For eg, take these two lat lngs
128.228522,10.9282247607
128.228579,10.9282609467
The distance between them is ~ 6.9 meters
AND
distance between
101.228522,30.9282247607
101.228579,30.9282609467
is ~ 6.3 meters
AND
distance between
98.998522,30.2282247607
98.998579,30.2282609467
again is ~ 6.3 meters
If you see all these pairs of lat-lngs, they are all similar upto 4 decimals points and are all less than 10 meters apart. But can I say this for sure? Is there any scenario where this assumption will not hold true?

Four decimal place difference in lat-lon coodinates is generally ~10 meters apart. However, the horizontal distance between the coodinates becomes smaller as you get closer to the poles.
For example:
distance between
128.228522, 60.9282247607
128.228579, 60.9282609467
is ~5.1 meters
distance between
128.228522, 89.9282247607
128.228579, 89.9282609467
is ~4.0 meters
To make it clear, here are set of points with fixed longitudes values with a relative delta of .0001 at different latitudes. The horizontal distance drops as you move towards the pole.
point 1 point 2 distance
128.2280, 10.0 128.2281, 10.0 10.9
128.2280, 60.0 128.2281, 60.0 5.6
128.2280, 80.0 128.2281, 80.0 1.9
128.2280, 89.0 128.2281, 89.0 0.19
Here are set of coordinates with a fixed longitude but different latutudes each having a .0001 relative difference. The vertical distance in each case is ~11.1 meters.
128.2280, 10.1234 128.2280, 10.1235
128.2280, 20.1234 128.2280, 20.1235
128.2280, 60.1234 128.2280, 60.1235
128.2280, 80.1234 128.2280, 80.1235
128.2280, 89.1234 128.2280, 89.1235

Related

Should I trim outliers from input features

Almost half of my input feature columns have offshoot "outliers" like when the mean is 19.6 the max is 2908.0. Is it OK or should I trim those to mean + std?
msg_cnt_in_x msg_cnt_in_other msg_cnt_in_y \
count 330096.0 330096.0 330096.0
mean 19.6 2.6 38.3
std 41.1 8.2 70.7
min 0.0 0.0 0.0
25% 0.0 0.0 0.0
50% 3.0 1.0 8.0
75% 21.0 2.0 48.0
max 2908.0 1296.0 4271.0
There is no general answer to that. It depends very much on your probem and data set.
You should look into your data set and check whether these outlier data points are actually valid and important. If they are caused by some errors during data collection you should delete them. If they are valid, then you can expect similar values in your test data and thus the data points should stay in the data set.
If you are unsure, just test both and pick the one that works better.

gpsd TPV json data has 95% conficence errors (ex: ept, epx, epy ...) How do you use the numbers?

http://www.catb.org/gpsd/gpsd_json.html
Let's say I get
"alt":1343.127
"epv":32.321
in TPV data.
epv is "Estimated vertical error in meters, 95% confidence", so this means, at 95% of chance, the data has 32.321 meters differences in 1343.127(alt) meters from the actual altitude?
Same question goes to other error values such as ept, epx, epy, epd ..
ept for time
epx for longitude
epy for latitude
epv for altitude
epd for track (heading)??
eps for speed
epc for climb
The error estimates are within a "95% confidence interval" -- There is a 0.95 chance that the actual altitude in your example is between 1310 and 1375 meters.

How do I access the original point in periodic 2 D Triangulation in CGAL?

I did the periodic triangulation of five points with the default domain.The points were (0.2,0.3), (0.5,0.1), (0.7,0.6), (0.8,0.8), (0.5,0.11). After iterating over the faces for 1 sheeted covering and printing the output, I got this result:
0.8 0.8 , 0.7 0.6 , 1.2 1.3 and so on.
I know the points 1.2 1.3 means the point 0.2 0.3 as the domain is iso_ rectangle. But I want it to print 0.2 0.3 instead of 1.2 1.3 so that I could find the delaunay neighbours of a given vertex.
Thank you
If you have a vertex v of the periodic triangulation t, then t.periodic_point(v) gives you a periodic point, whose first element is a point in the original domain. I guess that this point is what you are looking for.
See
http://doc.cgal.org/latest/Periodic_2_triangulation_2/classCGAL_1_1Periodic__2__triangulation__2.html#a217b56b0d5a8c222573f520a69a696ee
and
http://doc.cgal.org/latest/Periodic_2_triangulation_2/classCGAL_1_1Periodic__2__triangulation__2.html#abc48042ca1cff117f7c5201c0ffdabfa

Road Distance Calculation using GPS Co-ordinate

Path image
I need to calculate distance from subscriber position to Position B in the image. I have the GPS co-ordinate of the subscriber and the "B" position. How can I calculate the distance?
Simple case: Express lat and long values in decimal form and use the standard geometry distance formula if subscriber is less than 100 miles from position B. distance = sqrt((lat1-lat2)^2 - (long1-long2)^2).
More general case: Use the haversine formulas using a great circle to calculate distances from points on a sphere for more accurate measurements if position B might be a continent or two away from the subscriber. Let's call the subscriber position A and say and say he is at lat[a], long[a] and the fixed point B is at lat[b], long[b]. Let r represent the radius of the earth (about 3961 miles).
distance = 2*r*arcsin(sqrt(sin^2((lat[b]-lat[a])/2) + cos(lat[a])*cos(lat[b])*sin^2((long[b]-long[a])/2)))
If you specify r in miles, your answer will come out in miles. If you use kilometers use 6373 for a good number for the earth's radius, and of course the answer will come out in kilometers.
Exact case: The haversine formula will not provide a perfect answer because the earth is not a perfect sphere. Even apart from the mountains and the canyons, the earth has a larger radius at the equator than it does at the poles. The radius at the equator is the equator is about 3963 miles, and at the poles it is about 3950 miles. So you really need to devise your own lookup table (or borrow one from google maps) if you are measuring distances halfway around the globe and you have to be exact.
The haversine formula will be accurate to less than half of a percentage point. In 1000 miles your answer will be accurate to within 5 miles.
Haversine formula: https://en.wikipedia.org/wiki/Haversine_formula
Radius of the earth: https://en.wikipedia.org/wiki/Earth_radius

How to get a percentage from UIImageView rotation?

Hello I made a turnable knob but I am unsure on how to turn the rotation into a percentage 0 - 100%. Does anyone know how to do this?
Much Thanks
-Tay
Surely you would base rotation in something like degrees? If you want to convert your degrees to a percentage... 360 / 100 = 3.6 degrees per 1%.
So example, 270 degrees / 3.6 = 75% rotation.
But what you're doing sounds a little strange.