Displaying dynamic maps

Kentico offers two ways of displaying dynamic maps on a page:

  • Document-related maps - display geographical locations based on the properties of specified documents. You can display multiple locations at the same time.
  • Data source maps - displays geographical location based on a data source web part. For example, a documents data source, query data source, xml data source web part or others. You can display multiple locations at the same time.

Either of these can use the Google maps or Bing maps service.

Document-related maps allow you to display multiple predefined places on a map. The places that the map displays are loaded from documents that you specify. The usual example is a list of documents, each representing a different company office. By default, the CMS.Office document type can be used for this purpose, but any document type with fields specifying a geographical location will do. The web part (Google maps web part or Bing maps web part) then loads the geographical coordinates off of these documents and displays them on the map.

The process consists of two steps:

  1. Setting up the documents from which the map loads data.
  2. Placing a document-related map on a page.

Documents from which you can display data on a map

The documents from which you can display data on a map need to have fields that represent a geographical location. These documents need to have either of these:

  • Two fields representing latitude and longitude
    —OR—
  • A field representing an address in a human readable form.

You can use the predefined CMS.Office document type to load data onto a map. You can also use the document type as a reference when creating your own document types.

  1. In the Pages application,navigate to the page on which you want to display the map.

  2. Switch to the Design tab.

  3. Place the Google maps or the Bing maps web part on the page. The web part properties dialog opens.

  4. Specify the Path to the documents from which you want the map to load data.

  5. Select the Document types that you want the map to load. For example, CMS.Office.

  6. Load a human-readable address onto the map

    If you want the map to use a human-readable address, specify the Field name that the Document types use for location in  Location field property. For example, OfficeAddress1 in the CMS.Office document type loads the first address line.

    • You can select the Use server processing option if you want the server to process and cache the processed (translated to latitude and longitude) Location or address field. If you decide to do so, please check that your map service query limits (IP-based) are sufficient for your needs.—OR—

Load coordinates onto the map

If you want the map to use to use coordinates, specify the Field names that the Document types use for longitude and latitude in the Longitude field and Latitude field properties. For example, OfficeLatitude1 and OfficeLongitude1 in the CMS.Office document type.

- Using latitude and longitudeallows the system to process the location faster. These properties can also be more accurate.
  1. Fill in either the Default location or address or the DefaultLatitude and DefaultLongitude fields. These fields represent the map’s initial view location.
  2. Specify the rest of the web part properties, especially in the Transformation, Content, and Map properties categories. Hover over a property to see its description.
  3. Click OK.

The page now displays a map with the location entered into the documents that you specified.

Data source maps

Data source maps allow you to display multiple places on a map. The places that the map displays are loaded from a predefined data source web part. The usual example is a Document data source web part, which the map uses to load data from a list of documents. Each of the documents can represent a different company office, for example. By default, the CMS.Office document type can be used for this purpose, but any document type with fields specifying a geographical location will do. The web part (Basic Google maps web part or Basic Bing maps web part) then loads the geographical coordinates off of these documents and displays them on the map.

The described process uses the Document data source web part.

The process consists of the following:

  1. Setting up the documents from which the map loads data.
  2. Placing a data source that defines which documents are loaded into the map
  3. Placing a data source map on a page.

Documents from which you can display data on a map

The documents from which you can display data on a map need to have fields that represent a geographical location. These documents need to have either of these:

  • Two fields representing latitude and longitude
    —OR—
  • A field representing an address in a human readable form.

You can use the predefined CMS.Office document type to load data from onto a map. You can also use the document type as a reference when creating your own document types.

Placing a document data source

  1. In the Pages application,navigate to the page on which you want to display the map.
  2. Switch to the Design tab.
  3. Place the Documents data source web part on the page. The web part properties dialog opens.
  4. Specify the Path to the documents from which you want the map to load data.
  5. Select the Document types that you want the map to load. For example, CMS.Office.
  6. Click OK.

You can now connect the data source to a map web part.

Placing a data source map on a page

  1. In the Pages application,navigate to the page on which you want to display the map.

  2. Switch to the Design tab.

  3. Place the Basic Google maps or the Basic Bing maps web part on the page. The web part properties dialog opens.

  4. Enter the Data source name.

  5. Load a human-readable address onto the map

    If you want the map to use a human-readable address, specify the Field name that the Document types use for location in  Location field property. For example, OfficeAddress1 in the CMS.Office document type loads the first address line.

    • You can select the Use server processing option if you want the server to process and cache the processed (translated to latitude and longitude) Location or address field. If you decide to do so, please check that your map service query limits (IP-based) are sufficient for your needs.—OR—

Load coordinates onto the map

If you want the map to use to use coordinates, specify the Field names that the Document types use for longitude and latitude in the Longitude field and Latitude field properties. For example, OfficeLatitude1 and OfficeLongitude1 in the CMS.Office document type.

- Using latitude and longitudeallows the system to process the location faster. These properties can also be more accurate.
  1. Fill in either the Default location or address or the DefaultLatitude and DefaultLongitude fields. These fields represent the map’s initial view location.
  2. Specify the rest of the web part properties, especially in the Transformation, Content, and Map properties categories. Hover over a property to see its description.
  3. Click OK.

The page now displays a map with the location entered into the documents that you specified in the Document data source web part.