Skip to content

st_distance generates some radical distance values for some points #2516

Open
@sogm

Description

@sogm

Hello Edzer,

I hope you are well. I am having some issues processing distances with my data.

I have two point layers,

  1. sampling_points <- st_read("..../site_data_all_gck.shp")
  2. weather_stations <- st_read("..../gcr_weather_stations.shp")

I want to know which weather station is the closest to my sampling points. For this purpose I used st_nearest and it effectively select the row in the weather station that is the closet to my sampling point.

However when I execute the code to get the distance between those two points, for most of the sampling points it works well, but it generates unrealistic distances for some others. Particularly in row 33 of the output file

"sampling_point_nearest_weather_station"

the distance between the "sampling point code" "SF" and the "nearest weather" station "82144" is:

14362.9406 m

but the distance calculated manually using google and QGIS is ~2900m

The layers and the code to replicate the issue are available at

https://github.com/sogm/distance_points_issue

Thanks in advance for helping me figure out what could be happening.

Regards

SGM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions