2

I need to calculate distance between two stations in a map in order to calculate empirical variogram in ordinary kriging to interpolate temperature data.

Calculating distance in kriging using Euclidean distance formula between two points on XY axes, and I found that not sufficient because I specified Lag_units and Lag_distance in meters when I programmed kriging.

Can I use the haversine formula to calculate distance between real coordinates instead of Euclidean distance?

  • What's the coordinate system you're working on (datum & projection) ? Also, I do not see how Kriging is helping understand the question here, from what I understood, all you want is to mesure the distance, right ? – Akheloes Feb 23 '14 at 12:45
  • Gloserio,my coordinates are real latitudes,longitudes for six weather stations ...in the formula of calculating the experimetal variogram and the fitted model you need to calculate the distance between pair points(1,3)(4,5) using calculation formula (Aucledian distance). if i apply aucledian distance between latitudes and logtitudes i dont get the distance ? therefor i suggest to use haversine formula..does this right? – The_programmer Feb 23 '14 at 14:58
  • Well, maybe you can use the haversine formula, but it will not be very accurate, this formula is based on a spherical geometry and unless you're working on a map based on spherical coordinates, you'll lose accuracy... Do you know which coordinate system is your map on ? What software are you using ? – Akheloes Feb 23 '14 at 15:34
  • im work on Google maps co-ordinate system (latitude,longitude),and programming with asp.net c# – The_programmer Feb 23 '14 at 17:03
  • Gloserio, which distance formula is accurate than haversine formula ? – The_programmer Feb 23 '14 at 17:14
2

What you're looking into is measuring a distance on google maps. Unfortunatly, this is not a question to which an easy answer can be given, but you might consider one of these ways :

  1. The least accurate way : the haversin formula ,
  2. Ellipsoidal Earth projected to a plane formula (since Google Maps is based on a Mercator projection and a WGS84 Datum, this formula may yield better results if you succeed in putting it into an algorithm),
  3. The cleanest of ways, which will yield the best results, is to reproject your map into a local coordinate system (CS) and then mesure the distance on it ;

Let me now focus on this last bullet : google maps uses a coordinate system called "Pseudo Mercator" or "Web Mercator" which have the code EPSG:3857, I live in Morocco, so the coordinate system I should use is EPSG:32630, depending on where you live, you should pick a convenient coordinate system for accurate results. Once you pick your coordinate system, your should look for a the mathematical tranformation between EPSG:3857 and EPSG:XXXXX (your local CS) or leave it to a third party library to carry such transformation (depends on which tools you're using).

Edit : just forgot to mention that if you want a third party library that can handle tranformations, look up Proj4 or PROJ4NET for C# programming.

  • The least accurate--by far--is (2), the Mercator projection, except for points close to the Equator. – whuber Jun 5 '14 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.