Example: Displaying offices on the map |
This example will show you how to display a list of offices and their location on the map.
Step 1 - Creating a new page with offices
Sign in as administrator to Kentico CMS Desk -> Content and click the root. Click New and choose to create a new Page. Enter the page name Offices and choose to create a blank page using the Simple layout. Click Save.
Now we need to add a list of offices. Switch to the design mode and add the Repeater web part. Set the following properties:
Click OK.
Step 2 - Geocoding your information
Now we will create two documents of type Office. Click the Offices page and click New. Choose to create a new Office and enter the following values:
Office 1:
Click Save and another. Office 2:
Click Save.
Please note: The Office document type already contains the Latitude and Longitude fields. If you're using a custom document type, you will need to define them. They must be of type Decimal number. You can call them as you need.
Step 3 - Displaying the content on the map
When you see the page now, it displays only a list of offices. Switch to the Design mode and add the Google services/Google Maps web part.
First, we will configure which documents should be displayed on the map. Set the following properties:
It ensures that all offices in the current site section will be shown. Now we specify the transformation used for the text displayed in the balloon:
Now we set the following values that specify how the map is displayed:
Click OK.
Sign out and see the page. It will look like this:
The is the overview map with balloons. When you mouse-over a balloon, you will see the office name. When you click a balloon or an office link in the list, you will see the detailed view:
|