NTNU-VM / natronR

0 stars 0 forks source link

Column which shows distance between new location and matching existing location #9

Closed samaperrin closed 6 years ago

samaperrin commented 6 years ago

We need 2 extra columns in our matching_locations table (output from the location_check function)

vmzomdav commented 6 years ago

I have added "distanceToLocationName_in_kilometer" column to the location_check the column Return a distance between 2 point in kilometer and 3 decimal to include meter Precision. The sql Return matching localities in proximity ascending order listing the nearest locality first.

New column returning distance: "round(((((ST_distance(st_geomfromtext('POINT(", local_data_temp_filled$decimalLatitude[HEY], local_data_temp_filled$decimalLongitude[HEY], ")', 4326),", "\"localityGeom\") 6378137) pi()) / 180)/1000)::numeric, 3) as \"distanceToLocationName_in_kilometer\",",

listing the nearest localities first "order by \"distanceToLocationName_in_kilometer\";",

samaperrin commented 6 years ago

Have updated the script so that the changes Marc made in the SQL script are found in the output.