OSM-Routing-Client-Dart icon indicating copy to clipboard operation
OSM-Routing-Client-Dart copied to clipboard

Polyline won't show up

Open pariterre opened this issue 3 years ago • 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!

pariterre avatar Nov 07 '22 16:11 pariterre

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

liodali avatar Nov 07 '22 21:11 liodali

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!;
  }

pariterre avatar Nov 07 '22 22:11 pariterre

thnx i will check why thats happen sorry for late reply

liodali avatar Nov 08 '22 17:11 liodali

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

liodali avatar Nov 08 '22 17:11 liodali