External Attributes

 

External attributes for a spatial data source in JMap are attributes that are obtained from an external database (external means a database that is separate from the data source itself). The external attributes are added to the list of existing attributes and can thereafter be used like any other attribute in reports, queries, mouse-over, thematics, etc.

External attributes are available only for vector spatial data sources that read data from files (shp, mif, tab, dwg, dgn, etc.). When working with vector data sources that access data inside existing spatial databases (PostGIS, MySQL Spatial, Oracle Spatial/Locator, etc.), this option is not available. In that case however, it is often easy to include all needed attributes using normal SQL joins with other tables or by creating views.

External attributes are created from the spatial data source creation wizard.

1.To create an external attribute, press Edit in the attribute section of the wizard.

2.Press Add to create a new attribute.

3.Select a database to get the attribute values from. This database must already be configured in JMap Admin.

4.Select where to get the attribute values from:

Get external attribute value from

One or more existing fields

Choose this option to select one or more fields from a specific table of the database to get the values from. This is the simpler method.

An SQL query result

Choose this option to provide an SQL query that will retrieve the values from the database. This method is more flexible.

One or more existing fields

If you selected this option, follow these steps:

1.Select the database schema to use.

2.Select the database table to use.

3.Select the fields to read and the join parameters:

Get external attribute value from

Get value from

Select the physical fields to use as external attributes. For each field, you can provide an attribute name that is different from the field name.

Join on fields

Select the field from the external database to use as a join field with the data source. Select the field from the data source to use as a join field with the external database.

 

If you go back to the configuration page of an existing external attribute, it is possible to define the aggregation method for this attribute. This defines the action to take if several values are found for the same geometry in the data source.

Aggregation

Aggregation type

Select the aggregation method to use if more than one value is found for the same geometry:

- Keep first element: Keep only the first value found.

- Average: Calculate the average value to use as the attribute value. Only available for numeric attributes.

- Summation: Calculate the summation value to use as the attribute value. Only available for numeric attributes.

- Concatenate using separator: Build a string containing all values separated by the specified character. Only available for text attributes.

An SQL query result

If you selected this option, enter these parameters:

An SQL Query result

Attribute name

The name of the the new external attribute will be the same as the selected field, by default. It can be modified later. The name must be unique.

SQL query

Enter the SQL query to be executed in the external database and that returns the values to use for the external attribute and the field used to join with the data source. Press Execute to test the query and to initialize the other parts of the interface.

Get value from

Select the table and the field to get the values from. Only those returned by the SQL query are available.

Join fields

Select the field from the external database to use as a join field with the data source. Select the field from the data source to use as a join field with the external database.

Dynamic attribute

Select this option to make the attribute dynamic. Dynamic attributes are dynamically read from the source. Non dynamic attributes are imported in JMap System database and are read again from the source only when the spatial data source is updated in JMap Admin.

Dynamic attributes can impact the performances in some situations.

Aggregation type

Select the aggregation method to use if more than one value is found for the same geometry:

- Keep first element: Keep only the first value found.

- Average: Calculate the average value to use as the attribute value. Only available for numeric attributes.

- Summation: Calculate the summation value to use as the attribute value. Only available for numeric attributes.

- Concatenate using separator: Build a string containing all values separated by the specified character. Only available for text attributes.