cyclestreets / cyclestreets-r

An R interface to cyclestreets.net APIs
https://rpackage.cyclestreets.net/
GNU General Public License v3.0
27 stars 7 forks source link

Extra column name associated with short routes #72

Closed Robinlovelace closed 11 months ago

Robinlovelace commented 11 months ago

As shown in the example below, the provisionName column is duplicated for some routes it seems:

start_coords = c(-8.80639, 52.50692)
  end_coords = c(-8.80565, 52.51329)
  j = cyclestreets::journey(from = start_coords, to = end_coords)
  names(j)
#>  [1] "name"              "distances"         "time"             
#>  [4] "busynance"         "quietness"         "gradient_segment" 
#>  [7] "elevation_change"  "provisionName"     "start_longitude"  
#> [10] "start_latitude"    "finish_longitude"  "finish_latitude"  
#> [13] "crow_fly_distance" "event"             "whence"           
#> [16] "speed"             "itinerary"         "plan"             
#> [19] "note"              "length"            "west"             
#> [22] "south"             "east"              "north"            
#> [25] "leaving"           "arriving"          "grammesCO2saved"  
#> [28] "calories"          "edition"           "provisionName.1"  
#> [31] "geometry"          "gradient_smooth"

Created on 2023-08-05 with reprex v2.0.2

Robinlovelace commented 11 months ago

Fixed in #73 as shown below:

> j = journey(from = start_coords, to = end_coords)
> names(j)
 [1] "name"              "distances"         "time"              "busynance"         "quietness"        
 [6] "gradient_segment"  "elevation_change"  "provisionName"     "start_longitude"   "start_latitude"   
[11] "finish_longitude"  "finish_latitude"   "crow_fly_distance" "event"             "whence"           
[16] "speed"             "itinerary"         "plan"              "note"              "length"           
[21] "west"              "south"             "east"              "north"             "leaving"          
[26] "arriving"          "grammesCO2saved"   "calories"          "edition"           "geometry"         
[31] "gradient_smooth"  
si-the-pie commented 11 months ago

Oh, you've just fixed it, but I was in the middle of telling you the following:

Note that output from the api endpoint for that route, i.e.

http://{api_key}-api.cyclestreets.net/api/journey.json?key={api_key}&itinerarypoints=-8.80639,52.50692|-8.80565,52.51329&plan=fastest&reporterrors=1&archive=none

Does not repeat the provisionName.


{"marker":[{"@attributes":{"start":"Un-named link","finish":"Un-named link","start_longitude":"-8.80639","start_latitude":"52.50692","finish_longitude":"-8.80565","finish_latitude":"52.51329","crow_fly_distance":"710","event":"depart","whence":"1691218472","speed":"16","itinerary":"0","plan":"fastest","note":"","length":"769","time":"220","busynance":"1383","quietness":"56","signalledJunctions":"0","signalledCrossings":"0","west":"-8.80639","south":"52.50692","east":"-8.80403","north":"52.51329","name":"Un-named link to Un-named link","walk":"0","leaving":"2023-08-05 07:54:32","arriving":"2023-08-05 07:58:12","coordinates":"-8.80639,52.50692 -8.80586,52.50755 -8.80498,52.50855 -8.80460,52.50901 -8.80433,52.50935 -8.80412,52.50959 -8.80403,52.50973 -8.80408,52.51001 -8.80418,52.51045 -8.80421,52.51062 -8.80426,52.51089 -8.80434,52.5114 -8.80442,52.51181 -8.80443,52.51191 -8.80452,52.51209 -8.80495,52.51255 -8.80548,52.5131 -8.80552,52.51315 -8.80565,52.51329","elevations":"45,44,47,50,51,52,53,53,53,53,52,50,49,48,49,48,48,48,48","distances":"79,126,57,42,30,17,31,49,19,30,57,46,11,21,59,71,6,18","grammesCO2saved":"143","calories":"13","edition":"routing230801","type":"route"}},{"@attributes":{"name":"Un-named link","legNumber":"1","distance":"769","time":"220","busynance":"1383","quietness":"70","flow":"0","walk":"0","signalledJunctions":"0","signalledCrossings":"0","turn":"","startBearing":"27","color":"#33aa33","points":"-8.80639,52.50692 -8.80586,52.50755 -8.80498,52.50855 -8.80460,52.50901 -8.80433,52.50935 -8.80412,52.50959 -8.80403,52.50973 -8.80408,52.51001 -8.80418,52.51045 -8.80421,52.51062 -8.80426,52.51089 -8.80434,52.5114 -8.80442,52.51181 -8.80443,52.51191 -8.80452,52.51209 -8.80495,52.51255 -8.80548,52.5131 -8.80552,52.51315 -8.80565,52.51329","distances":"0,79,126,57,42,30,17,31,49,19,30,57,46,11,21,59,71,6,18","elevations":"45,44,47,50,51,52,53,53,53,53,52,50,49,48,49,48,48,48,48","provisionName":"Unclassified road","type":"segment"}}],"waypoint":[{"@attributes":{"longitude":"-8.80639","latitude":"52.50692","sequenceId":"1"}},{"@attributes":{"longitude":"-8.80565","latitude":"52.51329","sequenceId":"2"}}]}```
Robinlovelace commented 11 months ago

Yes, it was our side. Thanks Simon, I was saying to my colleague Hussein that we could benefit from refactoring some parts of the codebase..