If you would like to further explore how GIS could help your organisation jps services offers one and two day training courses in QGIS, ArcGIS and MapInfo.
If you decide to use the geoprocessing tools within QGIS, you may find that certain fields within the attribute data are not valid because they are not correctly updated after you have completed the process. Take, for example, the following problem. You have a map of France which shows all the Departments within the country. This layer also contains an attribute data column relating to the Regions of France called code_regio containing the regional code. You would like to create a layer of the regions from the attribute data column code_regio which contains these regional codes. We can use this data, which is within the Department layer's attribute table, to create our new regions layer by dissolving the relevant department polygons. You can use the Dissolve tool within the Geoprocessing Tools option to dissolve the departmental polygons to create a new layer of regional polygons. You can access these tools from the top main menu under the Vector option. This option will create a layer which dissolves the relevant departments to create a regional layer map of France. However, as you can see by comparing the departments_obs and Department merged to Region attribute tables, the options for creating the regional map are currently limited to creating new polygons without the ability for all the relevant data within the attribute tables being correctly updated. The attribute table below shows the 21 names of the regions of France and the regions' codes. However, the other data has not been updated to reflect regional rather than departmental data. So how can we solve this problem if the current dissolve facility is only useful for creating the relevant regional polygons? If you have used either MapInfo or ArcGIS you may be aware that you are able to create the appropriate regional polygons as well as specifying the updating of the additional attribute data from the departmental table. For example, both these software packages have the facility to sum field attribute data when dissolving polygons as a standard feature of the software. However, we can achieve similar functionality within QGIS if we use a PostGIS layer. As the current option within the Geoprocessing tools only offers the facility to merge polygons without additionally updating other attribute fields, we could use the PostGIS method of achieving the required result if we need totals for any of the attribute fields. In the case of our French map we would like to update a field called nb_visits so that it accurately reflects the regional attribute table data. With the Dissolve function there is no option to update fields by totalling their values, however using a PostgreSQL database we can specify which fields we would like to have totalled when we create the new regional layer. Using an SQL statement we can create a new table called Regions which dissolves the appropriate departmental polygons from the departmental layer. We can also obtain the correct totals for the regional visits from the nb_visits field which has been renamed as Visits. The original Department layer is a shapefile which can be converted to a PostgreSQL file with the PostGIS Shapefile loader. This option to convert shapefiles is available within the pgAdmin tool supplied with PostgreSQL. Once we have loaded the shapefile into the postgreSQL database we can make the appropriate query to create the PostGIS layer. This new Regional layer will take the code_regio attribute and create new polygons from the departmental polygons for each of the regions shown in the code_regio column. Below is the attribute table for the new Regions layer. Additionally, the query now provides a correct total of all the visits for each region. This functionality is available, as previously mentioned, within both MapInfo and ArcGIS without requiring this extra PostGIS step. However, the availability to use PostGIS layers within QGIS means that even complex queries can be handled.
If you would like to further explore how GIS could help your organisation jps services offers one and two day training courses in QGIS, ArcGIS and MapInfo.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorJoe Short BSc has been involved with various mapping solutions for over twenty years. If you are considering implementing a GIS or have ArcGIS Pro, MapInfo Pro or QGIS training requirements, jps services would be happy to be of assistance to your organisation. Archives
September 2023
Categories
All
|