Adding a Text-Dominated Spreadsheet to a Project Map in Saga
Spreadsheet data can easily be added to GIS systems, but there are
differences between how text and numerical data fields are treated.
In this exercise a spreadsheet that contains mainly text data is treated,
including the methods to eliminated unwanted rows (records). The resulting data object, after a simple
conversion, is a "point shape" that
can be used, for example, to annotate a map with place names.
Preliminary Reading (in
OceanTeacher, unless otherwise indicated):
Excel (or equivalent)
names_liberia_gns.zip to your folder DATA > BASEMAP > OTHER and unzip it in
place. Rename the file (probably li.txt) to
|2. Run Saga. Then load
the World Borders dataset and make this map that zooms into Liberia.
We're going to add all the towns and cities for Liberia.
can use 2.3 Creating
a Project Map in Saga to get your
map exactly like this.
|3. Select FILE > TABLE >
LOAD. Then navigate to the file names_liberia_gns.txt and load
|4. Right-click on the new
table object, and select SHOW TABLE.
|5. This table will appear.
Examine it to see what the field names are (i.e. the column labels).
You can compare what you find here with the format description, above.
|6. You should look carefully
for any field names longer than 10 characters, the limit for shapefiles (which we want to make from this table). Here you can see that
several columns on the right side have oversized labels.
The easiest thing to do is to edit the names so they are all different, but
only use 10 characters or fewer.
|7. Click anywhere on the line
of labels in the table, and select RENAME FIELDS. This window opens,
where you can edit the names. Make changes similar to these, keeping
the fields identifiable but with only 10 letters or fewer.
Then click OK.
|8. The table contains nearly
9000 different features, of several different types. We only want the
towns and cities here. The FEATURE
CLASSIFICATION (= FC) column, gives us an opportunity to separate the different
features, as you can see here, into types. We only want the records
coded with P.
How can we perform the separation?
Classification (FC): Nine (9) major geoname feature categories into
which similar feature designations are grouped.
A = Administrative region type feature
P = Populated place type feature
V = Vegetation type feature
L = Locality or area type feature
U = Undersea type feature
R = Streets, highways, roads, or railroad type feature
T = Hypsographic type feature
H = Hydrographic type feature
S = Spot type feature
|9. Select TOOLS > TABLE TOOLS
> SELECT BY STRING EXPRESSION
|10. Make these selections:
- Table - Select our place names table
- Attribute - Select FC for Feature Classification
- Expression - Enter P for Populated Places
- Case Sensitive - Usually leave unchecked
- Select If - Attribute is identical with search expression;
unfortunately no negative choice is possible
- Method - New selection; usual choice for single selection
Then click OK.
|11. The table, if opened for
view, now shows the selected records highlighted in gray, i.e. all those with FC = P.
|12. How to delete
the other records, if we have selected only the P's?
|13. Select TOOLS > TABLE
TOOLS > INVERT SELECTION. Select the populated places table, then
|14. This switches the
selected records to all the others, i.e. not FC = C.
|15. Now you can right-click
anywhere along the left margin of the table and select DELETE SELECTED
|16. Now you can change the
name of the table to populated_places_liberia-gns.
|17. You can also
right-click on the table and use SAVE AS to save it in the folder PRODUCTS >
SAGA > TABLES with the filename populated_places_liberia_gns.txt
|18. We need to convert this
table to a "point shape" before we can do any further work with it.
Select TOOLS > SHAPES-POINTS > CONVERT A TABLE TO POINTS.
- POINTS - Make sure you set it to CREATE, to avoid overwriting
- TABLE - Select the name of the existing table names_liberia_gns
- X - Select the LONG column (i.e. longitude)
- Y - Select the LAT column (i.e. latitude)
NOTE: we cannot use the longitude/latitude columns with the
DMS (degree-minute-seconds) format, because all GIS work uses decimal degrees.
|19. When the new
shape appears, you can use SAVE SHAPES AS to save it in the folder PRODUCTS
> SAGA > VECTORS
with the filename populated_places_liberia_gns.shp
|20. Just for a reality check,
here's what you see if you add the point shape to the Liberia project map.
cannot go into the difficulties of working with many place name labels, but
we show you below how to display the names on the map.
|21. Too see some details,
zoom into the very southeast corner of Liberia.
Here you can see the extreme eastern end of the
country, after extreme zooming.
|22. In the properties window,
find the DISPLAY: LABEL > ATTRIBUTE control and drop down the menu to look at the
- ATTRIBUTE: Select the SORT NAME.
Then click SETTINGS > APPLY
|23. Here's how the labels
appear. You can explore FONT and size settings on your own at a later
|24. Recent note from
Saga author Volker Wichman about adding a data table with a date field:
- When you load a comma separated (or tab delimited) table in SAGA,
there are only three data types supported: strings, integers and floats
- So you have to use quotes and the following format: dd.mm.yyyy
- With the following table the date should be correctly recognize as
data type string:
- After loading the table to SAGA, you can use the "Change Field Type"
tool to change the data type of the date field to "date".