Geography Reference
In-Depth Information
this provides us with a text file containing a header row with the field
names, followed by a row for each volcano:
Number
Volcano Name
Region
Latitude
Longitude Elev
Type
Status
Last Known
Eruption
0803-001
Abu Honshu-Japan
34.5
131.6 571 Shield volcano
Holocene
Unknown
0103-004
Acigol-Nevsehir Turkey
38.57 34.52 1689
Maar
Holocene
U
1505-017
Acotango
Chile-N -18.37
-69.05
6052
Stratovolcano Holocene
U
1101-112
Adagdak Aleutian Is 51.98 -176.6
645 Stratovolcano Holocene
U
The file looks a bit scrambled up with no clear spacing or delimiter.
Looking at the text file in our editor, we discover that the columns of the
table are separated by a tab character. We can use tab as our delimiter
to import the data. The only change we need to make is to clean up the
header row (the first line of the file). We can modify the field names to
shorten them and make them more appropriate for import. The other
change is to delete the second line of the file, since the Last Known
Eruption field name is broken across two lines. Our changed header
now looks like this:
Number
Name
Region
Latitude
Longitude Elev
Type
Status Last_Eruption
When making the changes, make sure that each field name is separated
by a tab character. Otherwise, the import won't work properly.
Importing Data with QGIS
With the header row fixed, we are ready to import the data. First we will
use the QGIS Delimited Text plugin to load and view the data. From
the QGIS Plugin Manager, load the plugin to add the tool to the Plugins
toolbar. 2 Click the Delimited Text tool to begin the import. In Figure 8.2 ,
on the next page, you can see the delimited text plugin dialog box,
populated with the parameters for our input file.
We used the browse button to populate the delimited text file box with
our prepared file. The plugin is actually pretty smart. When you enter
the filename, the remainder of the parameters for the import are popu-
lated using an educated guess. This includes the layer name (based on
the input filename) and the delimiter. If you use \t (notation for a tab
character) for the delimiter, the plugin parses the input file and makes
a guess as to the x and y fields—in this case longitude and latitude.
Basically it's ready to go—all we have to do is click the Add Layer but-
ton. If the delimiter is not a \t , you'll have to enter the proper delimiter
For an overview of plugins in QGIS, see Section D.4 , Plugins, on page 339 .
2.
 
 
 
Search WWH ::




Custom Search