ActiveReports 10
Work with Data
ActiveReports 10 > ActiveReports User Guide > How To > Page Report/RDL Report How To > Work with Report Controls and Data Regions > Work with Map > Work with Data

The Map data region uses the following two types of data:

Spatial Data

Spatial data is a set of coordinates that defines a map element. Each map layer must have spatial data of one of the following types - a polygon, a line, or a point.

Spatial data can be either embedded in a map or can be linked to a map layer. The only difference between the two is that while having the spatial data embedded in a map, there is no separate file to locate or to keep track of when you move the report between projects or machines.

ActiveReports provide numerous ways to add spatial data to the map. You can either use the Map Wizard and add data from an ESRI shapefile or use the Map Layer Data Properties dialog for using advance options. You can also add spatial data from the Properties Window.

To add spatial data using Map Wizard

  1. From the Visual Studio toolbox, drag and drop a Map control onto the design surface.
  2. In the Select a Map Template wizard that appears, select From ESRI file.
  3. In the Open dialog that appears, navigate to the folder that contains the .shp and .dbf files, select the .shp file, use the Map Resolution slider to simplify vector data and click Open.

This option automatically imports the spatial data stored in the shapefile and adds a related layer to the map control.

To add spatial data using the Map Layer Data Properties dialog

The Map Layer Data Properties dialog provide the following advance options to add spatial data. For more information on Map Layer Data Properties dialog, see Map.

  • Embedded : Use this option where you want to add spatial data from an ESRI file along with an additional option of adding custom spatial data fields if required.

    To add Spatial data from an ESRI file using the Embedded option

    1. In the Map Layer Data Properties dialog, on the General page, select the Embedded option and click the Browse button.
    2. In the Open dialog that appears, navigate to the folder that contains the .shp and .dbf files.
    3. Select the .shp file, use the Map Resolution slider to simplify vector data and click Open. The fields list gets populated with spatial data fields that are added from the shapefile.
    4. In Dataset, set the name of the dataset.
    5. In the Fields list, click the Add (+) button to add a new empty spatial data field.
    6. With the newly added spatial data field selected in the list, in Field name, enter the name of the field.
    7. In Field type, set the field type of newly added spatial data field.
    8. Click OK to close the dialog.
    Note : In order to apply the new spatial data field on a layer, you must provide its value for each map layer element like polygons, points or lines in the added map layer Designer Collection Editor dialog.
  • Linked : Use this option when you just want to add spatial data from an ESRI shapefile without any additional modifications or additions .

    To add Spatial data from an ESRI file using the Linked option

    1. In the Map Layer Data Properties dialog, on the General page, select the Linked option and click the Browse button.
    2. In the Open dialog that appears, navigate to the folder that contains the .shp and .dbf files.
    3. Select the .shp file and click Open.
    4. Click OK to close the dialog.
  • Dataset : Use this option when you have a dataset that stores a spatial data field to provide spatial data to the Map. You can directly use the data fields from the dataset to display data on a map layer without setting the match fields for analytical data. Therefore, it also provides you an additional option of having different dataset for analytical data and spatial data respectively.

    To add Spatial data from a Dataset

    1. In the Map Layer Data Properties dialog, on the General page, select the Dataset option.
    2. In Dataset, set the name of the dataset.
    3. In Field name, enter the data field name that contains the spatial data.
      Caution: Simply type the name of the dataset field that contains spatial data. For example, enter value as StateName, not as =[StateName]. 
    4. Click OK to close the dialog.
  • Analytical : Use this option when you want to use the spatial data field from the same dataset that you may use for adding Analytical data to the layer. For using this option you need to first set the dataset for analytical data and then use the spatial data field from the dataset to provide spatial data to the map layer.

    To add spatial data from Analytical data 

    1. Configure Analytical data for the Map control. See the dropdown section below to learn adding Analytical data.

      Note : Once the Analytical data has been set, the Analytical option on the General page of the Map Layer Data Properties dialog becomes active.
    2. In the Map Layer Data Properties dialog, on the General page, select the Analytical option.
    3. In Field name, enter the data field name that contains the spatial data.
      Caution: In Field name, enter the data field name as =[StateName], not as StateName. 
                                       
    4. Click OK to close the dialog.

To add spatial data using Properties Window

These steps assume that you have a Map control containing at least one map data layer placed on the design surface. To learn how to add a layer to the Map control, see Use Layers.

  1. With the Map control selected, go to the Properties window, click the Layers (Collection) property and then click the ellipsis button that appears.
  2. In the LayerDesigner Collection Editor that appears, under Members, select the map data layer you want to use and expand the SpatialData property.

  3. In Type, choose the spatial data source of the layer from the following supported options:
    • Embedded: Use this option when you want to add custom spatial data to the map data layer. This can be done by first adding the spatial data fields for the embedded spatial data using the MapFieldDefinitionDesigner Collection Editor which can be accessed through the FieldDefinitions property. And then later adding spatial data (points, polygons or lines) using the PolygonDesigner Collection Editor, PointsDesigner Collection Editor or LineDesigner Collection Editor depending on the layer in use. These Editor dialogs can be accessed using the SpatialData > Polygons, SpatialData > Points or SpatialData > Lines property.
    • File: Use this option when you want to add spatial data from an ESRI file. Use the Source property to specify the location of the shapefile.
      Note: The specified location must contain the shape format (.shp) and attribute format (.dbf) files.
    • DataSet: Use this option when you have a dataset that stores a spatial data field to provide spatial data to the Map. This option is equivalent to the DataSet option in the Map Layer Data Properties dialog. Use the SpatialData > DataSetName property to specify the name of the dataset and the SpatialData > SpatialField property to specify the data field that contains spatial data.
    • DataRegion: Use this option when you have a dataset that stores a spatial data field to provide spatial data to the Map. This option is equivalent to the Analytical option in the Map Layer Data Properties dialog. Use the LayerData > DataSetName property to specify the name of the dataset and the SpatialDataVectorData property to specify the data field or expression that contains spatial data.
  4. Click OK to close the dialog.

Analytical Data

Analytical data is the data that you want to visualize on the map, for example, tourist attractions in a city or product sales by region. For analytical data, you can associate it with map elements by indicating match fields in the Match box of the Map Layer Data Properties dialog. You can use one or more fields in the Match box of the Map Layer Data Properties dialog; for each spatial data field you must indicate a unique analytical data field. This data is optional.

You can get analytical data from the following types of data sources.

To add Analytical Data to the Map control

Use the following steps to add analytical data to the map. These steps assume that you have added a page layout template to your report and have a data connection in place. See Adding an ActiveReport to a Project and Connect to a Data Source for further information.

  1. Add spatial data to the map control. See the dropdown sections above to learn adding spatial data to the map control.
  2. In the Map Layer Data Properties dialog, go to the Analytical data page.
  3. Select the dataset that you want to use from the Dataset dropdown list and click the Add (+) button located next to the Match field. This creates an empty match field expression and enables the Spatial and Analytical field properties.
  4. In the Spatial field and Analytical field options set data fields that contain same data in both Spatial and Analytical databases. This builds the match field expression and relates analytical data to map elements on a map layer.
    Note: It is necessary to set match fields if you want to use a spatial data field from analytical data, or if you want to visualize analytical data on the map layer. Match fields enable the report processor to build a relationship between the analytical data and the spatial data.
  5. Click OK to close the dialog.