I need to calculate the distance of villages ( villages as points) from a border. I have a shapefile containing the locations of villages and another one containing the border. On QGIS, I ran the 'distance to nearest hub' command to calculate the distances. The distances that the command returned looks absurd. Can anyone help to locate where potentially am I going wrong? (I have checked that both the layers are in the same coordinate reference system.)
Asked
Active
Viewed 288 times
2
-
1In which CRS is your data? Why the results seem to be absurd? – Gerardo Jimenez Oct 31 '14 at 14:17
-
How the desired output should look like? Do you need a distance map (raster) or records in attribute table? – SS_Rebelious Oct 31 '14 at 14:24
-
Thank you for your replies : @GerardoJimenez: My data is in EPSG:4326 - WGS 84. I got the output file and the column mentioning the distances show very low distances and very close to each other as well. SS_Rebelious: I would like to have the output in the attributes table so that I can take it to other statistical software. – Smit Oct 31 '14 at 16:05
-
1I think the results are in decimal degrees since the crs of your layer is lat-lon. Try reprojecting your layers to a crs that uses meters (for instance) as the measuring units of the coordinates. Try a UTM CRS of the area of your data, for instance – Gerardo Jimenez Oct 31 '14 at 16:41
-
@GerardoJimenez : Thank you for your comment. It is very helpful. I have changed the CRS to Indian 1975/ UTM zone 48N (EPSG:24048). The results still stay the same. Is there other way round this? For example, can I manually convert the distances into metric system? – Smit Oct 31 '14 at 18:29
-
1Did you reproject your data by saving as a new shape file? Usually people tend to think that changing the crs in the layer's properties reproject the data. To do it correctly you have to select the layer and choose save as. In the dialog box you have to define a new name and the new coordinate system – Gerardo Jimenez Oct 31 '14 at 18:54
-
@GerardoJimenez: Thank you for replies and patience with my ignorance. I have got it working now. – Smit Nov 01 '14 at 01:11
-
@GerardoJimenez: Sorry to bother you again but I am facing another problem. The boundary is a line which is composed of many segments. When I calculate the the distance using the 'Distance from Hub' tool, the distances are not the shortest possible distance from a boundary segment but from a single point on the border ( or some average of the coordinates of the node). Am I understanding it incorrectly or this is the limitation of the command? – Smit Nov 03 '14 at 10:29
-
1May be this can help you http://gis.stackexchange.com/questions/28038/calculating-the-minimum-distance-between-points-and-polygons-in-qgis – Gerardo Jimenez Nov 03 '14 at 14:58
-
1This can be usfeful but you have to convert the line to pints first http://www.qgistutorials.com/en/docs/nearest_neighbor_analysis.html – Gerardo Jimenez Nov 03 '14 at 15:07