I have 3 lat/long points as follows:

A = {35.257246,139.721256}
B = {35.256541,139.721491}
C = {35.256326,139.7203271}

1) Measurement result by Movable Type Scripts:

By using the distance calculation method at Movable Type Scripts, the distance results are:

distance(A,B)= 80.88745771063131(m)
distance(B,C)= 101.58773310547808(m)

I believe these results are correct.

2) Measurement result by QGIS measure line tool:

The QGIS desktop 2.0.1 and the Projection CRS is set to [+proj=longlat +datum=WGS84 +no_defs]. I use the Plugins/OpenLayers plugin/Add Google Satelite and import 3 lat/long points into QGIS.

The results are:

distance(A,B) = 100.374(m)
distance(B,C) = 135.114(m)

I need to generate a map from a large set of lat/long points as above and Google Satellite background on QGIS.

Could you show me how to solve this problem?

  • 1
    Using the on-line calculator, the site you link to gives me the following distances (A,B) = 81.24km and (B,C) = 108.4km. Why are you convinced yours are correct? Also, where did you get your coordinates? If they are off Google then take them with a pinch of salt because Google is projected in Pseudo Mercator (which is great for web mapping but not very accurate for measuring distances) not WGS84. So you would be misleading QGIS by specifying WGS84. – MappaGnosis Aug 25 '14 at 19:04
  • I get the coordinates by using an iPhone4s with my app to collect GPS latlong. – user27916 Aug 26 '14 at 4:30
  • I've tried to reproject to the JGD2000 / UTM zone 54N for Japan, however, the measurement for distance(B,C) = 0.001mm, very small. – user27916 Aug 26 '14 at 4:36
  • 1
    I'm afraid you have used Set CRS for Layer, which does not reproject the layer. Use Save As...under a different name and CRS instead. – AndreJ Aug 26 '14 at 5:08
  • The measurement of (A,B)=80.88m and (B,C)=101.58m which I mentioned above is reasonable in reality. A,B,C are three points locate around my campus building. – user27916 Aug 26 '14 at 5:12

The first source you mention remarks:

All these formulæ are for calculations on the basis of a spherical earth (ignoring ellipsoidal effects)

so you should not rely on the results.

If you use the openlayers plugin, project CRS should be set to EPSG:3857. As Erica points out, that is not suitable for measurements.

For measuring, delete the openlayers background, and set the project CRS to the UTM zone of your part of the world instead, or what is used by your local surveying authority.

If you need the openlayers background for measuring, take a screenshot with "Save as image", add that to the canvas with layer CRS EPSG:3857, then delete the openlayers background and change CRS.

  • The measurements of the points are almost certainly < 40km from each other. Using the WGS84 ellips for calculating the distance the difference is bellow 1m. The difference I recon is negligible taking into account that hes using an iphone to measure his position. – nickves Aug 27 '14 at 14:37

I think this is a projection-related issue. WGS84 is not intended for accurate measurement anywhere but the equator, so the measure line tool (or a scale bar, if you were making a map) would be off. The Haversine calculation is independent of projection and so its results are reliable.

Refer to this question: Using scale bar units in QGIS composer?

Try projecting to a coordinate system that is appropriate for your area of interest (I'm not familiar with the best ones for Japan, so can't advise there; I usually default to UTM, however) and then you should be able to get accurate measurements.

  • I try to reproject the CRS to JGD2000 / UTM zone 54N (EPSG:3100) for Japan. The projection setting is: [+proj=utm +zone=54 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs]. The measure results is very small, as in the image here: – user27916 Aug 26 '14 at 2:25
  • The measure results are very small about 0.001mm for distance(B,C), as in the image here: generating map. What I was wrong in project setting? – user27916 Aug 26 '14 at 2:40
  • You need to first set the data's projection to WGS84 (the coordinate system of the original data), and then transform the data to UTM 54N (the coordinate system you want). A more detailed description of why can be found here, although those instructions are unfortunately for ArcMap not QGIS. – Erica Aug 26 '14 at 11:22

Based on your comments, the problem is solved. In summary:

1-Using the excel tool, here, Excel tool for converting LatLong to UTM. In the Batch Convert LatLong to UTM sheet, paste the LatLong coordinates into collumn L, M then, the UTM coordinates are automatically calculated and save in AE,AF collumn. Saving the UTM coordinates to a file. (This step also can be done by using GIS softwares, such as Global Mapper,etc...)

2-In QGIS, import the file, and select the JGD2000 / UTM zone 54N Projection for the layer. Now, the distance measurement should be ok.

3-As @Andre Joost mentioned above, I have to use the GoogleOzi tool to download Google Satellite image, and import the raster image into QGIS as a background layer. This step hasn't finished yet, but it's ok for me.

Thank you all for your comments.

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.