External Attributes
<< Click to Display Table of Contents >> Navigation: Spatial Data Sources > External Attributes |
External attributes for a spatial data source 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, mouseover, thematics, etc.
External attributes are available only for vector spatial data sources that read data from files (shp, mif, tab, dwg, dgn, etc.) and JMap Spatial tables. 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.
To create an external attribute, choose External attributes in the Attribute section of the wizard. Press Add and choose one of the following two methods: Select fields or SQL query.
Select fields
Choose this option in order to select one or more fields from a specific database table from which you want to obtain the values. This option is the simplest method, and it allows you to create several attributes at once.
Settings |
|
Database |
Select the database from which the attribute values will be taken. This database must already be configured in JMap Admin. |
Schema |
Select the schema containing the table. |
Table |
Select the table containing the fields to be used as external attributes. |
Include |
The list of available fields is displayed. Select the ones to be included as external attributes. |
GET VALUE FROM |
Indicate the name of the field. |
ATTRIBUTE NAME |
You can give the external attribute a name that will be different from the field name. |
DYNAMIC ATTRIBUTE |
Select this option if you want the attribute to be dynamic. Dynamic attributes are read directly from the source in a dynamic manner. Attributes that are not dynamic are imported into JMap's system database and are only reread when the data source is updated. In certain cases, dynamic attributes can reduce the system's performance. |
Join on fields |
Select the parameters of the join between the external data and the JMap data source. |
Aggregation type |
This option is only available if a single field is selected. 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. Using separator: Build a string containing all values separated by the specified character. Only available for text attributes. |
SQL query
Choose this option to provide an SQL query that will extract the attribute values in the database. This method is more flexible, but limits you to creating one attribute at a time.
Parameters |
|
Attribute name |
Enter a name for the external attribute. |
Dynamic attribute |
Select this option to make the attribute dynamic. Dynamic attributes are read directly from the source in a dynamic manner. Non dynamic attributes are imported in JMap's System database and are only reread when the spatial data source is updated in JMap Admin. Dynamic attributes can impact performances in some situations. |
Database |
Select the database from which the attribute values will be taken. This database must already be configured in JMap Admin. |
SQL query |
Enter the SQL query to be executed in the external database that returns the values to use for the external attribute, along with 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 on fields |
Select the parameters of the join between the external data and the JMap data source. |
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. Using separator: Build a string containing all values separated by the specified character. Only available for text attributes. |