munterfi / hereR

R package that provides an interface to the HERE REST APIs: Geocoder API, Routing API, Traffic API, Public Transit API and Destination Weather API. Locations and routes are returned as 'sf' objects.
https://munterfi.github.io/hereR/
GNU General Public License v3.0
90 stars 11 forks source link

Bug: Pedestrian doesn´t work in isoline #167

Closed enriquevaa closed 1 month ago

enriquevaa commented 1 month ago

Bug isoline When you use the function isoline(), it doesn´t support the argument transport_mode = 'pedestrian' anymore. It works well with car or truck.

Reproducible example isoline( poi = point, range = 60*3, range_type = "time", transport_mode = 'pedestrian')

The API request is the following:

In .parse_response(i, out$responses()[[i]]) :
  https://isoline.router.hereapi.com/v8/isolines: Request 'id = 1' failed. 
  Status 400; Bad Request; Bad request syntax or unsupported method.

I hope you can solve this problem, looks it has happened since the Here API update.

munterfi commented 1 month ago

Thanks @enriquevaa for reporting.

It seems that hereR::isoline() is sending EV parameters, which are not valid with the routing mode "pedestrian":

{
  "title": "Invalid request",
  "status": 400,
  "code": "E605027",
  "cause": "Ev parameters cannot be used with the specified `transportMode`.",
  "action": "",
  "correlationId": "ec167d27-9ca9-484f-a969-5ba5bb5aa6fb"
}
{
  "departure": {
    "time": "2024-10-11T21:23:43+02:00",
    "place": {
      "type": "place",
      "location": {
        "lat": 47.1337323,
        "lng": 9.5167141
      },
      "originalLocation": {
        "lat": 47.1337239,
        "lng": 9.5166689
      }
    }
  },
  "isolines": [
    {
      "range": {
        "type": "time",
        "value": 300
      },
      "polygons": [
        {
          "outer": "BGw4485Ciu4kSA29BsFkQkQqFiQpF4K3KiQrFkQsF2K4KkQqF-qBAiQsFsFkQrFiQhQsFvVAhQsF3K4KhQqFjQpF3KlgB1KA3K2KlgB4KrFiQAqrDrFiQ1KArFhQArgCrFhQ3K3KpFjQAl2EqFhQkQrFiQ2CsFgIAuN"
        }
      ]
    },
    {
      "range": {
        "type": "time",
        "value": 600
      },
      "polygons": [
        {
          "outer": "BGij485Cw3xkSA4SsFkQmgB2KA4K3K4KrFiQA61CsFkQkQsFsgCAiQrF4K3K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xgDygDlgB2K3K4KlgB4KlgBmgBlgB2K9qB-qB1KmgBjQsF7qBAjQrF3K3K1KAlgBmgB3KArFhQsFjQ4K1KsFjQAtVqFjQkQrFiQsF4K4K4KAuVtVsFjQrFhQlgB3K3K3KhQrFjQsFlgBmgB1KArFhQsFjQ2K1K4KlgB4K3K2KlgB4K3KA1KtVvVjQpFrgCAhQrFrFjQArgCsFhQiQrFkQsFsFiQA-qBqFiQkQsFsgCAiQrFsFhQA3gErFjQlgB1KpFjQA7qBrFjQjQrFtVAjQsF1K4KjQsFtVAjQqF1K4KjQsF7qBAjQrFrFhQsFjQkQrFsgCAiQrF4K1KiQrFwVAiQrFsFhQrFjQ3K1KpFjQAtVrFjQvVtVhQrFtVAjQrFA1KmgB3K4K3KiQrFkQsFuVwVsFiQAuVsFkQ2K4KsFiQAuVsFkQ4KA2K3KmgB1K4K3KmgB3KmgBlgBmgB1KuVvVsFhQA9qBrFhQ1K3K3KlgBhQrF9qBAjQsF1K4KjQqF7qBAjQsF3K4KhQsF9qBAhQsF3K2KhQsFjQrFrFhQsFjQkQrF8qBAkQpF2K3KkQrFuVAkQrF2K1KkQrF-qBAiQrF4K3KiQrFsgCAkQpF2K3KkQrF8qBAkQrF4K1KiQrFsgCAkQrF2K3KkQpFuVAkQrFuVvVsFhQA9qBrFhQlgB3KrFhQAvVsFhQ4K3KqFhQAhsHpFhQjQrFhQsF3K2KlgB4K3K4KhQqFvVAhQsF3K4KhQsFvVAhQsF3K2KhQsFvVAhQrFA1KuVvVkQrFuVAkQpF2K3KkQrFuVAkQrF2K1KmgB3K4K3KmgB1KuVvVA1K1K3K3KlgB3K3KrFhQAvVpFhQlgBlgBrFhQAvVrFhQ3K3K1KlgB3K3K3KlgB1K1KrFjQsFhQiQrFkQ2CqFiIAsN"
        }
      ]
    }
  ],
  "notices": [
    {
      "title": "The provided parameter 'departure=2024-10-11T21:23:43%2B02:00' is unknown.",
      "code": "unknownParameter",
      "severity": "info"
    }
  ]
}

This issue should be relatively easy to fix. In addition the departure parameter seems to be unknown.

munterfi commented 1 month ago

Hi @enriquevaa, the changes in #168 address and fix the issue you're experiencing:

library(hereR)
set_verbose(TRUE)
isoline(poi = poi, transport_mode = "pedestrian")
#> Sending 8 request(s) with 1 RPS to: 'https://isoline.router.hereapi.com/v8/isolines?...'
#> Received 8 response(s) with total size: 65.3 Kb
#> Simple feature collection with 48 features and 5 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 6.118698 ymin: 46.0001 xmax: 9.528837 ymax: 47.59372
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>    id rank           departure             arrival range                       geometry
#> 1   1    1 2024-10-18 17:03:38 2024-10-18 17:08:38   300 POLYGON ((8.27616 47.05015,...
#> 2   1    2 2024-10-18 17:03:38 2024-10-18 17:13:38   600 POLYGON ((8.27204 47.04998,...
#> 3   1    3 2024-10-18 17:03:38 2024-10-18 17:18:38   900 POLYGON ((8.268263 47.04929...
#> 4   1    4 2024-10-18 17:03:38 2024-10-18 17:23:38  1200 POLYGON ((8.265517 47.04998...
#> 5   1    5 2024-10-18 17:03:38 2024-10-18 17:28:38  1500 POLYGON ((8.261054 47.04809...
#> 6   1    6 2024-10-18 17:03:38 2024-10-18 17:33:38  1800 POLYGON ((8.256934 47.04672...
#> 7   2    1 2024-10-18 17:03:38 2024-10-18 17:08:38   300 POLYGON ((8.970358 46.00542...
#> 8   2    2 2024-10-18 17:03:38 2024-10-18 17:13:38   600 POLYGON ((8.966753 46.00594...
#> 9   2    3 2024-10-18 17:03:38 2024-10-18 17:18:38   900 POLYGON ((8.963492 46.00628...
#> 10  2    4 2024-10-18 17:03:38 2024-10-18 17:23:38  1200 POLYGON ((8.9592 46.00594, ...

To install the development version of the package from GitHub use: remotes::install_github("munterfi/hereR")

Please note that it may take some time for the changes to be reflected on CRAN due the (still in 2024? 🐌🐌🐌 ) manual release process.