I have thousands of points on a multiple layers and I need to get the distances between each point and every other point within a layer (so i can get min, max, mean and median distances) and the nearest neighbour values. I have used the distance matrix to achieve distances between each point, and the nearest neighbour tool to get the nearest neighbour value.
It all seemed to be working fine until I realised that the distance values are wrong. I assumed they were in km as the measuring tool displayed the distances of known distances correctly. However, when running it through the distance matrix and nearest neighbour, the values are massively different. In a similar vein to this question: Getting result in metric from QGIS Distance Matrix tool in QGIS?
- Example:
- Point 1 to Point 2 is 1.12km in reality
- Manual measuring tool on QGIS says 1.12km
- Distance matrix says 0.010682
- Nearest neighbour mean observed distance says 0.010682
I have tried changing CRS and reprojecting and saving as a new shapefile, but it still doesn't work. I can get the measuring tool to display the correct measurements but as soon as i run it through the distance matrix or the nearest neighbour i get the same wrong values no matter what the CRS is.
I thought it might be in degrees, but how do I then convert it to km's so when I am writing up my results I can say that 'the mean value was Xkm' rather than some obscure number which doesn't readily mean anything to anyone?
Can anyone offer any advice?
Is there a projection I should be using (my points are plotted from long/lat)?
Is there a setting I need to change for the plugins?
Is there another tool which will do this for larger numbers of points? I
s there a formula I can use to change all the 'wrong' values (possibly degrees) into m/km's?
I don't know python, but is there a clever bit of code I can use to do this?
This worked for a while, but now it's reverted again. I managed to batch execute the reprojection, and then batch distance matrix and nearest neighbour and it seemed to work. For all except one layer. I've tried reprojecting just one file using save as manually, but it won't work. I've installed it on a second computer and tried it won't work. I went back to the original data, imported it into QGIS from csv, straight into ESPG:27700 with the project set to ESPG:27700 and it's still measuring in degrees. It's not the coord's, i've checked and know what the measurements should be. I then ran it with the second year of data ready to disregard one bad file, and it is refusing to work. I really don't understand the problem.
It says it's reprojected the file, but it isn't, or it is but something is making QGIS continue to measure in degrees. I didn't changed any settings from the set which worked, to the set which didn't.
Is this a glitch in the program?
Is there another free GIS program that can do distance matrix and nearest neighbour which might save me this continuous circling?
I have just taken an original unsplit file and reprojected the entire year as one file. I saved and then split it by date, before using distance matrix. It is still running and outputting files and this is likely to take some time but the first couple of outputs so far appear to be in metres. I believe the problems I am experiencing are related to a bug. I will try to report it as such, but for anyone experiencing similar problems all I can suggest is that you disregard any files which aren't working and start right from the very beginning with the data, reprojecting before any other analysis as it seems something lodges itself in the file and stops it working properly when you try to run distance related analysis at some point.
Answer
The measuring tool has some advanced logic to calculate distances from lat/lon coordinates, all other tools just use the units of the layer (degrees in your case).
For all britain, EPSG:27700 should be the best. The result will be in metres.
But: Don't use Set CRS for Layer
, instead Save As..
under another name with changed CRS.
No comments:
Post a Comment