2

I am a GIS beginner, and I have a question about how to get the distance between two points in meters instead of decimal degree.

In QGIS 2.4 I have a project with two point layers (in WGS84). From both layers I used I wanted to have the distance in meters between the two closest point between the layers. So what I did: Vector -> analyse tools -> distance Matrix, ticked the box "only nearest (k) target points: 1". This created a CSV file with all the distances, but in the wrong units.

So I looked it up on the internet and I found out two things:

  • I have to set my CRV in a projected coordinate system (like a UTM zone).
  • And I have to tick or untick the box with "on the fly" --> which I cannot find in QGIS2.4 Project --> project setting --> CRS.

I tried the first option. I tried to set the layers in UTM 29 ZONE IRENET95, EPSG: 2158 by "save as" --> add new vector layer. It still gives the distance in the wrong units. My project only contains point in southwest Ireland, so that is why I picked this projection. Or should I project it in a different projection?

I also tried to find a converter to convert the decimal degree outcome to meters, but I did not find any. I guess there is none. Am I right?

For me it seems like there must me an easy solution, but I did not manage to find one. I think I am doing something wrong with setting the layers in a different projection.

  • Are you aware that one degree of latitude/longitude is not exactly the same across the whole world? I guess what you are looking for is Great-circle distance. Can you share your data? – Michal Zimmermann Sep 21 '14 at 13:06
  • As zimmi implies, converting a distance from degrees to meters is typically not done since it's different around the globe. I know of calculators for finding distance between points (my favorite is at Movable Type Scripts) but obviously doing that manually for dozens of points is tedious, and QGIS should be able to do it. Try saving your data in the new projection (UTM should be fine) and opening it into a new project, and see if your distance matrix works correctly then. – Erica Sep 21 '14 at 16:33
  • Did anyone ever find an answer that works for this question? Nobody seems to have answered it on the many threads for latter versions of QGIS (2.8.2) without on the fly projections. My output csv from the distance matrix is consistently in decimal degrees ( EPSG4326-WGS84) regardless of the re projections to Hart 94/LO 19; WGS84/UTM Zone 34S. I live in South Africa by the way. – user77312 Jul 5 '16 at 6:54
  • @Julian please open a new question, showing a screenshot of your problem or giving a link to the data you work with. You might need to look into the extent of your data as well, and compare it to a known basemap, like openstreetmap. – AndreJ Jul 5 '16 at 8:45
1

On the fly transform:

  1. Click the CRS status button on the lower right corner of the window.
  2. Tick the "Enable 'on the fly' CRS transformation" dialogue box.
  3. Select your desired projection and click Apply.

On the fly projection

Result:

On the fly projection

Reproject layer:

Right click on layer -> "Save as..." -> CRS: Selected CRS -> Then select your CRS from the list.

I recommend on the fly transformations, because repeated physical reprojections can lower the accuracy of your geometry. To answer @zimmi's question, this phenomenon will likely occur, when you transform very different projections and the transformation algorithm can't translate the coordinates precisely and can only give an approximate result (the result of the equation is not finite, so the algorithm has to round the transformed coordinates).

See an example of an extreme difference below (EPSG:4326 - EPSG:2158 - EPSG:4326):

Extreme reprojection error

Note that the UTM 29N projection can't describe the problematic areas properly and I only used it for the sake of the extreme example. The normal loss in accuracy is only ~1 mm after two sets of transformations (EPSG:23700 - EPSG:4326 - EPSG:23700 - EPSG:4326 - EPSG:23700):

Normal reprojection error

  • Could you elaborate on every physical reprojection will lower the precision of your geometry? How? Why? Any sources? I'm really curious about this. – Michal Zimmermann Sep 21 '14 at 17:34
1

I used the Vector --> Analysis Tools --> Distance matrix to find out the distance between the points in Point Layer and then in the resultant file generated .csv multiplied distance column with 111.32 to get the distance in Kms.

I verified the results by comparing it with actual distances

Hope this help

  • Could you expand on why you are using this number 111.32? – jmbouffard Jan 4 at 20:05

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.