Skip to main content Skip to complementary content

Loading map data

To be able to create a map visualization, you need access to geographical data that connects to the data in your app. Geographical data comes in the form of either:

  • geopoint data (latitude, longitude) for a single location, such as a city
  • area data (polygons of geopoints) to represent regions or countries

When you use Add data, Qlik Sense will try to recognize if your data contains cities or countries. If successful, a new field containing geographical information is created automatically.

Warning noteWhen using Add data, data profiling must be enabled. This is the default selection. If you disable data profiling, the geographical data is not detected and the new field containing geographical information is not created.

If cities are recognized during data preparation, the new field contains geopoints, and if countries are recognized the new field contains area polygon data. This field is named <data field>_GeoInfo. For example, if your data contains a field named Office containing city names, a field with geopoints named Office_GeoInfo is created.

Information noteQlik Sense analyzes a subset of your data to recognize fields containing cities or countries. If the matching is less than 75 percent, a field with geographical information will not be created.

If a field is not recognized as geographical data, you can manually change the field type to geographical data.

See: Changing field types

Fields with geographical information do not display the geopoint or polygon data in the Associations preview panel or in the Tables view. Instead, the data is indicated generically as [GEO DATA]. This improves the speed with which the Associations and Tables views are displayed. The data is available, however, when you create visualizations in the Sheet view.

If your app data does not contain geographical entities that are recognized, or if you load data using the data load script, you need to load the geographical data from a separate file instead.

You can load point data from an Excel or KML file, or area data from a KML file. By default, all fields are selected in the data selection dialog, even if they do not contain any data. A KML file could contain, for example, area data but no point data. Although there is nothing wrong with loading empty fields, it can be inconvenient to have empty fields when you are working with the map visualization. Adding a dimension without any data to a map will not generate any visual output and could confuse a user. Therefore, you should clear the selections of all empty data fields in the data selection dialog, before you load the data.

Information noteThe maximum number of values in a point layer map is 3333.

Creating a map from data in a KML file

Normally, a KML file contains point data, area data, or both. In the following screenshot, from the data selection dialog, you can see that the selection of the field FloridaCounties.Point has been cleared because the field does not contain any data. By clearing the field you will not run the risk of creating map dimensions without any data.

When you click Insert script, the following script is generated:

LOAD
FloridaCounties.Name,
FloridaCounties.Area
FROM 'lib://data 7/FloridaCounties.kml'
(kml, Table is [Florida Counties KML]);

 

If the selection of the empty field had not been cleared, the script would also have contained the following string:

FloridaCounties.Point,

 

When you run the script and add a map chart to the sheet, you can add either FloridaCounties.Area (area) or FloridaCounties.Name (area) as a dimension.

Although you will get the same visual result with either of the fields (a map with the counties), there will be a difference when you hover (tap on a touch device) over a county. If you select FloridaCounties.Name (area), the name of the county is shown as a tooltip, and if you select FloridaCounties.Area (area) the area data is shown. The name of the county is undoubtedly more interesting. In addition, loading the field FloridaCounties.Area is much slower than loading the field FloridaCounties.Name.

Optionally, you can also add a measure and use coloring by measure to reflect the difference in measure value between the different counties.

Information noteIf the KML file contains neither point data nor area data, you cannot load data from that file. If the KML file is corrupt, an error message is displayed, and you will not be able to load the data.

Creating a map from point data in an Excel file

You can create a map by using point data (coordinates) from an Excel file.

Point data formats

Point data can be read from Excel files. Two formats are supported:

  • The point data is stored in one column. Each point is specified as an array of x and y coordinates: [x, y]. With geospatial coordinates, this would correspond to [longitude, latitude].

    When using this format, you need to tag the point data field with $geopoint;.

    See: Loading point data from a single column with the data load script

  • The point data is stored in two columns, one for latitude and one for longitude.

In the following examples we assume that the files contain the same data about the location of a company's offices, but in two different formats.

Loading point data from a single column with the data load script

The Excel file has the following content for each office:

  • Office
  • Location
  • Number of employees

The load script could look as follows:

LOAD
Office,
Location,
Employees
FROM 'lib://Maps/Offices.xls'
(biff, embedded labels, table is (Sheet1$));

 

The field Location contains the point data and it is necessary to tag the field with $geopoint so that it is recognized as a point data field. You also need to tag the field Office with $geoname so that it is recognized as the name of a geopoint. Add the following lines after the last string in the LOAD command:

TAG FIELDS Location WITH $geopoint;
TAG FIELDS Office WITH $geoname;

The complete script then looks as follows:

LOAD
Office,
Location,
Employees
FROM 'lib://Maps/Offices.xls'
(biff, embedded labels, table is (Sheet1$));
TAG FIELDS Location WITH $geopoint;
TAG FIELDS Office WITH $geoname;

 

Run the script and create a map visualization. Add the point dimension to your map.

Loading point data from separate latitude and longitude columns with the data load script

The Excel file has the following content for each office:

  • Office
  • Latitude
  • Longitude
  • Number of employees

The load script could look as follows:

LOAD
Office,
Latitude,
Longitude,
Employees
FROM 'lib://Maps/Offices.xls'
(biff, embedded labels, table is (Sheet1$));

 

Combine the data in the fields Latitude and Longitude to define a new field for the points.

Run the script and create a map visualization. Add the point dimension to your map.

You can choose to create the dimension Location in the script by adding the following string above the LOAD command:

LOAD *, GeoMakePoint(Latitude, Longitude) as Location;

The function GeoMakePoint() joins the longitude and latitude data together.

You also need to tag the field Office with $geoname so that it is recognized as the name of a geopoint. Add the following lines after the last string in the LOAD command:

TAG FIELDS Office WITH $geoname;

The complete script then is as follows:

LOAD *, GeoMakePoint(Latitude, Longitude) as Location;
LOAD
Office,
Latitude,
Longitude,
Employees
FROM 'lib://Maps/Offices.xls'
(biff, embedded labels, table is (Sheet1$));
 
TAG FIELDS Office WITH $geoname;

Run the script and create a map visualization. Add the point dimension to your map.

Number of points displayed

For performance reasons, the number of points that can be displayed is limited to 3333. However, a display value of over 1000 on a single map may affect readability. By making selections, you can reduce the amount of data to display.

Learn more

 

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!