Routing interface

This section describes how to add the OSRM routing interface to a c2cgeoportal application.


To add this feature, you need a OSRM backend server with version >= 5.8.

Adding the routing interface to the template

For a working example, check the Demo alternative UI.

Add the button to the gmf-app-bar:

<button ngeo-btn class="btn btn-default" ng-model="mainCtrl.routingfeatureActive"
        data-toggle="tooltip" data-placement="left" data-original-title="{{'Routing'|translate}}">
  <span class="fa fa-map-signs"></span>

Then, add the routing component to the gmf-app-tools-content area:

<div ng-show="mainCtrl.routingfeatureActive" class="row">
  <div class="col-sm-12">
    <div class="gmf-app-tools-content-heading">
      <a class="btn close" ng-click="mainCtrl.routingfeatureActive = false">&times;</a>
    <ngeo-routing ngeo-routing-map="">

mainCtrl.routingfeatureActive and are part of gmf.AbstractDesktopController and do not need to be defined in your interface controller, as long as it extends AbstractDesktopController.


To configure the routing feature, the constants ngeoRoutingOptions and ngeoNominatimSearchDefaultParams can be defined. Add them to your interfaces_config section in your vars.yaml file:

        <<: *interface
                <<: *constants
                    - backendUrl:
                    - profiles:
                        - label: Car
                          profile: routed-car
                        - label: Bike (City)
                          profile: routed-bike
                    countrycodes: CH


required, string URL to an OSRM backend server instance with version >= 5.8


not required, ngeox.RoutingProfile

label: string, label to display in the drop-down-menu for the profile

profile: string, url-path of the profile, example:<params>
    ^                 |     ^     |    ^
    '                 |     '     |    '
backendUrl            |  profile  | osrm query

If more than one profile is supplied, the component will show a drop-down-menu for the user to select a profile.


not required, dictionary of string-parameters

Configures the nominatim search, which is used to search for addresses and features in the routing search fields. Check the OpenStreetMap wiki for a list of all available parameters.

In the example, 'countrycodes': 'CH' restricts the search to Switzerland.