Filter settings
Feature Introduction
Custom filters can be added to a layer to help users find most relevant information as soon as possible. It is quite often very important when you want to show lots of Point of Interests. Smartly designed filter settings will dramatically improve user experience. Thus, we strongly recommend developers to make use of this feature.
In general, there are two ways to implement filter settings. The first option is to use the layar filters provided on the publishing site. This is also the common way to add filters. Another option is that you can design and use your own filter settings. In this section, we will only explain the first option.
Key Steps to Implement
Configuration on the publishing site
On the publishing site, filters are managed under the "Settings" tab. There are 5 types of filters. They are all optional, however, the Range Slider is added by default after a layer is registered. the following screenshot shows how they look like:
The detailed definition of each filter is listed below:
- Text box: limited to 3 text boxes per layer
Fields | Required/Default Value | Example | Explanation |
---|---|---|---|
Label | Mandatory | "Search terms" | The label to be displayed in the filter settings view |
Default value | Optional / Empty | "" | Default value to display and use in the search box |
- Slider: limited to 3 sliders per layer
Fields | Required/Default Value | Value | Example | Explanation |
---|---|---|---|---|
Label | Mandatory | String | "Max price" | The label to be displayed on top of the slider |
Label Unit | Mandatory | String | "\u20ac" | The unit to be associated with the label, unicode supported (here e.g. €) |
Max value | Mandatory / 0 | Integer | 2000000 | The maximum value of the slider |
Min value | Mandatory / 0 | Integer | 10000 | The minimum value of the slider |
Default value | Mandatory / 0 | Integer | 500000 | The default value of the slider |
- Range Slider: Limited to 1 range slider per layer
Fields | Required/Default Value | Value | Example | Explanation |
---|---|---|---|---|
Label | Mandatory | String | "Max price" | The label to be displayed on top of the slider |
Label Unit | Mandatory | String | "\u20ac" | The unit to be associated with the label, unicode supported (here e.g. €) |
Max value | Mandatory / 0 | Integer | 2000000 | The maximum value of the slider |
Min value | Mandatory / 0 | Integer | 10000 | The minimum value of the slider |
Default value | Mandatory / 0 | Integer | 500000 | The default value of the slider |
- RadioButton List: Limited to 1 RadioButton list per layer
Fields | Required/Default Value | Value | Example | Explanation |
---|---|---|---|---|
label | Mandatory / Empty | String | "Choose industry" | The label to be displayed above the radio list |
options: Value |
Mandatory / Empty |
Array of Strings | ["1000", "1001", "1002"] | These are the internal values used to define the various options. This value is passed as parameter in the query for the POI's. |
options: Display Text |
Mandatory / Empty | Array of Strings | ["all industries", "administrative", "commercial"] | The are the values shown to the user, each corresponding to one option value. |
options: Default |
Mandatory / Empty | String | "1000" | The value that is selected by default |
- Checkbox List: Limited to 1 Checkbox list per layer
Fields | Required/Default Value | Value | Example | Explanation |
---|---|---|---|---|
label | Mandatory / Empty | String | "Choose industry" | The label to be displayed above the radio list |
options: Value |
Mandatory / Empty |
Array of Strings | ["1000", "1001", "1002"] | These are the internal values used to define the various options. This value is passed as parameter in the query for the POI's. |
options: Display Text |
Mandatory / Empty | Array of Strings | ["all industries", "administrative", "commercial"] | The are the values shown to the user, each corresponding to one option value. |
options: Default |
Mandatory / Empty | Array of Strings | ["1000", "1001"] | The values that ares selected by default |
All these filter settings will appear in the layer settings page in Layar Reality Browser on the phone. If "Show filters before loading layer" is checked, this layer settings page will always appear before camera view is shown. The screenshot below shows how these filters will look like in Layar Reality Browser:
Example GetPOIs Request
http://examplelayer/FourthTutorial_FilterSettings.php?lang=en&countryCode=NL&lon=4.94745254517&userId=6f85d06929d160a7c8a3cc1ab4b54b87db99f74b&developerId=4441&developerHash=1b28b7444bde90c2da52aa051a18b2d57440b795&RADIOLIST=1&CHECKBOXLIST=1%2C2&version=4.0&radius=1500&CUSTOM_SLIDER=300000×tamp=1289231992753&lat=52.365852048&layerName=testlayerfilters&SEARCHBOX=&accuracy=100
According to the filter definition above, the filters have the following values in the getPOIs request.
Filter | Value in the getPOIs request |
---|---|
RADIOLIST | 1 |
CHECKBOXLIST | 1, 2 |
radius | 1500 |
CUSTOM_SLIDER | 300000 |
SEARCHBOX |
Now we know which filter and its value are passed through, In the web service, we will use these parameters to determine which POIs should be returned.
Tutorial & Sample Code
We have created a tutorial which further explains how to handle different types of filter settings in your web service. Sample Code is also attached to the end of the tutorial.