Bottom Line Issue: The distances I get from NNJoin for the shortest distance from a point to the nearest polygon are several hundreds or even thousands of meters shorter than the distance I calculate using the "Measure Line" tool in QGIS. Any idea why these might be different?

More Details: First, I imported a shapefile of polygons (census designated places in US) and a text file of points (long-lat locations). Next, I projected them both into WGS/UTM Zone 11N (the relevant UTM zone where they are located). Finally, I used the NNJoin plugin to find the distance between each point and the nearest shapefile. However, the distances that NNJoin returns seem to be several hundred or even thousands of meters shorter than the distances I calculate using the Measure Line tool in QGIS (or doing the calculations using Google Maps). For example, NNJoin says the distance from a point called Brown's Gultch (lat: 41.834721, long: -115.97) to Owyhee, Nevada (nearest census designated place) is 2,391 meters. By contrast, the "Measure Line" tool indicates it is around ~2,600 meters.

Any idea what I am doing wrong?

  • Are you using shapefiles? If so, try to use ST_Distance and ST_Centroid or ST_ClosestPoint via the DB Manager 'virtual layers' access... – DPSSpatial Oct 11 '16 at 2:31
  • Thanks for responding! I am using shapefiles. However, I want to get distance from each point to the edge of the nearest polygon. Wouldnt centroid be center of the polygon? – Dallas Wood Oct 11 '16 at 2:45
  • DB Manager my not cut it for this after all, but wondering if converting the polygons to vertex points (vertices) and running a distance calculation on that would work better? Let's see if anyone else has a better method... – DPSSpatial Oct 11 '16 at 2:52
  • Wouldn't the measuring tool use the project CRS, which might be different from your layers CRS? – Victor Oct 12 '16 at 10:58
  • Victor, Thanks! I actually ran the plugin yesterday and it worked fine. I guess that explains why! – Dallas Wood Oct 12 '16 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.