A join is a means of appending a spatial layer and a data table together based on a common attribute or field. The joined data table can be a database table or the data table of an other layer in the map. Joins work best when the tables/layers have a 'one-to-one' relationship (i.e. a single row in the external table corresponds to a single spatial feature). If the relationship is 1..n, only the first row of the joined table is appended to the layer.
Joins are useful when you would like to label or symbolise your spatial layer using data held in an external table, or export a layer with rich attribution.

To join data to a featurelayer click on the layer in table-of-contents and choose "Joins" from the context menu/buttons:


A dialog opens that shows you the joins attached to your layer. Ever featurelayer can have any number of joins. In this dialog you can create new joins, edit existing joins or delete joins. To create a new join click "Add...":


Here you can assigna name to the join and set the feature layer field for appending the external table. The external table can be defined in specify the connection string to the database (or dBase, Excell, etc), table and join field.
In the last section of the dialog you can specify the join type (inner- or outer-join).

If you want to join a featurelayer table to an other featurelayer table in the active map, you an select the "Feature Layer Join" option and simply specify the featurelayer and join field:


In the featurelayer table you will now see all the fields for the joined table/layer:


The name of the fields is the same as in the original table/layer with the join-name as prefix. The pattern is join-name:field-name
Now you can use the fields for label or symbolize your features. But you have to be aware that joins can also cause performance problems. so, use them with care!
If you want to select features of your layer by SQL-Satement, the joined fields must always be enclosed in square brackets:


You can also create a definition query for your feature layer containing joined fields (use also square brackets):


But note: Definition queries with joined fields can cause very bad performance problems. The software must always perform full-table-scans for any query (i.e for every map refresh)!!!
So, never use definition queries with joined fields in gView MapServer services!!!

Last edited Dec 4, 2012 at 8:17 AM by gisdev1, version 4


No comments yet.