PoiViewer 2.0 plugin
Introduction
You can show your place of interest on your own site using the PoiViewer 2.0 plugin. There are three versions of this plugin.
- The free version can easily be added to your own website in a matter of minutes. For this free version, please refer to the section below.
- The basic version works the same way as the free version, but allows for more customization. If you are interested in this version, please contact sales[at-r.].
- With the advanced version, you can adapt the plugin to fit your site's design, in layout, placement of the components, color, fonts, mobile friendliness, ... If you are interested in this version, please contact sales[at-r.].
Free PoiViewer plugin
Via the RouteYou website
- On www.routeyou.com, surf to the place of interest you want to show on your website.
- Click (Share).
- Click Embed.
- Copy the code.
- Paste the code into the HTML of your own website, adjust the width and height if necessary.
Getting started
This version is iframe-based. To add it to your site, add the following code where you want the plugin to appear:
<iframe src="//plugin.routeyou.com/poiviewer/free/?language=en" width="800" height="500" frameborder="0" allowfullscreen></iframe>
You can change the iframe's width and height to suit your website.
Configuring the plugin
The parameters should be passed in the URL of the iframe. Numbers, strings and booleans can be passed in a simple key=value pattern. Complex values can be passed as JSON encoded strings (remember that these will then need to be URL-encoded as well).
You can find the list of parameters in the "Parameters" section. For the free version, not all parameters are available. The available parameters are marked with .
Example
The example below will show you Ghent's city hall. Both the interface and the place of interest's data will be in English.
<iframe src="//plugin.routeyou.com/poiviewer/free/?language=en&params.poi.id=2507179" width="800" height="500" frameborder="0" allowfullscreen></iframe>
Basic version (iframe)
Getting started
This version is iframe-based and works the same way as the free version. To add it to your site, add the following code where you want the plugin to appear:
<iframe src="//plugin.routeyou.com/poiviewer/basic/?token=<your RouteYou web service token, see below>&language=en" width="800" height="500" frameborder="0" allowfullscreen></iframe>
You can change the iframe's width and height to suit your website.
Configuring the plugin
The parameters should be passed in the URL of the iframe. Numbers, strings and booleans can be passed in a simple key=value pattern. Complex values can be passed as JSON encoded strings (remember that these will then need to be URL-encoded as well).
You can find the list of parameters in the "Parameters" section. Some parameters are not applicable to this version. The available parameters are marked with .
Upgrading from the free version
To upgrade from the free version, simply change the /free/
part in the URL to /basic/
and add your key or token (see below) to the list of parameters.
For example, if you currently have this:
<iframe src="//plugin.routeyou.com/poiviewer/free/?language=en&params.poi.id=2507179" width="800" height="500" frameborder="0" allowfullscreen></iframe>
You will need to change it to this:
<iframe src="//plugin.routeyou.com/poiviewer/basic/?key=<your RouteYou web service key, see below>&language=en&params.poi.id=2507179" width="800" height="500" frameborder="0" allowfullscreen></iframe>
Example
The example below will show you Ghent's city hall. Both the interface and the place of interest's data will be in English.
<iframe src="//plugin.routeyou.com/poiviewer/basic/?token=<your RouteYou web service token, see below>&language=en&params.poi.id=2507179" width="800" height="500" frameborder="0" allowfullscreen></iframe>
Advanced version (JavaScript)
Getting started
To add the advanced version of the plugin to your site, two pieces of code need to be added. First, you need to provide HTML div elements where the PoiViewer components will be placed. You can set their id's to any name you prefer, but make sure they are unique. You can position these divs in any way that fits your site design. The example code below will put the title first, then the map and the detail component (which will contain a.o. the POI's description and media) on the right of the map. You can omit any component by not creating a div for it and not passing a div id in the configuration object.
<div id="routeYouPoiViewerTitle"></div> <div id="routeYouPoiViewerDetail" style="margin-left: 10px; width: 300px; float: right;"></div> <div id="routeYouPoiViewerMap"></div>
Second, add the JavaScript code that launches the plugin. To minimise the load time of your page, it is best to put this code as far down the page as possible.
<script type="text/javascript" src="//plugin.routeyou.com/poiviewer/2.0.js"></script> <script type="text/javascript"> RTY.PoiViewer.load({ 'token': '<your RouteYou web service token, see below>', 'language': '<your language, see below>', 'title.div': 'routeYouPoiViewerTitle', 'map.div': 'routeYouPoiViewerMap', 'poiDetail.div': 'routeYouPoiViewerDetail' }); </script>
Tabs
You can also show a tabbed version of the PoiViewer plugin. Use the code below to show all components except the title in tabs.
<div id="routeYouPoiViewerTitle"></div> <div id="routeYouPoiViewerTabButtons" style="margin-bottom: 10px;"></div> <div id="routeYouPoiViewerTabPane"></div>
<script type="text/javascript" src="//plugin.routeyou.com/poiviewer/2.0.js"></script> <script type="text/javascript"> RTY.PoiViewer.load({ 'token': '<your RouteYou web service token, see below>', 'language': '<your language, see below>', 'title.div': 'routeYouPoiViewerTitle', 'tabButtons.div': 'routeYouPoiViewerTabButtons', 'tabPane.div': 'routeYouPoiViewerTabPane', 'tabPane.components': ['map', 'poiDetail'] }); </script>
Configuring the plugin
To further configure the plugin, add parameters from the "Parameters" section below as needed to the JavaScript object. Some parameters are not applicable to this version. The available parameters are marked with .
Some important guidelines:
- Make sure that each line ends with a comma, except the last line.
- Do not put quotes around numbers (integer or decimal) and boolean values (i.e. true and false).
Styling the plugin
The plugin will automatically use the CSS of the surrounding page, which means fonts, colors and most other styling will match your website. Some tips and important guidelines:
- If possible, set a default text color and font on your
<body>
element, this guarantees that all elements will at minimum use that styling. - Never target specific elements of the plugin through their class names or through pseudo-classes such as first-child or nth-child, as elements' class names, order and place in the DOM hierarchy may change without notice, breaking your implementation. There are many parameters available to hide certain elements and to change the order of some elements (see below).
- If you need to apply styling specifically to (parts of) the plugin, target only semantically appropriate tags (h2, p, ...) and keep it as general as possible.
Mobile-friendly
The plugin can be made responsive (different settings on small and large screens) by setting a responsive breakpoint with the layout.breakpoints parameter. Contact sales[at-r.] for more information.
Example
The example below will show you Ghent's city hall. Both the interface and the place of interest's data will be in English.
<script type="text/javascript" src="//plugin.routeyou.com/poiviewer/2.0.js"></script> <script type="text/javascript"> RTY.PoiViewer.load({ 'token': '<your RouteYou web service token>', 'language': 'en', 'title.div': 'routeYouPoiViewerTitle', 'map.div': 'routeYouPoiViewerMap', 'poiDetail.div': 'routeYouPoiViewerDetail', 'params.poi.id': 2507179 }); </script>
Parameters
Some parameters are not available in all versions. Each parameter is marked with the version(s) in which it is available:
- Free iframe plugin
- Basic iframe plugin
- Advanced JavaScript plugin
General
- token
Your RouteYou web service token. Do not put your web service key here. Consult this topic for more information on how to generate a token with your key.
Required (unless key is provided). - key
Your RouteYou web service key. You can put your web service key here if you cannot generate a server side web service token, but keep in mind that it is safer to use the token method, and your key may be blocked if it is abused by someone else.
Required (unless token is provided). - language
Lowercase ISO code of the interface language.
Possible values: 'en', 'nl', 'fr', 'de', 'es', 'it', 'ca'. Optional. Default: 'en'. - unit.system
The unit system to use. When using 'metric', all distances will be displayed in meters or kilometers; when using 'imperial', all distances will be displayed in feet or miles.
Possible values: 'metric', 'imperial'. Optional. Default: 'metric'.
Content
You can decide what to show with the following parameters.
- params.poi.id
The id of the place of interest to show.
Possible values: any integer that is a valid place of interest id. Required. - params.language
If set, show the place of interest in this language, regardless of the interface language. If omitted, the place of interest will be shown in the interface language (if available).
Possible values: an ISO code of a language in which the place of interest is available. Optional.
Layout and behaviour
The plugin adapts to the height of the user's browser window or the iframe. When resizing, the map takes the height of the title into account, while the detail component take the height of the tab buttons and title into account. The following parameters influence this behaviour.
- tabPane.position
The position of the place of interest info. Setting this to null will hide the info column, including all tabs. Setting this to 'left' or 'right' will put the info column on the left or right of the map.
Possible values: null, 'left', 'right'. Optional. Default: 'right'. - layout.breakpoints
A list of responsive breakpoints. Different settings can be applied when the screen width crosses such a breakpoint. Contact sales[at-r.] for more information.
Possible values: a list of integers equal to or larger than 0. Optional. Default: [0]. - layout.map.height.enable
Whether or not to adjust the map's height to the browser window height. If you disable this, you will need to set the height of the map div explicitly.
Possible values: true, false. Optional. Default: true. - layout.map.height.minimum
The minimal height of the map. The map's height will never be smaller than this, even when the browser window height gets smaller.
Possible values: any integer larger than 0. Optional. Default: 200. - layout.map.height.remainder
The space to leave when making the map fit the browser window height. Setting this to zero will make the map fit the available vertical space exactly. Setting it to anything higher will leave room above and/or below the map.
Possible values: any integer equal to or larger than 0. Optional. Default: 100. - layout.map.height.subtract.tabButtons
Whether or not to take the height of the tab buttons into account when calculating the map's height.
Possible values: true, false. Optional. Default: false. - layout.map.height.subtract.title
Whether or not to take the height of the title into account when calculating the map's height.
Possible values: true, false. Optional. Default: true. - layout.poiDetail.height.enable
Whether or not to adjust the POI detail component's height to the browser window height.
Possible values: true, false. Optional. Default: true. - layout.poiDetail.height.minimum
The minimal height of the POI detail component. The component's height will never be smaller than this, even when the browser window height gets smaller.
Possible values: any integer larger than 0. Optional. Default: 200. - layout.poiDetail.height.remainder
The space to leave when making the POI detail component fit the browser window height. Setting this to zero will make the component fit the available vertical space exactly. Setting it to anything higher will leave room above and/or below the component.
Possible values: any integer equal to or larger than 0. Optional. Default: 100. - layout.poiDetail.height.subtract.tabButtons
Whether or not to take the height of the tab buttons into account when calculating the POI detail component's height.
Possible values: true, false. Optional. Default: true. - layout.poiDetail.height.subtract.title
Whether or not to take the height of the title into account when calculating the POI detail component's height.
Possible values: true, false. Optional. Default: true.
Media
The following parameters change the behaviour of the place of interest media.
- media.position
The position of the media in relation to the description. Setting this to null will put the media above the description. Setting this to 'left' or 'right' will put the media on the left or right of the description, allowing the description to flow around it.
Possible values: null, 'left', 'right'. Optional. Default: null. - media.width
The width of the image or video. Setting this to null will make the image fill the available horizontal space (or half of that when the position is set to 'left' or 'right').
Possible values: any integer larger than 0, or null. Optional. Default: null. - media.height
The height of the image or video.
Possible values: any integer larger than 0. Optional. Default: 250.
Title component
- title.visible
If true, the title will be shown above the other components.
Possible values: true, false. Optional. Default: true. - title.div
The HTML div element on which to place the title.
Possible values: any valid div id, a DOM element, or null. Optional. Default: null.
Map component
- map.div
The HTML div element on which to place the map.
Possible values: any valid div id, a DOM element, or null. Optional. Default: null. - map.api.key
The Google API key with which to load the Google Maps API. Google Maps layers will only be available if this is set. Consult this topic for more information on the Google API key and how to obtain one.
Possible values: any valid Google API key. Optional. Default: null. - map.availableTypes
A list of map base layers and overlays the user can choose from.
Possible values: a JavaScript array containing one or more of the map layer names listed below,['
(layer name)', '
(layer name)',
(...)]
. Optional. Default: ['roadmap', 'satellite', 'osm', 'terrain', 'hybrid', 'satellite45'].
Base layer names:- osm
OpenStreetMap. - roadmap
Google Maps roadmap. Only available with a Google API key. - satellite
Google Maps satellite. Only available with a Google API key.
- terrain
Google Maps terrain overlay (on the roadmap base layer). Only available with a Google API key. - hybrid
Show labels on the Google Maps satellite base layer. Only available with a Google API key. - satellite45
Show tilted imagery on the Google Maps satellite base layer. Only available with a Google API key.
- osm
- map.type
The initial map type.
Possible values: one of the base layer names listed above. Optional. Default: 'roadmap' if the Google API key is set, 'osm' otherwise. - map.overlays
The initial map overlays.
Possible values: a JavaScript array containing one or more of the overlay names listed above,['
(overlay name)', '
(overlay name)',
(...)]
. Optional. Default: ['hybrid']. - map.center
The initial center of the map. If both center and bounds (see below) are set, the bounds will take precedence.
Possible values: a JavaScript object of the form{ lat:
(decimal number), lon:
(decimal number)}
. Optional. Default: null. - map.zoom
The initial zoom level of the map. This can be used together with map.center to define the initial area to show on the map.
Possible values: any integer between 0 and 18, inclusive. Optional. Default: 1. - map.bounds
The initial area to show on the map. If both center and bounds are set to null, the map will pan and zoom to the optimal bounds for the search parameters.
Possible values: a JavaScript object of the form{ min: { lat:
(decimal number), lon:
(decimal number)}, max: { lat:
(decimal number), lon:
(decimal number)} }
. Optional. Default: null.
Detail component
- poiDetail.div
The HTML div element on which to place the detail component.
Possible values: any valid div id, a DOM element, or null. Optional. Default: null. - poiDetail.show.header
If true, the 'Place of interest details' header will be shown on the detail component.
Possible values: true, false. Optional. Default: true. - poiDetail.poi.show.name
If true, the POI's name will be shown on the detail component.
Possible values: true, false. Optional. Default: true. - poiDetail.poi.show.typeIcon
If true, the POI's type icon will be shown on the detail component.
Possible values: true, false. Optional. Default: false. - poiDetail.poi.show.media
If true, the POI's media will be shown on the detail component.
Possible values: true, false. Optional. Default: true. - poiDetail.poi.show.description
If true, the POI's description will be shown on the detail component.
Possible values: true, false. Optional. Default: true.
Tabs
- tabButtons.div
The HTML div element on which to place the tab buttons.
Possible values: any valid div id, a DOM element, or null. Optional. Default: null. - tabPane.div
The HTML div element on which to place the tabbed components.
Possible values: any valid div id, a DOM element, or null. Optional. Default: null. - tabPane.components
A list of components that should be shown as tabs.
Possible values: a JavaScript array containing one or more of the component names listed below,['
(component name)', '
(component name)',
(...)]
. Optional. - tabPane.activeTab
Which tab to show when the plugin loads. If set to null, the first tab from the components list will be shown.
Possible values: one of the component names listed below, or null. Optional. Default: null.
Component names:- map
- poiDetail
Compatibility
The PoiViewer 2.0 plugin is compatible with all major browsers. However, to ensure full compatibility, it is vital that the pages on which you place the plugin begin with a valid DOCTYPE, for example:
<!DOCTYPE html> <html ...
Plans & pricing
For a list of the RouteYou functionalities per type of account, take a look at the RouteYou Functionality Overview per account type.