About HCMGIS Plugin
HCMGIS is a QGIS Desktop plugin that has been developed by Center for Applied GIS of Ho Chi Minh City and the code repository for the plugin can be accessed through this GitHub link and comprises of the following functionalities:
- Basemaps loader.
- Batch Converter for some GIS data formats.
- Downloader for Covid-19 Data.
- Downloader for datasets from various platforms.
- Downloader for Vietnam datasets.
- Geometry Processing tool.
- Calculate Field tool.
In this walkthrough we shall only look at the first four functionalities.
Installing HCMGIS Plugin
To install HCMGIS QGIS plugin, one can either download a zipped file from the HCMGIS Plugin repository or download directly from the QGIS Desktop Plugins menu. Below is a screenshot of the HCMGIS plugins repository for the HCMGIS plugin.
This walkthrough assumes that QGIS Desktop is already installed in the computer. If not, refer to the post on Installing QGIS Desktop in Windows 10 . This walkthrough has been done in Windows 10. After opening QGIS Desktop and installing the HCMGIS plugin, the plugin menu under installed section should appear as shown below.
The menu should also be visible in the QGIS menu as shown below.
When clicked the shortcuts under it appear as shown below. The items functions are as highlighted in the previous section.
Click on the BaseMap shortcut and the dropdown appears showing a list of all the basemaps supported by the plugin. Note that you require to be having an internet connection to load the basemaps as they are being loaded from the web.
Under BaseMap shortcut, click on the GoogleMaps option and a map is loaded in the QGIS Map Canvas and on the Layers Panel as a layer if active as shown below and is zoomed into Kenya’s bounds. The service is developed and maintained by Google.
When done with the above base map, close and click on the HCMGIS plugin once again and click on the Bing Virtual Earth option and the base map loads showing a terrain kind of map that looks like natural landscape with green vegetation. The free service can be used to view features on earth’s surface.
The next base map is the CartoLight base map which is maintained by Carto and can come in handy with custom data overlays or in designing a map in QGIS Desktop. There are other children of carto base maps that include Carto Dark and Carto Eco. Below is the Carto Light base map which is preferred for point data. The development repository can be accessed here.
The final base map in this walkthrough includes the WikiMedia base map which appears as shown below. There are a variety of basemaps that can be used under the HCMGIS plugin and just a few have been covered here.
After downloading the data, in the QGIS Desktop menu identify and click HCMGIS menu and if it is not visible revisit previous steps of opening the QGIS Plugin menu and activating or even re-installing the plugin otherwise, the clicking should show a dropdown that appears as shown below.
Click on the Vector Format Converter shortcut and this open a widget that appears as shown below and contains several controls; dropdowns, buttons and text fields.
Under the input format label is a drop down when clicked, shows all the supported input formats. In this case we will be working with ESRI shapefile denoted by SHP option therefore, select that option.
Similarly, under the output format label, select CSV as the option indicating that we shall be outputting our data in Comma Separated Value (CSV) file.
After selecting input and output formats, click on the Browse… button which will open an input folder window. Navigate to the folder containing the previously downloaded and extracted data and click OK button to close the window.
If pointed to the correct folder, the shapefiles existing in that folder will be shown as a list as shown below. The folder in this case contains four shapefiles.
After ensuring all above mentioned options are correct, click Apply button to proceed with the conversion.
After the conversion is complete, the progress bar will be at 100% and a label indicating number of files converted will be shown as below. If any errors occurred during conversion they will be displayed in the error log area below the progress bar.
The whole window appears as shown below after conversion.
Navigate to the output location that is similar to the input folder and additional files with a .csv extension will appear as shown below. They may be arranged by name or other field but the file type will be Comma Separated Values.
On loading the layers in QGIS Desktop and opening the attribute table, the data looks as shown below.
CSV to Point Converter
In this next step, we will select the CSV to Point shortcut as shown below.
This tool geocodes CSV data and converts them to shapefiles which is quite the opposite of what we did in the previous step only that in this step the input and output formats are fixed.
Click on Browse… button to browse to the directory containing input CSV files. The input files must contain coordinates fields in Latitude and Longitude otherwise the conversion will not take place. To mitigate this from happening, open the CSV data in a text editor or in QGIS Desktop to view the attribute data and confirm that it has coordinates.
The data used in this procedure can de downloaded from ArcGIS Hub data repository and is as listed below:
Once the data has been downloaded navigate in the browse window shown below to the folder containing the files and click Select Folder button to close.
Now that the input folder has been selected, the next step entails identifying the latitude and longitude fields. At times the plugin automatically detects the fields and lists them as shown in the screenshot below but at times the user may be forced to click on the drop downs below the Latitude Field and Longitude Field consecutively to identify the actual field name containing the coordinates.
Once selected every control as required, click Apply button to begin the conversion process. Once the process is complete the progress bar will be at 100% and the number of converted files will be shown in bold above the progress bar.
The previously existing files in CSV can be identified as shown below.
The newly created ESRI shapefiles can be identified as shown below.
To add the layers, click on the Add Vector Layer… shortcut as shown below.
The Data Source Manager window is displayed as shown below with the Vector option highlighted. Click on the button labelled … to browse the file system.
A file browser window similar to previous file browser windows is displayed as shown below. Point it to the files of interest and note that they end in .shp extension indicating that they are shapefiles and then click Open button.
The shapefiles are loaded as vector layers and displayed in the QGIS map canvas as shown below.
In the QGIS Desktop Browser panel, identiy XYZ Tiles and double click on it to collapse it and among the options identify OpenStreetMap that comes with QGIS by default.
This loads an Open Street Map base map however it appears on top of the vector layer therefore hiding the points and it is necessary to correct that.
In the layers panel shown below, drag the OpenStreetMap layer shown below by clicking and holding the mouse button downwards below the other two layers and it will appear as shown below.
And also for the map, the points will be seen to appear on top of the basemap.
In the above steps the conversion of datasets has been summarized and this shows that the HCMGIS plugin can come in handy and remove the repetitive process of converting multiple files by loading them into the QGIS Desktop and exporting them manually.