liodali/OSM-Routing-Client-Dart

Polyline won't show up

Opened this issue · 4 comments

Hello!

Thanks for this routing interface! Really useful stuff :)

I am not sure if I am not using the API properly but ot seems that only Geometries.geojson returns roads in the polyline attribute. The other (polyline and polyline6) always return null (in both getRoad and getTrip).
I had a quick look and it seems that in road.dart, the route["geometry"] variable is indeed empty for the polyline. I am unsure if it is intended or a change in the API, but since polyline is the default value, one would expect that it actually fills the polyline attribute.

If no easy fix can be find, I would suggest to use Geometries.geojson as default!

can provide me the parameter used to get that result
because Geometries.geojson has different output than Geometries. polyline|polyline6

Here is an example that always fails (in the sense that road.polyline is always null), while if Geometries.geojson is used, then road.polyline is actually filled

  Future<List<LngLat>> getRoadPolyline() async {
    List<LngLat> waypoints = [
      LngLat(lng: 13.388860, lat: 52.517037),
      LngLat(lng: 13.397634, lat: 52.529407),
      LngLat(lng: 13.428555, lat: 52.523219),
    ];

    final manager = OSRMManager();
    final road = await manager.getRoad(
        waypoints: waypoints, geometrie: Geometries.polyline);

    if (road.polyline == null) return []; // With polyline, this is always null
    return road.polyline!;
  }

thnx i will check why thats happen sorry for late reply

ah yeah because polyline get values only when geometries are geojson
and check if you check polylineEncoded when that geometries is polyline you find it not null
and used to share polyline easly but since this make confusion
but I will fix it for all geometries types