Now that I have slogged together a lot of database drivers for Grass and GDAL it is time to put them to good use. In this article I will demonstrate how to create a Grass vector map with attributes stored in an Sqlite embedded database. I am using my Brazil mapset since the data is cities and roads in Brazil.
First open a suitable mapset in Grass from QGIS (follow the QGIS-Grass tutorial) and connect the mapset to an sqlite database by choosing sqlite driver from the dropdown box as shown below. Edit the database location so the it is created in a directory that exists, I suggest removing the already suggested dbf folder(meant for the dbf driver) and replacing it with sqlite.db. In the future this should be auto-suggested by QGIS.
Then open a suitable Shapefile or other OGR supported vector format for import into Grass. Your screen will look something like below.
Now import this dataset into Grass using the Import Vector from OGR command as shown below. You can also use the Grass shell to ensure that your attribute table gets created in the Sqlite database. After this step your vector is ready for use in Grass and all the attributes can be manipulated using SQL in the Sqlite database to perform joins with other tables or any other operation you can dream up.
The final map with various classifications produced from the Brazil dataset after importing it into Grass is shown here.
No comments:
Post a Comment