flutteropenrouteservice

Open_route_service flutter


Anybody here who has tried integrating ORS api to flutter? I am using this package open_route_service, but I can only manage to get the route from Point A to Point B. But what if I also want to pass on the avoid_polygons? How can I do it? There are no sample codes for it. Just this one, and I am good to go, on how to use this API. This is my initial code that gets the routing data:

final List routeCoordinates =
await openrouteservice.directionsMultiRouteCoordsPost(
coordinates: [
ORSCoordinate(
latitude: position.latitude, longitude: position.longitude),
ORSCoordinate(
latitude: lat,
longitude: lon,
),
],
profileOverride: profileOverride,
);

Solution

  • Creator of open_route_service here. I am extremely disheartened that I did not see your question earlier, or I would have tried solving it for you months ago.

    Whenever you are facing any trouble with open-source libraries, you can feel free to open up an Issue in the Github repository so that maintainers can jump on it ASAP. For this package, it is just me, but rest assured I have opened up a minimal issue on my package repository and will try getting it resolved: https://github.com/Dhi13man/open_route_service/issues/15

    And I would always appreciate the community's help in maintaining it as well. :)

    EDIT: As per openrouteservice docs, it seems like all you need to do is pass the map {"avoid_polygons": {"empty": "true"}} in the options parameter of directionsMultiRouteCoordsPost method, just as it is passed in Directions POST APIs.