I have a shapefile that describes the urban boundaries of a city and I want to calculate for a set of points the nearest distance to the boundary. Given the number of points is very large (millions) I decided to first test my planned procedure to make sure it is producing the correct output. This is what I did:
- Created a grid of test points using 'Create grid'
- Converted the boundary to a set of points using 'Convert lines to points'
- Identified the shortest path to the boundary using 'Distance to nearest hub (lines to hub)' with meters as the measurement unit
I have encountered a problem in that for a number of test points, particularly those for which the shortest path to the boundary is in a north-south direction, the nearest point on the boundary identified by 'Distance to nearest hub' is incorrect (ie. there are other points on the boundary that are closer).
As an example, for the selected test point, the closest point on the boundary identified by 'Distance to nearest hub' (ie. the northern most point) is 15037.985 meters away, but in fact there is a closer point (the western most point) that is only 14679.774 meters away. I have also checked these distances (and a number of others) against Google Maps and they seem to be fairly accurate (within 10-20 meters).
Not sure what is going on here. I am relatively new to QGIS. I am using QGIS version 3.2.3-Bonn.