|
| 1 | +# Attribute Table |
| 2 | +***************** |
| 3 | +In GIS, the attribute table associated to a vector layer is a table that stores tabular informations related to the layer. The columns of the table are called fields and the rows are called records. Each record of the attribute table corrisponds to one feature geometry of the layer. This relation allows to find records in the table (informations) by selecting features on the map and viceversa. |
| 4 | + |
| 5 | +In [MapStore 2](https://mapstore2.geo-solutions.it/mapstore/#/), accessing the attribute table of a vector layer allows you to edit the tabular data or directly the geometries on the map, to perform spatial queries and filters, and to create widgets from the data. |
| 6 | + |
| 7 | +!!! note |
| 8 | + Creating widgets for a layer is accessible from the *TOC* and the *Attribute Table* by clicking on this icon <img src="img/widgets.png" style="max-width:20px;"/> and was already treated in the [Widgets](widgets.md) section. |
| 9 | + |
| 10 | +* **Open** a new map. |
| 11 | +* **Add** a vector layer (e.g. USA Population). |
| 12 | +* **Select** the layer. |
| 13 | +* **Click** on the *Open Attribute Table* icon <img src="img/attributes-table.png" style="max-width:20px;"/>, you will note that the table has 49 items (rows). |
| 14 | + |
| 15 | +The attribute table will open showing the data table and a set of functionalities. |
| 16 | + |
| 17 | +<img src="img/attributes-table-1.png" style="max-width:600px;"/> |
| 18 | + |
| 19 | +Editing |
| 20 | +------- |
| 21 | + |
| 22 | +Nono lo so! Per ora la lascio. |
| 23 | + |
| 24 | + |
| 25 | +Advanced Filtering |
| 26 | +------------------ |
| 27 | + |
| 28 | +[MapStore 2](https://mapstore2.geo-solutions.it/mapstore/#/) allows you to filter and select the data by attribute or by region and to perform cross filtering between two present layers in the map. |
| 29 | + |
| 30 | +* **Click** on the *Advanced Search* icon <img src="img/filter-icon.png" style="max-width:25px;" />. |
| 31 | + |
| 32 | +The filtering page will open showing *Filters Types*. |
| 33 | + |
| 34 | +<p align = "center" ><img src="img/filter-types.png" style="max-width:500px;"/></p> |
| 35 | + |
| 36 | +### Filtering by Attributes |
| 37 | + |
| 38 | +the *Attribute Filter* allows you to set conditions on the fields to perform **AND**/**OR** logic operations. |
| 39 | + |
| 40 | +Since the following example is based on filtering the data with respect to the *Persons* and *Employed* filelds, let us first switch off the unnecessary fields for a better visualization. To do that: |
| 41 | + |
| 42 | +* **Click** on the *Hide/Show columns* button <img src="img/hide-show.png" style="max-width:25px;" />. |
| 43 | + |
| 44 | +* **Switch off** the fields leaving only the **STATE_NAME**, **PERSONS** and **EMPLOYED**. |
| 45 | + |
| 46 | +<p align = "center" ><img src="img/hide-show-1.png" style="max-width:620px;"/></p> |
| 47 | + |
| 48 | +Now, let us set some filters. |
| 49 | + |
| 50 | +* **Click** on the <img src="img/++.png" style="max-width:20px;"/> button to add a condition. |
| 51 | + |
| 52 | +<p align = "center" ><img src="img/attribute-filter-1.png" style="max-width:500px;"/></p> |
| 53 | + |
| 54 | +* **Set** the following condition for example; **Persons >= 6 000 000**. |
| 55 | + |
| 56 | +<p align = "center" ><img src="img/attribute-filter-5.png" style="max-width:620px;"/></p> |
| 57 | + |
| 58 | +* **Click** on the loop icon to search <img src="img/loop.png" style="max-width:20px;"/> |
| 59 | + |
| 60 | +The filtered records by persons will be shown in the attribute table. |
| 61 | + |
| 62 | +<p align = "center" ><img src="img/attribute-filter-2.png" style="max-width:620px;"/></p> |
| 63 | + |
| 64 | +!!!note |
| 65 | + We have got 13 items. |
| 66 | + |
| 67 | +If you want to to see the filtered records also on the map. |
| 68 | + |
| 69 | +* **Click** on the <img src="img/sync.png" style="max-width:20px;"/> icon to synchronize the map with the filter. |
| 70 | + |
| 71 | +<p align = "center" ><img src="img/attribute-filter-3.png" style="max-width:620px;"/></p> |
| 72 | + |
| 73 | +Now let us add other conditions. |
| 74 | + |
| 75 | +* **Click** again on the *Advanced Search* icon <img src="img/filter-icon.png" style="max-width:25px;" />. |
| 76 | + |
| 77 | +* **Click** on the <img src="img/++.png" style="max-width:20px;"/> button to add a second condition. |
| 78 | + |
| 79 | +* **Set** the following condition, for example the employed persons between 2M and 5M; **Employed >< 2 000 000, 5 000 000**. |
| 80 | + |
| 81 | +!!! note |
| 82 | + We are using *"Match any of the following conditions"* which is an **OR** logic operator. |
| 83 | + |
| 84 | +<p align = "center" ><img src="img/attribute-filter-4.png" style="max-width:620px;"/></p> |
| 85 | + |
| 86 | +* **Click** on the loop icon to search <img src="img/loop.png" style="max-width:20px;"/>. |
| 87 | + |
| 88 | +The filter will return 20 records. |
| 89 | + |
| 90 | +<p align = "center" ><img src="img/attribute-filter-6.png" style="max-width:620px;"/></p> |
| 91 | + |
| 92 | +In order to switch to an **AND** operator. |
| 93 | + |
| 94 | +* **Click** again on the *Advanced Search* icon <img src="img/filter-icon.png" style="max-width:25px;" />. |
| 95 | + |
| 96 | +* **Select** form the droplist **all** instead of **any**. |
| 97 | + |
| 98 | +<p align = "center" ><img src="img/attribute-filter-7.png" style="max-width:620px;"/></p> |
| 99 | + |
| 100 | +* **Click** on the loop icon to search <img src="img/loop.png" style="max-width:20px;"/>. |
| 101 | + |
| 102 | +The filter will return 7 records. |
| 103 | + |
| 104 | + |
| 105 | +<p align = "center" ><img src="img/attribute-filter-8.png" style="max-width:620px;"/></p> |
| 106 | + |
| 107 | +### Filtering by Location |
| 108 | + |
| 109 | +The second filter type called **Region of Interest** allows the user to filter the features overlaying drawn geometric shapes on the map. |
| 110 | + |
| 111 | +<p align = "center" ><img src="img/geometry-filter.png" style="max-width:620px;"/></p> |
| 112 | + |
| 113 | +* **Select** the *Filter Type*, e.g. Circle. |
| 114 | +* **Draw** the circle on the map; eventually you can change the position of the center and the radius by clicking on the icon <img src="img/edit-icon-1.png" style="max-width:30px;"/>. |
| 115 | +* **Set** the *Geomatric Operation*, e.g.Contains. |
| 116 | + |
| 117 | +<p align = "center" ><img src="img/geometry-filter-1.png" style="max-width:700px;"/></p> |
| 118 | + |
| 119 | +* **Click** on the loop icon to apply the filter <img src="img/loop.png" style="max-width:20px;"/>. |
| 120 | + |
| 121 | +<p align = "center" ><img src="img/geometry-filter-2.png" style="max-width:600px;"/></p> |
| 122 | + |
| 123 | +!!! note |
| 124 | + The *Geometric Operation* **Contains** will extract the features entirely contained in the drawn geometry while the *Geometric Operation* **Intersects** will extract the features that have a part intersecting the geometry. |
| 125 | + |
| 126 | +### Layer Filtering |
| 127 | + |
| 128 | +*Layer Filter* allows the user to filter the features of a vector layer with respect to another one. For example, which features of the first layer are contained in the second or intersect the second. |
| 129 | + |
| 130 | +* **Open** a new map. |
| 131 | +* **Add** a vector layer (e.g. thematism_regioni). |
| 132 | +* **Add** a second vector layer (e.g. Unesco Items) |
| 133 | + |
| 134 | +<p align = "center" ><img src="img/layer-filter-1.png" style="max-width:600px;"/></p> |
| 135 | + |
| 136 | +Let us suppose that we want to get all the Unesco sites in Sicily. To do it: |
| 137 | + |
| 138 | + |
| 139 | +* **Select** the layer *Unseco Items*. |
| 140 | +* **Click** on the *Open Attribute Table* icon <img src="img/attributes-table.png" style="max-width:20px;"/>. |
| 141 | +* **Click** on the *Advanced Search* icon <img src="img/filter-icon.png" style="max-width:25px;" />. |
| 142 | + |
| 143 | +In the *Layer filter* section: |
| 144 | + |
| 145 | +* **Set** the *Target layer* choosing the layer *thematism_regioni* from the list. |
| 146 | +* **Choose** the appropriate *Operation*; in this case *Contains*. |
| 147 | +* **Add** a condition as the following: **cod_reg = 19** since the region code of Sicily is equal to 19. |
| 148 | + |
| 149 | +<p align = "center" ><img src="img/layer-filter-2.png" style="max-width:600px;"/></p> |
| 150 | + |
| 151 | +* **Click** on the loop icon to apply the filter <img src="img/loop.png" style="max-width:20px;"/>. |
| 152 | + |
| 153 | +Apparently nothing is changed on the map but the filter returned 20 items in the attributes table. |
| 154 | + |
| 155 | +* **Click** on the <img src="img/sync.png" style="max-width:20px;"/> icon to synchronize the map with the filter. |
| 156 | + |
| 157 | +<p align = "center" ><img src="img/layer-filter-3.png" style="max-width:600px;"/></p> |
0 commit comments