hi friends in my gps application i did convert Geo point to pixels. i have two geo points so i convert this both of two points to pixels now i take different of this both pixels points and i want to convert this difference to kilometers
i want to convert google map pixels to kilometers
2.5k views Asked by sam_k At
1
I wouldn't recommend using the view pixels to do distance calculation. If you have the geo points, you should use those. It all comes down to some geodetic calculation. And the accuracy depends on how you model the earth. What you want is to use geodetic great circle lines to perform distance calculations.
If you model the earth as a sphere (using law of cosines):
I would also recommend looking into the Haversine formula, which is numerically more stable. Using the haversine formula, the angle calculated in the previous code would be:
If you want increased accuracy (for large distances), you should consider modeling the earth as an ellipsoid, though the calculations for this are considerably harder.
EDIT: Also note that the above only holds if you give longitude and latitude in radians. So you'll have to make that conversion first too.