58503
58503
or textbooks at https://ebookmass.com
_____ Follow the link below to get your download now _____
https://ebookmass.com/product/machine-learning-on-
geographical-data-using-python-1st-edition-joos-korstanje/
Machine Learning Guide for Oil and Gas Using Python Hoss
Belyadi
https://ebookmass.com/product/machine-learning-guide-for-oil-and-gas-
using-python-hoss-belyadi/
https://ebookmass.com/product/machine-learning-with-python-for-
everyone-addison-wesley-data-analytics-series-1st-edition-ebook-pdf/
https://ebookmass.com/product/data-driven-seo-with-python-solve-seo-
challenges-with-data-science-using-python-1st-edition-andreas-
voniatis/
https://ebookmass.com/product/practical-machine-learning-on-
databricks-1st-edition-debu-sinha/
https://ebookmass.com/product/machine-learning-for-time-series-
forecasting-with-python-francesca-lazzeri/
https://ebookmass.com/product/fundamentals-of-machine-learning-for-
predictive-data-analytics-algorithms/
Joos Korstanje
Apress Standard
The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
Source Code
All source code used in the book can be downloaded from
github.com/apress/machine-learning-geographic-
data-python.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub
(https://github.com/Apress). For more detailed information, please
visit http://www.apress.com/source-code.
Table of Contents
Part I: General Introduction
Chapter 1:Introduction to Geodata
Reading Guide for This Book
Geodata Definitions
Cartesian Coordinates
Polar Coordinates and Degrees
The Difference with Reality
Geographic Information Systems and Common Tools
What Are Geographic Information Systems
Standard Formats of Geodata
Shapefile
Google KML File
GeoJSON
TIFF/JPEG/PNG
CSV/TXT/Excel
Overview of Python Tools for Geodata
Key Takeaways
Chapter 2:Coordinate Systems and Projections
Coordinate Systems
Geographic Coordinate Systems
Projected Coordinate Systems
Local Coordinate Systems
Which Coordinate System to Choose
Playing Around with Some Maps
Example:Working with Own Data
Key Takeaways
Chapter 3:Geodata Data Types
Vector vs.Raster Data
Dealing with Attributes in Vector and Raster
Points
Definition of a Point
Importing an Example Point Dataset in Python
Some Basic Operations with Points
Lines
Definition of a Line
An Example Line Dataset in Python
Polygons
Definition of a Polygon
An Example Polygon Dataset in Python
Some Simple Operations with Polygons
Rasters/Grids
Definition of a Grid or Raster
Importing a Raster Dataset in Python
Key Takeaways
Chapter 4:Creating Maps
Mapping Using Geopandas and Matplotlib
Getting a Dataset into Python
Making a Basic Plot
Plot Title
Plot Legend
Mapping a Point Dataset with Geopandas and Matplotlib
Concluding on Mapping with Geopandas and Matplotlib
Making a Map with Cartopy
Concluding on Mapping with Cartopy
Making a Map with Plotly
Concluding on Mapping with Plotly
Making a Map with Folium
Concluding on Mapping with Folium
Key Takeaways
Part II: GIS Operations
Chapter 5:Clipping and Intersecting
What Is Clipping?
A Schematic Example of Clipping
What Happens in Practice When Clipping?
Clipping in Python
What Is Intersecting?
What Happens in Practice When Intersecting?
Conceptual Examples of Intersecting Geodata
Intersecting in Python
Difference Between Clipping and Intersecting
Key Takeaways
Chapter 6:Buffers
What Are Buffers?
A Schematic Example of Buffering
What Happens in Practice When Buffering?
Creating Buffers in Python
Creating Buffers Around Points in Python
Creating Buffers Around Lines in Python
Creating Buffers Around Polygons in Python
Combining Buffers and Set Operations
Key Takeaways
Chapter 7:Merge and Dissolve
The Merge Operation
What Is a Merge?
A Schematic Example of Merging
Merging in Python
Row-Wise Merging in Python
Attribute Join in Python
Spatial Join in Python
The Dissolve Operation
What Is the Dissolve Operation?
Schematic Overview of the Dissolve Operation
The Dissolve Operation in Python
Key Takeaways
Chapter 8:Erase
The Erase Operation
Schematic Overview of Spatially Erasing Points
Schematic Overview of Spatially Erasing Lines
Schematic Overview of Spatially Erasing Polygons
Erase vs.Other Operations
Erase vs.Deleting a Feature
Erase vs.Clip
Erase vs.Overlay
Erasing in Python
Erasing Portugal from Iberia to Obtain Spain
Erasing Points in Portugal from the Dataset
Cutting Lines to Be Only in Spain
Key Takeaways
Part III: Machine Learning and Mathematics
Chapter 9:Interpolation
What Is Interpolation?
Different Types of Interpolation
Linear Interpolation
Polynomial Interpolation
Nearest Neighbor Interpolation
From One-Dimensional to Spatial Interpolation
Spatial Interpolation in Python
Linear Interpolation Using Scipy Interp2d
Kriging
Linear Ordinary Kriging
Gaussian Ordinary Kriging
Exponential Ordinary Kriging
Conclusion on Interpolation Methods
Key Takeaways
Chapter 10:Classification
Quick Intro to Machine Learning
Quick Intro to Classification
Spatial Classification Use Case
Feature Engineering with Additional Data
Importing and Inspecting the Data
Spatial Operations for Feature Engineering
Reorganizing and Standardizing the Data
Modeling
Model Benchmarking
Key Takeaways
Chapter 11:Regression
Introduction to Regression
Spatial Regression Use Case
Importing and Preparing Data
Iteration 1 of Data Exploration
Iteration 1 of the Model
Iteration 2 of Data Exploration
Iteration 2 of the Model
Iteration 3 of the Model
Iteration 4 of the Model
Interpretation of Iteration 4 Model
Key Takeaways
Chapter 12:Clustering
Introduction to Unsupervised Modeling
Introduction to Clustering
Different Clustering Models
Spatial Clustering Use Case
Importing and Inspecting the Data
Cluster Model for One Person
Tuning the Clustering Model
Applying the Model to All Data
Key Takeaways
Chapter 13:Conclusion
What You Should Remember from This Book
Recap of Chapter 1 – Introduction to Geodata
Recap of Chapter 2 – Coordinate Systems and Projections
Recap of Chapter 3 – Geodata Data Types
Recap of Chapter 4 – Creating Maps
Recap of Chapter 5 – Clipping and Intersecting
Recap of Chapter 6 – Buffers
Recap of Chapter 7 – Merge and Dissolve
Recap of Chapter 8 – Erase
Recap of Chapter 9 – Interpolation
Recap of Chapter 10 – Classification
Recap of Chapter 11 – Regression
Recap of Chapter 12 – Clustering
Further Learning Path
Going into Specialized GIS
Specializing in Machine Learning
Remote Sensing and Image Treatment
Other Specialties
Key Takeaways
Index
About the Author
Joos Korstanje
is a data scientist, with over five years of
industry experience in developing
machine learning tools. He has a double
MSc in Applied Data Science and in
Environmental Science and has extensive
experience working with geodata use
cases. He has worked at a number of
large companies in the Netherlands and
France, developing machine learning for
a variety of tools. His experience in
writing and teaching has motivated him
to write this book on machine learning
for geodata with Python.
About the Technical Reviewer
Xiaochi Liu
is a PhD researcher and data scientist at
Macquarie University, specializing in
machine learning, explainable artificial
intelligence, spatial analysis, and their
novel application in environmental and
public health. He is a programming
enthusiast using Python and R to
conduct end-to-end data analysis. His
current research applies cutting-edge AI
technologies to untangle the causal
nexus between trace metal
contamination and human health to
develop evidence-based intervention
strategies for mitigating environmental exposure.
Part I
General Introduction
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2022
J. Korstanje, Machine Learning on Geographical Data Using Python
https://doi.org/10.1007/978-1-4842-8287-8_1
1. Introduction to Geodata
Joos Korstanje1
(1) VIELS MAISONS, France
Geodata Definitions
To get started, I want to cover the basics of coordinate systems in the
simplest mathematic situation: the Euclidean space. Although the world
does not respect the hypothesis made by Euclidean geometry, it is a great
entry into the deeper understanding of coordinate systems.
A two-dimensional Euclidean space is often depicted as shown in
Figure 1-1.
Cartesian Coordinates
To locate points in the Euclidean space, we can use the Cartesian
coordinate system. This coordinate system specifies each point uniquely
by a pair of numerical coordinates. For example, look at the coordinate
system in Figure 1-2, in which two points are located: a square and a
triangle.
The square is located at x = 2 and y = 1 (horizontal axis). The triangle
is located at x = -2 and y = -1.
Figure 1-2 Two points in a coordinate system. Image by author
The point where the x and y axes meet is called the Origin, and
distances are measured from there. Cartesian coordinates are among the
most well-known coordinate system and work easily and intuitively in the
Euclidean space.
The letter r signifies the distance and the letter φ is the angle. You can go
the other way as well, using the following formulas:
ArcGIS
ArcGIS, made by ESRI, is arguably the most famous software package for
working with Geographic Information Systems. It has a very large number
of functionalities that can be accessed through a user-friendly click-
button system, but visual programming of geodata processing pipelines is
also allowed. Python integration is even possible for those who have
specific tasks for which there are no preexisting tools in ArcGIS. Among
its tools are also AI and data science options.
ArcGIS is a great software for working with geodata. Yet there is one
big disadvantage, and that is that it is a paid, proprietary software. It is
therefore accessible only to companies or individuals that have no
difficulty paying the considerably high price. Even though it may be worth
its price, you’ll need to be able to pay or convince your company to pay for
such software. Unfortunately, this is often not the case.
Python/R Programming
Finally, you can use Python or R programming for working with geodata
as well. Programming, especially in Python or R, is a very common skill
among data professionals nowadays.
As programming skills were less well spread a few years back, the
boom in data science, machine learning, and artificial intelligence has
made languages like Python become very commonly spread throughout
the workforce.
Now that many are able to code or have access to courses to learn how
to code, the need for full software becomes less. The availability of a
number of well-functioning geodata packages is enough for many to get
started.
Python or R programming is a great tool for treating geodata with
common or more modern methods. By using these programming
languages, you can easily apply tools from other libraries to your geodata,
without having to convert this to QGIS modules, for example.
The only problem that is not very well solved by programming
languages is long-term geodata storage. For this, you will need a database.
Cloud-based databases are nowadays relatively easy to arrange and
manage, and this problem is therefore relatively easily solved.
Shapefile
The shapefile is a very commonly used file format for geodata because it
is the standard format for ArcGIS. The shapefile is not very friendly for
being used outside of ArcGIS, but due to the popularity of ArcGIS, you will
likely encounter shapefiles at some point.
The shapefile is not really a single file. It is actually a collection of files
that are stored together in one and the same directory, all having the
same name. You have the following files that make up a shapefile:
– myfile.shp: The main file, also called the shapefile (confusing but true)
– myfile.shx: The shapefile index file
– myfile.dbf: The shapefile data file that stores attribute data
– myfile.prj: Optional file that stores spatial reference and projection
metadata
As an example, let’s look at an open data dataset containing the
municipalities of the Paris region that is provided by the French
government. This dataset is freely available at
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b94f
2c318a0971e8faedb7b5675d6
On this website, you can download the data in SHP/L93 format, and
this will allow you to download a directory with a zip file. Figure 1-6
shows what this contains.
Figure 1-6 The inside of the shapefile. Image by author Data source: Ministry of
DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b94f2c318a0971e8faedb7b5675d6,
updated on 1 July 2016. Open Licence 2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
As you can see, there are the .shp file (the main file), the .shx file (the
index file), the .dbf file containing the attributes, and finally the optional
.prj file.
For this exercise, if you want to follow along, you can use your local
environment or a Google Colab Notebook at
https://colab.research.google.com/.
You have to make sure that in your environment, you install
geopandas:
Then, make sure that in your environment you have a directory called
Communes_MGP.shp in which you have the four files:
– Communes_MGP.shp
– Communes_MGP.dbf
– Communes_MGP.prj
– Communes_MGP.shx
In a local environment, you need to put the “sample_data” file in the
same directory as the notebook, but when you are working on Colab, you
will need to upload the whole folder to your working environment, by
clicking the folder icon and then dragging and dropping the whole folder
onto there. You can then execute the Python code in Code Block 1-1 to
have a peek inside the data.
shapefile.plot()
Code Block 1-2 Plotting the shapefile
You will obtain the map corresponding to this dataset as in Figure 1-8.
Figure 1-8 The map resulting from Code Block 1-2. Image by author Data source:
Ministry of DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b94f2c318a0971e8faedb7b5675d6,
updated on 1 July 2016. Open Licence 2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
import fiona
gpd.io.file.fiona.drvsupport.supported_drivers['KML']
= 'rw'
You’ll then see the exact same geodataframe as before, which is shown
in Figure 1-10.
Figure 1-10 The KML data shown in Python. Image by author Data source: Ministry of
DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b94f2c318a0971e8faedb7b5675d6,
updated on 1 July 2016. Open Licence 2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
As before, you can plot this geodataframe to obtain a basic map
containing the municipalities of the area of Paris and around. This is done
in Code Block 1-4.
kmlfile.plot()
Code Block 1-4 Plotting the KML file data
Figure 1-11 The plot resulting from Code Block 1-4. Screenshot by author Data source:
Ministry of DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b94f2c318a0971e8faedb7b5675d6,
updated on 1 July 2016. Open Licence 2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
GeoJSON
The json format is a data format that is well known and loved by
developers. Json is much used in communication between different
information systems, for example, in website and Internet
communication.
The json format is loved because it is very easy to parse, and this
makes it a perfect storage for open source and other developer-oriented
tools.
Json is a key-value dataset, which is much like the dictionary in
Python. The whole is surrounded by accolades. As an example, I could
write myself as a json object as in this example:
{ 'first_name': 'joos',
'last_name': 'korstanje',
'job': 'data scientist' }
As you can see, this is a very flexible format, and it is very easy to
adapt to all kinds of circumstances. You might easily add GPS coordinates
like this:
{ 'first_name': 'joos',
'last_name': 'korstanje',
'job': 'data scientist',
'latitude': '48.8566° N',
'longitude': '2.3522° E' }
As expected, the data looks exactly like before (Figure 1-13). This is
because it is transformed into a geodataframe, and therefore the original
representation as json is not maintained anymore.
Figure 1-13 The geojson content in Python. Image by author Data source: Ministry of
DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b94f2c318a0971e8faedb7b5675d6,
updated on 1 July 2016. Open Licence 2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
You can make the plot of this geodataframe to obtain a map, using the
code in Code Block 1-6.
geojsonfile.plot()
Code Block 1-6 Plotting the geojson data
TIFF/JPEG/PNG
Image file types can also be used to store geodata. After all, many maps
are 2D images that lend themselves well to be stored as an image. Some of
the standard formats to store images are TIFF, JPEG, and PNG.
– The TIFF format is an uncompressed image. A georeferenced TIFF
image is called a GeoTIFF, and it consists of a directory with a TIFF file
and a tfw (world file).
– The better-known JPEG file type stores compressed image data. When
storing a JPEG in the same folder as a JPW (world file), it becomes a
GeoJPEG.
– The PNG format is another well-known image file format. You can make
this file into a GeoJPEG as well when using it together with a PWG
(world file).
Image file types are generally used to store raster data. For now,
consider that raster data is image-like (one value per pixel), whereas
vector data contains objects like lines, points, and polygons. We’ll get to
the differences between raster and vector data in a next chapter.
On the following website, you can download a GeoTIFF file that
contains an interpolated terrain model of Kerbernez in France:
https://geo.data.gouv.fr/en/datasets/b0a420b9e003
d45aaf0670446f0d600df14430cb
You can use the code in Code Block 1-7 to read and show the raster file
in Python.
Note Depending on your OS, you may obtain a .tiff file format rather
than a .tif when downloading the data. In this case, you can simply
change the path to become .tiff, and the result should be the same. In
both cases, you will obtain the image shown in Figure 1-15.
Figure 1-15 The plot resulting from Code Block 1-7. Image by author Data source:
Ministry of DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/b0a420b9e003d45aaf0670446f0d600df14430cb,
updated on “unknown.” Open Licence 2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
CSV/TXT/Excel
The same file as used in the first three examples is also available in CSV.
When downloading it and opening it with a text viewer, you will observe
something like Figure 1-16.
Figure 1-16 The contents of the CSV file. Image by author Data source: Ministry of
DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/b0a420b9e003d45aaf0670446f0d600df14430cb,
updated on “unknown.” Open Licence 2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
The important thing to take away from this part of the chapter is that
geodata is “just data,” but with geographic references. These can be stored
in different formats or in different coordinate systems to make things
complicated, but in the end you must simply make sure that you have
some sort of understanding of what you have in your data.
You can use many different tools for working with geodata. The goal of
those tools is generally to make your life easier. As a last step for this
introduction, let’s have a short introduction to the different Python tools
that you may encounter on your geodata journey.
Overview of Python Tools for Geodata
Here is a list of Python packages that you may want to look into on your
journey into geodata with Python:
Geopandas
General GIS tool with a pandas-like code syntax that makes it very
accessible for the data science world.
Fiona
Reading and writing geospatial data.
Rasterio
Python package for reading and writing raster data.
GDAL/OGR
A Python package that can be used for translating between different GIS
file formats.
RSGISLIB
A package containing remote sensing tools together with raster
processing and analysis.
PyProj
A package that can transform coordinates with multiple geographic
reference systems.
Geopy
Find postal addresses using coordinates or the inverse.
Shapely
Manipulation of planar geometric objects.
PySAL
Spatial analysis package in Python.
Scipy.spatial
Spatial algorithms based on the famous scipy package for data science.
Cartopy
Package for drawing maps.
GeoViews
Package for interactive maps.
A small reminder: As Python is an open source environment and those
libraries are mainly developed and maintained by unpaid open source
developers, there is always that chance that something changes or
becomes unavailable. This is the risk of working with open source. In
most cases, there are no such big problems, but they can and do
sometimes happen.
Key Takeaways
1. Cartesian coordinates and polar coordinates are two alternative
coordinate systems that can indicate points in a two-dimensional
Euclidean space.
5. The advantage of using Python is that you can have a lot of autonomy
on your geodata treatment and that you can benefit from the large
number of geodata and other data science and AI packages in the
ecosystem.
Figure 2-1 Airplane routes are not straight on a mapImage adapted from
https://en.wikipedia.org/wiki/World_map#/media/File:Blue_Marble_2002.png (Public
Domain Image. 10 February 2002)
Let’s now consider an example where you are holding a round soccer
ball. When going from one point to another on a ball, you will intuitively
be able to say which path is the fastest. If you are looking straight at the
ball, when following your finger going from one point to another, you will
see your hand making a shape like in Figure 2-2.
Figure 2-2 The shortest path on a ball is not a straight line in two-dimensional view.
Image by author
When making maps, we cannot plot in three dimensions, and we,
therefore, need to find some way or another to put a three-dimensional
path onto a two-dimensional image.
Many map makers have proposed all sorts of ways to solve this
unsolvable problem, and the goal of this chapter is to help you understand
how to deal effectively with those 3D to 2D mapping distortions that will
be continuously looking to complexify your work on geodata.
Coordinate Systems
While the former discussion was merely intuitive, it is now time to slowly
get to more official definitions of the concepts that you have seen. As we
are ignoring the height of a point (e.g., with respect to sea level) for the
moment, we can identify three types of coordinate systems:
– Geographic Coordinate Systems
– Projected Coordinate Systems
– Local Coordinate Systems
Let’s go over all three of them.
About four o’clock that afternoon the four returned. They must have
listened for some time to the conversation between Dawa and
myself, for as soon as they entered the tent, the most wicked of the
three brothers severely scolded Dawa for flirting with a man. Upon
this, the girl’s father at once took her side, and snappishly told his
brother that his Dawa had a father to protect her, and therefore
wanted nobody to meddle with her, much less an uncle who had
never given her even so much as one bowl of flour since she was
born.
The quarrel waxed hotter and fiercer, and the brothers began to
abuse each other and to divulge each other’s crimes. One accused
the other of being a robber, and of having murdered men at such
and such places, and was met with the recriminating accusation of
having attempted to rob the Government and of having fled for fear
of arrest. The wordy warfare at last developed into actual blows, and
the brothers exchanged fisticuffs, and even began to hurl stones at
each other. I thought I must interfere, and so I jumped up and
attempted to hold back the youngest brother as he was about to
spring at Dawa’s father. The fellow struck my cheek with his bony
knuckles with such force that I fell, and my whole frame shook with
pain. The confusion in the tent had reached its climax, and Dawa
was beginning to cry and so was also her aunt. I remained a passive
spectator of the rest of this terrible scene, for I had to lie prostrate
from the pain. Presently the sun set and the quarrel too spent itself
and the night passed without any further outbreak.
The next morning the party broke up, for each brother wanted to go
his way, the eldest with his wife, the second with his daughter, and
the third alone, as was also the case with me; so we had to
disperse, each for his own destination. One thing that troubled me
was the lack of sheep to carry my effects. At last I purchased two at
six tanka each, and separating myself from the rest proceeded in the
south-easterly direction. One of the brothers started for the north,
while I could see the others were retracing the road we had come
along.
I had heard before that I must push on rapidly, but I purposely took
the south-easterly direction, in order to throw off the scent any of
the brothers who might come after me to rob me, or even worse.
And so I proceeded in this direction, and by about sunset I reached
the brow of a hill, where I was obliged to bivouac in the open, and
on a snow-covered plain. The change was too sudden after having
lived for so long in the tent, and I could not snatch even one wink of
sleep during the night. On the following day, still continuing in the
same direction, I reached a small monastery of the name of Sha
Chen Khangba, where I remained that day and the next. For the first
time since I parted with the brothers and the troublesome women, I
felt safe, for I concluded that I was no longer in danger of being
pursued by one of the murderous gang. I saw only two priests in the
temple, and I spent most of my time in stitching my worn-out boots
and clothes.
While I was staying in the monastery one of my sheep suddenly fell
ill and died. I felt sorely grieved at his death, and read a suitable
service for him. The other sheep I had to sell, at half the price I had
paid for him, to one of four traders who arrived at the monastery
soon after I had reached it, for I could hardly manage him now, as
he was so peevish and disconsolate at the loss of his partner. To the
four men I also gave the flesh of the dead sheep, and they accepted
it with thanks. It happened that the party was travelling in the same
direction as myself, and they proposed that I should go with them.
This was quite a welcome suggestion, especially as the men were
kind enough to offer their services to carry my effects, for they had
with them a number of yaks.
So once more I had travelling companions, and I left the monastery
with a far more cheerful heart than I had when I reached it. We
proceeded in a south-easterly direction, and soon came to a small
round pond, a little over half a mile in circumference. Proceeding
along the right side of the pond, we next came to a lake which is
very long from north-west to south-east, but very narrow. The whole
circumference is said to be about forty miles. This lake is bounded
by rocky hills on all sides, and the blackish rocks scattered here and
there were partially covered, especially in the crevices and sheltered
spots between the adjoining rocks, with a thin layer of snow, so that
they presented quite a pretty sight. I ascended a small elevation
close by the lake, and looked down on it and also on the small pond.
From that height the serpentine lake looked just like the fabulous
dragon in the act of clutching a round gem, the pond corresponding
to the gem. The snow-streaked rocks were not unlike a white fleece
of cloud. This lake is known by the name of Kong-gyu-i Tso, as I
heard from my fellow travellers. After proceeding about seventeen
miles south-eastwards, with the lake on our left, we reached its
extremity. Here we were to bivouac, as we had no tent, but I could
not sleep on the snow-covered plain. I therefore passed the night in
my usual style, that is to say, in religious meditation, the best
expedient for a sleepless night.
Our road lay next day over a steep hill, and it was indeed such a
break-back ascent that it seemed to be trying even to the sturdy legs
and lungs of my Tibetan companions. As for myself, I was lucky
enough to get permission to ride on a yak’s back, and so I could
negotiate the ascent with no great difficulty. Descending the
opposite slope of the hill we soon reached a plain which, together
with all the adjoining country, was situated in the Kong-gyu district.
On this plain I noticed a white spot, not unlike a lake at a distance.
My companions informed me that the white thing was puto, and that
the white spot indicated the site of a lake which produced natural
soda.
When we reached the lake my companions eagerly collected the
deposit, put it in skin-bags and fastened it to the back of the yaks.
They told me that the soda was to be mixed with tea.
We then went on over several low undulating hills, and finally
reached the lower course of the river Chema Yungdung, where I had
narrowly escaped drowning a short time before. As the season was
now well advanced, the river was much shallower and we were able
to cross it with comparative ease. I indeed could do so with perfect
security, for I was carried on a yak’s back.
We were travelling all these days at the rate of about twenty-five
miles a day, and I should hardly have been able to make such good
progress had it not been for the fact that I could ride every now and
then on a yak. What distressed me most was bivouacking in the
open, where sleep was out of the question in the cold autumn nights
and on ground covered with snow. After proceeding some twenty-
five miles to the south-east, on the following day we reached the
Brahmapuṭra, known in this region as Martsan-gi-chu or Kobei-chu,
according to the districts which it traversed. The lordly river was
quite shallow and could be crossed without trouble, and I did so as
before on the yak’s back. We found some tents by the bank of the
river where we were allowed to pass a night—quite a cheering
change after so many nights of bivouacking.
It was a moonless night, but the sky was full of stars, which threw
their twinkling rays on the water of the river. The vast range of the
Himālayas was clearly silhouetted, so as to make its sharp outline
perceptible. The majestic scene inspired me with poetic fervor:
The effusion soothed my heart, and I felt more than ever thankful
for the beauty of the Japanese language.
The next day, October 1, 1900, at about six in the morning I decided
to proceed on my journey. The snow had ceased, and the sun was
shining brightly, to the increased pain of my eyes. I could not walk
with my eyes shut; and yet the pain of keeping them open, however
slightly, was more than I could bear. I was so overcome by it that I
would from time to time fall down, wherever I might be. I had had
no food for nearly four days, and was so weak that the smallest
stone lying in the snow would bring me down. Fortunately I
sustained no injury, owing to the softness of the snow and the
lightness of my body. There was a time, however, when I got quite
exasperated by hunger, the pain in my eyes, and the weakness of
my legs, and sat down in the snow, feeling that I was fated to die.
Intellectually, however, death was far from my thoughts. Were there
only some means of getting rid of my bodily pains, I thought I could
walk on and on, and at last reach safety.
At this juncture a horseman put in an appearance far ahead. I
strained my eyes, though with terrible pain, and thus made out that
it was a horseman. I stood up at once and signalled him to
approach. I wished to shout but could not; the effort seemed to
choke me, and it was only after enormous exertion that I squeezed
out two feeble shouts and wildly gesticulated. The horseman, having
apparently observed me, galloped towards me, to my great joy.
Soon he was beside me, asking me what I was doing in such a
desert of snow, and I told him with uncommon difficulty that I had
been robbed of most of my baggage, had lost what remained to me
en route, and had had nothing to eat for over three or four days. He
was a young man, full of sympathy. Though he was provided with
extra provisions, he said, he would give me only some sweetmeats,
made of cream and brown sugar, a food which is esteemed as a rare
delicacy in the northern steppes of Tibet. I swallowed down the food
which he gave me so hurriedly that I did not even taste it.
I then enquired of him if I could not find a lodging hereabouts. His
reply was that he was a pilgrim, and that his parents and others
were staying beside the mountain ahead of us, and that I should be
able to obtain some accommodation there. He therefore advised me
to come to his tent, and, saying that he was in hurry, galloped away
in that direction.
The distance was only a little above two miles, but I do not
remember how often I stumbled and fell down, and rested, and ate
snow, before I reached the tent. More than three hours were
occupied on the journey, and I did not reach the tent till past eleven
o’clock, when the young man came out to welcome me. His parents
congratulated me on my narrow escape from death, and entertained
me with the best sort of Tibetan food, which consisted of boiled rice
covered with butter, and accompanied by sugar and raisins. I did not
take much of the food, for fear that the sudden repletion might
injure me, but I took a little milk after a very modest repast. The
pain in my eyes was no better. There was no medicine, and the best
I could do was to cool them with snow. In spite of the fine bed with
which I was accommodated I could not sleep that night, owing to
the pain I felt in my eyes.
These people, being pilgrims, were intending to move on day by day.
The next morning, therefore, I also had to proceed on my journey.
But it was some time before they could start, for they had to pull
down the tents and pack them on the yaks. I finished my tea
therefore, and went out of doors, while they were busily engaged in
packing their effects. I had walked to the further end of a row of
four or five tents, when seven or eight ferocious Tibetan dogs
attacked me, barking loudly. Handicapped as I was with the pain in
my eyes, I could not deal with these dogs so deftly as at other
times. At first, I kept my eyes open and brandished my two sticks,
driving back the animals, which attacked me from all sides. But once
I was obliged to close my eyes, and immediately a dog behind me
seized one of my sticks. The next moment another dog fastened his
teeth on my right leg, and threw me down.
I uttered a feeble cry for help, which brought several men on the
scene, and they drove away the dogs with stones. But the blood
flowed out abundantly from the wound, which I held fast with my
hands, and I lay motionless until an aged dame brought me some
medicine, which she said was a marvellous cure for such wounds. I
dressed the wound with the medicine and bandaged it, and
attempted to rise, but in vain. It was impossible for me to stand up.
But as it was equally impossible that I should lie down there for ever,
I asked the people what they would advise me to do, and if they did
not know the whereabouts of Alchu Lama, whom I thought to be in
that vicinity. They asked me if I was acquainted with Alchu Lama,
and, on being answered in the affirmative, one of them volunteered
to carry me on his horse to the tent of Alchu Lama, who he said,
being a physician, would be able to cure me alike of the wound and
of the eye-disease. I rose with the support of the sticks, one of
which broke under me and had to be thrown away, and mounted on
the horse.
Arriving at a place where there stood two tents, I perceived that
these tents were smaller than those of Alchu Lama. Though
wondering at heart, I alighted from the horse, and enquired at one
of the tents for the Lama, and I was informed that this was not the
Lama’s tent, but that of his wife’s father. I wanted to reach the
Lama’s tents somehow, and was speaking to that effect, when the
wife, hearing my voice, said that I was the revered Lama who had
made a pilgrimage to the snowy peak of Tise, and came out to see
me.
“Where is your Lama?” I asked.
“He lives about two miles east of this place.”
“I wish to find him. Have you no one to take me to him?”
“I have nothing to do with the Lama any more, nor can I take you.
But if you want to go there, I will direct the man who has brought
you here to accompany you.”
“But why do you not yourself return to your own home?”
“Oh, there is no man so wicked as he; I intend to leave him.”
“That is not good,” said I.
Then we had a long talk, and after I had been given a repast, I rode
to the Lama’s tent.
The Lama being out, I was received by his domestics. When he
returned home in the evening, I related my adventures to him and
asked him for some medicine. He kindly dressed my wound with
excellent drugs, and gave me purgatives, saying that it was
necessary for me to purge my body in order to prevent the diffusion
throughout my system of poison which some of the dogs injected by
their bites. He also said that I should stay with him for at least a
week, in order to recuperate. Thanks to his directions, which I
obeyed, I was in a few days greatly relieved of the suffering both in
my leg and eyes.
I had experienced enough of hardship, and had very poor prospects
of an easy life in the future. But still there was a genuine pleasure in
pushing on through hardships. About that time I composed a poem:
One day I asked the Lama why he had sent his wife to her parents,
whereupon he explained the shortcomings of his wife. Both had their
reasons, and I could not say which was wrong. But, I said, the man
ought to have magnanimity and to console his wife, so that it was
advisable for the Lama to send for his wife to come back. I
supported my advice by the doctrines of Buḍḍhism, and made him
yield to my proposal. He sent two of his men for his wife, who, after
making some fuss, returned to his tent the same evening.
The following day, when I referred to the Discourse on the Five
Vices, which is included in the Gospel of the Buḍḍha Life Eternal
(one of the three books of the Jōdō Sect, but not found in the
Tibetan Canon) the Lama expressed his desire to hear a lecture on
it. I consented to the request and expounded the discourse on the
days following. The sermon in question treats of all imaginable vices
and sins devised by mankind, arranging them into five classes and
explaining them in the most appropriate manner. During my lecture
on this discourse the couple were so deeply moved to repentance for
their sins that they wept and at times asked me to suspend the
lecture. As their repentance was sincere, I congratulated them on
their progress in virtue. I stayed with them for some ten days, and
my bodily troubles were so much relieved that I was able to regale
my eyes with the magnificent view of the snow and ice, lit up by the
serene moon-light. This lovely scenery of nature caused me to think
of my country, and I had occasion to compose many utas, two of
which were as follows:
ebookmasss.com