This site uses cookies to improve your experience and the quality of our services. By using this site you agree to its use of cookies. More information Hide

RoutePlanner Plugin

You can plug in the Route Planner using the RoutePlanner plugin or RoutePlanner widget in your own website.

REMARK:This is a RouteYou+ service!

What do we need from you?

For a standard routeplanner, RouteYou has an extensive toolbox with a set of functionalities you can offer to your users. From this toolbox you can build up your own custom set for your RoutePlanner. These will then be defined in a configuration file, which determines the overall look and feel of your planner. This configuration file is build up by RouteYou and given a unique ID, which you will need to embed the routeplanner in your website.

A subset of some tools is given below. To get an exclusive list of posibilities contact sales[at-r.].

Cartographic basemap

The RouteYou routeplanner supports multiple cartographic basemaps e.g. Google Maps, Google Satellite Imagery, Google Terrain. Other layers are also possible like the popular 'knooppuntennetwerk', topographic map etc. Look before you leap, consult RouteYou and ask what possibilities there are.

Default zoom

Define the extents of your startup routeplanner. When a user arrives at your website, the routeplanner will be zoomed in on the these extents.

Routingoptions

Define the routingposibilities you want to offer to your users. Following is a non-exclusive list of routing options you can chose from:

POI

Define the poi's you want to view in your RoutePlanner.

What do you need to plug in your RoutePlanner?

To get your planner up and running on your website You will need a javascript snippit, which you will need to get the planner widget embeded in you website. Listed below are some examples of the widget and its paramaters.

Examples

<script type="text/javascript">
    routeyou_planner_width = 500;
    routeyou_planner_height = 500;
    routeyou_planner_language = 'nl';
    routeyou_planner_user = <your User ID>;
    routeyou_planner_redirect = '<redirect to my website>';
    routeyou_planner_configuration = '<your Configuration ID>';
</script>
<script src="http://ws.routeyou.com/planner.js" type="text/javascript"></script>

Variables

More Info

Redirect to a RouteView

The routeyou_planner_redirect parameter gives you the possibility to redirect the user to the given url after planning a route. Most likely you will want to redirect the user to the page where you plugged in the RouteViewer widget. To link the routeplanner to the routeviewer you will want to build up a redirect url like:

routeyou_planner_redirect = http://<mywebsite>/routeview?route=%id%; 

The %id% replaces a fixed ID. In this way the url becomes variable. The ID of the route you just planned is passed as a GET parameter with the name "route". Read how you get the ID of a newly created route on your routeplanner widget here.

On the destination page of the RouteViewer, you hav to 'catch' the id of the route. this 'id' should be passed as parameter routeyou_viewer_route to the RouteViewer.

Following snippit has been worked out using javascript (you can also use .Net or PHP to do this)

<script type="text/javascript">
function getUrlParameter(name) {
    name = name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');
    var regex = new RegExp('[\?&]' + name + '=([^&#]*)');
    var results = regex.exec(window.location.href);
    if (results == null) {
        return '';
    } else {
        return results[1];
    }
}
</script>
<script type="text/javascript">
    routeyou_viewer_width = 700;
    routeyou_viewer_height = 410;
    routeyou_viewer_color_background = 'EBE2DD';
    routeyou_viewer_language = 'nl';
    routeyou_viewer_route = getUrlParameter('route');
</script>
<script src="http://ws.routeyou.com/viewer.js" type="text/javascript"></script>

Zoom in on the map on your area of interest

You can override the default zoom, defined in the configuration file, with the routeyou_planner_map_bounds parameter. Provide 2 coordinates (in WGS84) defining the bounding box of your area of interest. See the code below for an example.

<script type="text/javascript">
    routeyou_planner_width = 500;
    routeyou_planner_height = 500;
    routeyou_planner_language = 'nl';
    routeyou_planner_user = <your User ID>;
    routeyou_planner_redirect = '<redirect to my website>';
    routeyou_planner_configuration = '<your Configuration ID>';

    routeyou_planner_map_bounds = {
        "min": {
            "lat": 50.694345,
            "lon": 3.265777
        },
        "max": {
            "lat": 51.370424,
            "lon": 4.428178
        }
    };
</script>
<script src="http://ws.routeyou.com/planner.js" type="text/javascript"></script>

The lat and lon values should be defined in WGS84 in decimal degrees.

Setting a default unit system

The RoutePlanner supports two unit systems to display the length of a route: meter and mile. It is possible to set a default unit system for the RoutePlanner. Normally, the default unit system is defined in the RouteYou Configuration File. In some cases, it is desirable that can provide a default unit system instead of using the RouteYou Configuration File default setting. This can be done with the variable routeyou_planner_unit_system. This variable can have the following values: 'metric' (meter) or 'imperial' (mile). See the code below for an example.

<script type="text/javascript">
    routeyou_planner_width = 500;
    routeyou_planner_height = 500;
    routeyou_planner_language = 'nl';
    routeyou_planner_user = <your User ID>;
    routeyou_planner_redirect = '<redirect to my website>';
    routeyou_planner_configuration = '<your Configuration ID>';
    routeyou_planner_unit_system = 'metric';
</script>
<script src="http://ws.routeyou.com/planner.js" type="text/javascript"></script>

© 2006-2017 RouteYou - www.routeyou.com