0% found this document useful (0 votes)
9 views

Machine Learning on Geographical Data Using Python 1st Edition Joos Korstanje instant download

The document is a promotional overview of the book 'Machine Learning on Geographical Data Using Python' by Joos Korstanje, which aims to bridge the gap between data science and spatial analysis. It covers the fundamentals of geodata, tools in Python, and machine learning applications for spatial data. The book includes practical examples and source code available on GitHub to assist readers in understanding and applying the concepts discussed.

Uploaded by

tamasndadza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Machine Learning on Geographical Data Using Python 1st Edition Joos Korstanje instant download

The document is a promotional overview of the book 'Machine Learning on Geographical Data Using Python' by Joos Korstanje, which aims to bridge the gap between data science and spatial analysis. It covers the fundamentals of geodata, tools in Python, and machine learning applications for spatial data. The book includes practical examples and source code available on GitHub to assist readers in understanding and applying the concepts discussed.

Uploaded by

tamasndadza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

Machine Learning on Geographical Data Using

Python 1st Edition Joos Korstanje install


download

https://ebookmeta.com/product/machine-learning-on-geographical-
data-using-python-1st-edition-joos-korstanje/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Adaptive Machine Learning Algorithms with Python: Solve


Data Analytics and Machine Learning Problems on Edge
Devices 1st Edition Chanchal Chatterjee

https://ebookmeta.com/product/adaptive-machine-learning-
algorithms-with-python-solve-data-analytics-and-machine-learning-
problems-on-edge-devices-1st-edition-chanchal-chatterjee/

Natural Language Processing Recipes: Unlocking Text


Data with Machine Learning and Deep Learning Using
Python 2nd Edition Akshay Kulkarni

https://ebookmeta.com/product/natural-language-processing-
recipes-unlocking-text-data-with-machine-learning-and-deep-
learning-using-python-2nd-edition-akshay-kulkarni-2/

Natural Language Processing Recipes: Unlocking Text


Data with Machine Learning and Deep Learning Using
Python 2nd Edition Akshay Kulkarni

https://ebookmeta.com/product/natural-language-processing-
recipes-unlocking-text-data-with-machine-learning-and-deep-
learning-using-python-2nd-edition-akshay-kulkarni/

The Culture of Judicial Independence in a Globalised


World 1st Edition Shimon Shetreet Wayne Mccormack

https://ebookmeta.com/product/the-culture-of-judicial-
independence-in-a-globalised-world-1st-edition-shimon-shetreet-
wayne-mccormack/
Information Technology for Healthcare Managers 9th
Edition Gerald L. Glandon

https://ebookmeta.com/product/information-technology-for-
healthcare-managers-9th-edition-gerald-l-glandon/

Stress and Your Body 1st Edition Robert Sapolsky

https://ebookmeta.com/product/stress-and-your-body-1st-edition-
robert-sapolsky/

Workplace Ostracism: Its Nature, Antecedents, and


Consequences 1st Edition Cong Liu

https://ebookmeta.com/product/workplace-ostracism-its-nature-
antecedents-and-consequences-1st-edition-cong-liu/

Investing in Stocks For Dummies Paul Mladjenovic

https://ebookmeta.com/product/investing-in-stocks-for-dummies-
paul-mladjenovic/

2021 African Small Publishers' Catalogue Colleen Higgs

https://ebookmeta.com/product/2021-african-small-publishers-
catalogue-colleen-higgs/
Love at First Swim Tiaras and Treats Book 5 1st Edition
Rachelle Stevensen Stevensen Rachelle

https://ebookmeta.com/product/love-at-first-swim-tiaras-and-
treats-book-5-1st-edition-rachelle-stevensen-stevensen-rachelle/
Joos Korstanje

Machine Learning on Geographical Data


Using Python
Introduction into Geodata with Applications and
Use Cases
Joos Korstanje
VIELS MAISONS, France

ISBN 978-1-4842-8286-1 e-ISBN 978-1-4842-8287-8


https://doi.org/10.1007/978-1-4842-8287-8

© Joos Korstanje 2022

Apress Standard

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.

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.

This Apress imprint is published by the registered company APress


Media, LLC, part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
Introduction
Spatial data has long been an ignored data type in general data science
and statistics courses. Yet at the same time, there is a field of spatial
analysis which is strongly developed. Due to differences in tools and
approaches, the two fields have long developed in separate
environments.
With the popularity of data in many business environments, the
importance of treating spatial data is also increasing. The goal of the
current book is to bridge the gap between data science and spatial
analysis by covering tools of both worlds and showing how to use tools
from both to answer use cases.
The book starts with a general introduction to geographical data,
including data storage formats, data types, common tools and libraries
in Python, and the like. Strong attention is paid to the specificities of
spatial data, including coordinate systems and more.
The second part of the book covers a number of methods of the field
of spatial analysis. All of this is done in Python. Even though Python is
not the most common tool in spatial analysis, the ecosystem has taken
large steps in user-friendliness and has great interoperability with
machine learning libraries. Python with its rich ecosystem of libraries
will be an important tool for spatial analysis in the near future.
The third part of the book covers multiple machine learning use
cases on spatial data. In this part of the book, you see that tools from
spatial analysis are combined with tools from machine learning and
data science to realize more advanced use cases than would be possible
in many spatial analysis tools. Specific considerations are needed for
applying machine learning to spatial data, due to the specific nature of
coordinates and other specific data formats of spatial data.

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

Mapmaking and analysis of the geographical environment around us have


been present in nature and human society for a long time. Human maps
are well known to all of us: they are a great way to share information
about our environment with others.
Yet communicating geographical instructions is not invented only by
the human species. Bees, for example, are well known to communicate on
food sources with their fellow hive mates. Bees do not make maps, but,
just like us, they use a clearly defined communication system.
As geodata is the topic of this book, I find it interesting to share this
out-of-the-box geodata system used by honeybees. Geodata in the bee
world has two components: distance and direction.
Honeybee distance metrics
– The round dance: A food source is present less than 50 meters from the
hive.
– The sickle dance: Food sources are present between 50 and 150 meters
from the hive.
– The waggle (a.k.a. wag-tail) dance: Food sources are over 150 meters
from the hive. In addition, the duration of the waggle dance is an
indicator of how far over 150 meters the source is located.
Honeybee direction metrics
– Although more complicated, the angle of the dance is known to be an
indicator of the angle relative to the sun that bees must follow to get to
their food source.
– As the sun changes location throughout the day, bees will update each
other by adapting their communication dances accordingly.
The human counterpart of geographical communication works a bit
better, as we have compasses that point to the magnetic north. Those of
you who are familiar with compass use, for example, on boats, may know
that even using a compass is not a perfect solution.
The magnetic north changes much less than the position of the sun.
What is interesting though is that the magnetic north and the true north
are not located at the same exact place. The true north is a fixed location
on the globe (the so-called North Pole), but compasses are based on
magnetism and therefore point to the magnetic north: a location that
moves a little bit every year.
If you are navigating a ship with a compass, you will constantly need
to do calculations that convert your magnetic direction measurements
into true direction measurements by adding magnetic variation, which is
a value that changes depending on where you are on earth.

Reading Guide for This Book


As you will understand from these two examples, working with geodata is
a challenge. While identifying locations of points by coordinates may
appear simple, the devil really is in the details.
The goal of this book is to go over all those details while working on
example code projects in Python. This should give you the fundamental
knowledge needed to start working in the interesting domain of geodata
while avoiding mistakes. You will then discover numerous ways to
represent geodata and learn to work with tools that make working with
geodata easier.
After laying the basis, the book will become more and more advanced
by focusing on machine learning techniques for the geodata domain. As
you may expect, the specificities of the use of geodata make that a lot of
standards techniques are not applicable at all, or in other cases, they may
need specific adaptations and configurations.

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.

Figure 1-1 A two-dimensional Euclidean space. Image by author

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.

Polar Coordinates and Degrees


A commonly used alternative to Cartesian coordinates is the polar
coordinate system. In the polar system, one starts by defining one point as
the pole. From this pole starts the polar axis. The graphic in Figure 1-3
shows the idea.
Figure 1-3 The polar system. Image by author
In this schematic drawing, the star is designated as the pole, and the
thick black line to the right is chosen as the polar axis. This system is
quite different from the Cartesian system but still allows us to identify the
exact same points: just in a different way.
The points are identified by two components: an angle with respect to
the polar axis and a distance. The square that used to be referred to as
Cartesian coordinate (2,1) can be referred to by an angle from the polar
axis and a distance.
This is shown in Figure 1-4.
Figure 1-4 A point in the polar coordinate system. Image by author
At this point, you can measure the distance and the angle and obtain
the coordinate in the polar system. Judged by the eye alone, we could say
that the angle is probably more or less 30° and the distance is slightly
above 2. We would need to have more precise measurement tools and a
more precise drawing for more precision.
There are trigonometric computations that we can use to convert
between polar and Cartesian coordinates. The first set of formulas allows
you to go from polar to Cartesian:

The letter r signifies the distance and the letter φ is the angle. You can go
the other way as well, using the following formulas:

As a last part to cover about degrees, I want to mention the equivalence


between measuring angles in degrees and in radians. The radian system
may seem scary if you are not used to it, but just remember that for every
possible angle that you can measure (from 0 to 360) there is a
corresponding notation in the radian system. Figure 1-5 shows this.
Figure 1-5 Radians vs. degrees. Image by author

The Difference with Reality


In reality, you never work with Euclidean space on a map. This is because
the world is not flat, but rather a sort of sphere. First of all, it needs to be
considered that the object is in three dimensions. More importantly,
distances from one point to another need to take into account the specific
curvature of the earth at that point. After all, to make it even more
difficult, the earth unfortunately is not a perfectly round ball.
In the real world, things have to be much more complicated than in
the Euclidean examples. This is done by the Geographic Coordinate
System which is adapted to our ellipsoidal reality. In this system, we
usually measure a point by a combination of latitude and longitude.
Latitude indicates how high or low on the globe you are with respect
to the equator. Longitude tells us how much left or right on the globe you
are with respect to the Greenwich meridian.
The earth is split into four quadrants from the zero point at the
intersection of the equator and the Greenwich meridian. You have north
and south and east and west together making up four quadrants. The
North Pole has a latitude of 90 degrees North, and the South Pole is 90
degrees South. Longitude ranges from 180 degrees West to 180 degrees
East.
Degrees do not have decimals, but rather can be cut up into minutes.
One degree consists of 60 minutes, and one minute consists of 60
seconds.

Geographic Information Systems and Common Tools


As you must understand by now, geodata is an easy way into a headache if
you do not have tools that do all the conversion work for you. And we are
lucky, as many such tools exist. In this part, let’s have a look at a few of the
most commonly used tools together with some advantages and
disadvantages of each of them.

What Are Geographic Information Systems


GIS or Geographic Information Systems are a special type of database
system that is made specifically for geographic data, also called geodata.
Those database systems are developed in such a way that problems like
coordinate systems and more are not a problem to be solved by the user.
It is all done inherently by the system. GIS also stands for the industry
that deals with those information systems.

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.

QGIS and Other Open Source ArcGIS Alternatives


Open source developers have jumped into this open niche of GIS systems
by developing open source (and therefore free to use) alternatives. These
include QGIS, GRASS GIS, PostGIS, and more.
The clear advantage of this is that they are free to use. Yet their
functionality is often much more limited. In most of them, users have the
ability to code their own modules in case some of the needed tools are not
available.
This approach can be a good fit for your need if you are not afraid to
commit to a system like QGIS and fill the gaps that you may eventually
encounter.

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.

Standard Formats of Geodata


As you have understood, there are different tools and programming
languages that can easily deal with geodata. While doing geodata in
Python in this book, we will be generally interested much more in data
processing than in data storage.
Yet a full solution for geodata treatment cannot rely on treatment
alone. We also need a data format. You will now see a number of common
data formats that are used very widely for storing geographical data.

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:

!pip 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.

import geopandas as gpd


shapefile =
gpd.read_file("sample_data/Communes_MGP.shp")
print(shapefile)
Code Block 1-1 Importing the shapefile

You’ll see the result in Figure 1-7.


Figure 1-7 The data 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)
To make something more visual, you can use the code in Code Block 1-
2.

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)

Google KML File


You are probably familiar with Google Earth: one of the dominating map-
based applications of our time. Google has popularized the KML file for
geodata. It is an XML-based text file that can contain geometry data.
The .KMZ file is a compressed version of the KML file. You can
decompress it using any unzipping tool and obtain a KML file.
As an example, let’s look at the exact same database as before, which
is located at France’s open geodata platform:
Ministry of DINSIC. Original data downloaded from
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b94f
2c318a0971e8faedb7b5675d6, updated on 1 July 2016. Open Licence
2.0 (www.etalab.gouv.fr/wp-
content/uploads/2018/11/open-licence.pdf)
In the resources part, you’ll see that this map of the Paris region’s
municipalities is also available in the KML format. Download it and you’ll
obtain a file called Communes_MGP.kml.
If you try opening the file with a text editor, you’ll find that it is an XML
file (very summarized, XML is a data storage pattern that can be
recognized by many < and > signs).
Compared to the shapefile, you can see that KML is much easier to
understand and to parse. A part of the file contents is shown in Figure 1-9.
Figure 1-9 The KML file content. 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)
To get a KML file into Python, we can again use geopandas. This time,
however, it is a bit less straightforward. You’ll also need the Fiona package
to obtain a KML driver. The total code is shown in Code Block 1-3.

import fiona
gpd.io.file.fiona.drvsupport.supported_drivers['KML']
= 'rw'

import geopandas as gpd


kmlfile = gpd.read_file("Communes_MGP.kml")
print(kmlfile)
Code Block 1-3 Importing the KML file

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

The result is shown in Figure 1-11.

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)

An interesting point here is that the coordinates do not correspond


with the map that was generated from the shapefile. If you’ve read the
first part of this chapter, you may have a hinge on how this is caused by
coordinate systems. We’ll get into this in much more detail in Chapter 2.

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' }

GeoJSON is a json-based format that defines a specific, standardized


way to deal with storing coordinates (not just points but also lines and
polygons) in the json format.
The Paris municipalities map that you’ve downloaded before is also
available in the geojson format. Download it over here (click GeoJSON in
the Resources part):
https://geo.data.gouv.fr/en/datasets/8fadd7040c4b
94f2c318a0971e8faedb7b5675d6
You will obtain a file called Communes_MGP.json. When opening it
with notepad or any other text editor, you’ll see that it is a json format
(shown in Figure 1-12). Of course, it is the exact same data: only the
storage format changes.
Figure 1-12 The content in json format. 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 get a GeoJSON file easily into the geopandas library using the
code in Code Block 1-5.

import geopandas as gpd


geojsonfile = gpd.read_file("Communes_MGP.json")
print(geojsonfile)
Code Block 1-5 Importing the geojson

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

The resulting plot is shown in Figure 1-14.


Figure 1-14 The plot resulting from Code Block 1-6. 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)

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.

pip install rasterio


import rasterio
from rasterio.plot import show
fp = r'ore-kbz-mnt-litto3d-5m.tif'
img = rasterio.open(fp)
show(img)
Code Block 1-7 Read and show the raster data

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)

It is interesting to look at the coordinates and observe that this file’s


coordinate values are relatively close to the first file.

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.

2. The world is an ellipsoid, which makes the two-dimensional


Euclidean space a bad representation. Other coordinate systems exist
for this real-world scenario.

3. Geodata is data that contains geospatial references. Geodata can come


in many different shapes and sizes. As long as you have software
implementation (or the skills to build it), you will be able to convert
between data formats.

4. A number of Python packages exist that do a lot of the heavy lifting


for you.

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.

6. A potential disadvantage of Python is that the software is open


source, meaning that you have no guarantee that your preferred
libraries still exist in the future. Python is also not suitable for long-
term data storage and needs to be complemented with such a data
storage solution (e.g., databases or file storage).
© 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_2

2. Coordinate Systems and Projections


Joos Korstanje1
(1) VIELS MAISONS, France

In the previous chapter, you have seen an introduction to coordinate


systems. You saw an example of how you can use Cartesian coordinates as
well as polar coordinates to identify points on a flat, two-dimensional
Euclidean space. It was already mentioned at that point that the real-
world scenario is much more complex.
When you are making maps, you are showing things (objects, images,
etc.) that are located on earth. Earth does not respect the rules that were
shown in the Euclidean example because Earth is an ellipsoid: a ball form
that is not perfectly round. This makes map and coordinate system
calculations much more complex than what high-school mathematics
teaches us about coordinates.
To make the problem clearer, let’s look at an example of airplane
navigation. Airplane flights are a great example to illustrate the problem,
as they generally cover long distances. Taking into account the curvature
of the earth really doesn’t matter much when measuring the size of your
terrace, but it does make a big impact when moving across continents.
Imagine you are flying from Paris to New York using this basic sketch
of the world’s geography. You are probably well aware of such an
organization of the world’s map on a two-dimensional image.
A logical first impression would be that to go from Madrid to New
York in the quickest way, we should follow a line parallel from the latitude
lines. Yet (maybe surprisingly at first) this is not the shortest path. An
airplane would better curve via the north!
The reason for this is that the more you move to the north, the shorter
the latitude lines actually are. Latitude lines go around the earth, so at the
North Pole you have a length of zero, and at the equator, the middle line is
the longest possible. The closer to the poles, the shorter the distance to go
around the earth.
As this example takes place in the northern hemisphere, the closest
pole is the North Pole. By curving north on the northern hemisphere
(toward the pole), an airplane can get to its destination with fewer
kilometers. Figure 2-1 illustrates this.

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.

Geographic Coordinate Systems


Other documents randomly have
different content
This affair brought on a heavy cannonade, which kept up nearly
all the afternoon, and when night came the Confederates fell back,
which they continued to do until they reached Winchester again, and
the company of White had a long and hard scout to find Gen. Ewell’s
ordnance train, which by some means had got off the road at
Smithfield; and during this scout they found a box of sabres at
Stevenson’s depot, which was sent back by a detail for the purpose,
and the Yankees coming up about this time gave the boys carrying
the arms a chase, in which several sabres were lost, but they
boasted that all the scabbards were saved.
On reaching the division the train was found to have been in camp
all the time, and now the fact that Fremont was coming down on
one flank, and Shields on the other, both moving on lines that would
unite them in Jackson’s rear, impelled that commander to move up
the Valley, not thinking it very desirable to form a junction with the
Generals named so far away from the Blue Ridge, which was always
the great commander’s wall of defense under his faith in the Great
Jehovah.
Sunday morning, June 1st, 1862, the army reached Strasburg, and
at this point Gen. Fremont attempted to flank “Stonewall,” but the
latter preferred not to be flanked, and to prevent it unlimbered his
batteries and after an hour’s conversation by the brazen lips of these
interpreters, Gen. F. decided that if Jackson didn’t want to be
flanked, why he wouldn’t do it, and gave up the job, but from now
on the Yankees closely pressed the rear, and Ashby with his cavalry
and Chew’s battery fought them from every hill.
It was while on this march that Col. Sir Percy Wyndham bagged
Ashby, an exploit by which he hoped to win a Brigadier’s
commission, and undoubtedly would have done so if he had taken
Ashby to Washington instead of allowing Ashby to take him to
Richmond.
The couriers had extremely severe work on this march up the
Valley pike, but the army encamped regularly every night, and never
for one moment did the march take the appearance of a retreat, for
the rear guard always held its positions as long as it was necessary.
On arriving at Mount Jackson, Gen. Ewell established headquarters,
and pitched his tent at the end of the bridge and on the bank of the
river, but during the night a tremendous storm of rain came down
and the stream raised so rapidly that before headquarters knew
what was going on it was on an island, with the water rising every
moment, and no boat to get out in. Everything was soon in
confusion, but Gen. Ewell mounted his old gray horse, “Rifle,” and
taking the little Indian, “Friday,” behind him, plunged into the water
without coat or hat and swam over to the camp of his cavalry,
leaving the staff and wagon to get out as they could, but the
company went to their assistance and soon had the whole business
moved over.
Next morning Lieut. Barrett was ordered to New Market, with a
detail from the company, to act as provost guard, and the division
lay in camp all day just beyond the town. Here the news of the
battle of Seven Pines was received and of the wounding of General
Johnston, at that time Commander-in-Chief of the Virginia army.
There was a great deal of wonder and speculation as to who would
succeed him, some thinking Beauregard would take command, while
many of the men thought our own Stonewall was the man for the
place, but nobody thought of Lee, until in reply to a question on the
subject, we heard Gen. Ewell remark, "No, sir; I don’t know who will
be General Johnston’s successor, but I shan’t be scared at all if the
choice falls on Lee." This circulated from camp to camp, and many
of the soldiers freely admitted that they would be scared, for they
considered that Gen. Lee’s Western Virginia campaign a failure, and
if old Scott did say beware of Lee on an advance, they were afraid
that the change from following the retreating Johnston to that of
rallying under the banners of the advancing Lee wouldn’t be very
beneficial to the army or the country, and Gen. Beauregard always
had whipped the Yankees without either an advance or a retreat.
These were only some of the many expressions of opinion on the
subject of changing commanders, and only for the fact that for a
short while they were lying quiet, with nothing to do, the subject
would scarcely have had a place in the minds of Jackson’s men, for
soldiers soon learn to submit blindly to the powers that be, and
obey, unquestioningly, the orders of their officers.
“Theirs not to reason why,
Theirs not to make reply,
Theirs but to do and die.”

While halted at New Market, an incident occurred which


banished all thought of the Richmond army from the minds of
those who witnessed it, and filled each heart with pride, which
claimed Virginia as its home, and that was the daring and almost
miraculous escape of Gen. Ashby from the enemy, who attacked
him at the bridge on the turnpike and chased him almost to
town, killing his celebrated white stallion, but nearly every one of
the seven pursuers were killed or wounded by Ashby and his
single companion, although the General had no loads in his
pistols and fought entirely with the sabre.
This was the last time we ever saw the great soldier on the war
path, for he was killed the next day while leading an infantry
regiment in the battle at Harrisonburg, (June 5th, 1862), and thus
went down in a billow of blood the brilliant star of glory which
promised to dazzle the astonished nations with the splendid blaze of
chivalric light which now only blazons the fame of the knights of the
olden time,

“Whose bones are dust, whose swords are rust,


Whose souls are with the saints, we trust.”

Whatever the world may say of the right or wrong of the “Lost
Cause,” it will never deny that many of those by whom it was
upheld, and who crowned its banners with glory in carrying them
so gallantly and so far, were inspired by motives as patriotic, as
pure and bright as ever burned in the bosom of mortal man.
They were brave men; they fought as brave men fight, and died
as brave men die. Upon a hundred “stormy heights and carnage-
covered fields,” they attested their devotion to their cause, and
among the truest and bravest of them all, the name of Gen.
Turner Ashby shines with a radiant glory that will brighten still as
it goes “sounding down the ages,”
“The knightliest of the knightly race,
Who since the days of old
Have kept the lamp of chivalry
Alight in hearts of gold.”

There was mourning in the camp that night, and every face
wore a look of gloom as if in the calamity which had just befallen
them, the soldiers felt that a harbinger of still greater desolation
had been given them, and when Gen. Jackson appeared in the
morning, all eyes looked eagerly to see how he felt the loss of
the great cavalier, but in that calm and steady eye was an
inscrutable look, and no man could form an idea of what were
the feelings of the commander by the expression of the face that
never changed, either in the glory of triumph or the gloom of
defeat.
The army lay quiet all day, and the next moved towards Port
Republic, encamping near the old Church at Cross Keys. Some of the
men became very impatient at the constant and rapid marching, and
one of them asked Gen. Jackson, as he passed along the column,
where he was going to fight the Yankees. The General, with a half
smile, replied, "We’ll fight them in Brown’s Gap," and the soldiers at
once became exceedingly interested in that place, continually asking
each other “how far it was to Brown’s Gap. Would the Yankees follow
them there?” &c., little imagining that the ground upon which they
then stood was to be their battle-field for the morrow.
Sunday morning, June 8th, broke bright, clear and hot, and by 8
o’clock every one knew that Ewell was going to match his division
against the advancing columns of Fremont, for the cavalry, now
commanded by Col. T. T. Munford, slowly retired before the Yankee
infantry, and Gen. Ewell’s brigades moved out quietly and formed
their battle lines. The scouts and couriers now had plenty of work
again, and Lieut. Barrett, with a part of the company, was ordered to
act as provost guard again, while Gen. Ewell ordered Lieut. Myers
and Ed. Wright to scout on the right, and let him know when the
enemy made any demonstration in that direction. The remainder of
the boys were on duty as couriers with the Generals. The battle
opened with some artillery firing, but pretty soon Taylor’s brigade
met and whipped a line of Yankees that advanced upon Ewell’s
centre, and all was quiet again for an hour, when Elzey’s men
became engaged, and at the same time Myers and Wright
discovered a heavy force moving by the flank to Ewell’s right. Gen.
Trimble was the first man they met on their return with this
important information, and communicating it to him, that officer
promptly moved his brigade forward, and attacking the flanking
party in flank, they were very soon driven off with heavy loss in men
and all their artillery. About the time Trimble’s guns opened, General
Taylor advanced, and for a while the battle raged with great fury, but
General Trimble’s movement exposed the enemy’s left flank, and
they fell back along the whole line.
This ended the battle of Cross Keys, with the exception of some
cannonading on the left about sundown, and although some horses
of the couriers had been struck, only one of White’s men was
touched, and he very slightly, by a bouncing grape shot.
That night they slept upon the battle-field, but with the dawn
everything moved rapidly towards Port Republic, for Shields, with his
army, was moving up the river, and Gen. Jackson was going to "fight
in Brown’s Gap" again.
On Monday morning “Stonewall” crossed the bridge almost alone,
and rode into the town, but on his return found a Yankee Major with
two pieces posted at the mouth of the bridge, and, without a
moment’s hesitation, rode up to the officer, saying, “Turn your guns,
sir, turn your guns; the enemy is coming from that direction,”
pointing at the same time down the river, and without a question,
the unsuspecting Major had his pieces wheeled about, in order to
command the approach of the enemy, which to him was no enemy
at all, and without waiting to explain any further, Gen. Jackson
dashed rapidly across the bridge to his own people, but he had not a
moment to spare, for the baffled Yankee had his guns going on him
before he cleared the bridge.
Jackson instantly ordered his artillery up, and very soon the
enterprising “boys in blue” were compelled to change their position,
thus leaving the bridge open to the Confederates, and General
Jackson’s old Division crossed the river, followed slowly by that of
Gen. Ewell, with whom White’s cavalry moved.
Immediately on reaching the east bank, the line of battle was
formed, and the fight commenced, and as soon as everything had
crossed the bridge it was fired, cutting off Fremont’s army from that
of Shields, and with it a company of the 6th Va. Cavalry, which acted
as rear guard and was compelled to swim the river.
Here was begun and carried through to complete success one of
the most brilliant displays of generalship witnessed during the war,
or, in fact, in any war of modern times.
“Stonewall” had not only eluded the superior force of Fremont, but
had actually whipped him, almost in cannon shot of his colleague, on
the 8th, and now, on the 9th of June, was massing all his troops and
crushing the army of that colleague—(Gen. Shields)—while Fremont,
with his troops formed in battle-ranks on the hill-sides bordering the
Shenandoah, was unable to do more than look at the battle and see
the army of Shields annihilated; while, without a guard, and just in
his front, moved the long train composed of all of Jackson’s wagons,
all of Ewell’s and nearly every one of Banks’, besides some of his
own; and standing still in all the circumstance and panoply of war,
the blazing bridge cutting off his last and only means of doing harm
to his wily foe, the savage Gen. Fremont, in pitiful helplessness and
vindictive vandalism, could only fire his guns upon the empty town
of Port Republic.
By 10 o’clock the battle was over and Shields flying down the river
with the scattered remnant of his army, which Gen. Jackson only
followed for nine miles when he returned to look after his trains and
captures.
The enemy had lost all of his artillery, consisting of about fifteen
guns, all of his wagons and a great number of prisoners, besides
many killed and wounded, for Shields fought with more obstinacy
than Fremont, although the latter had considerably more force than
his adversary—Gen. Ewell—while Shields had an inferior one to the
combined troops of Jackson and Ewell.
The couriers had very warm and exciting work to-day, as is usual
on the battle-field, but although many narrow escapes were made
not one was wounded, and they captured a full company of Ohio
infantry.
Lieut. Myers was sent by Gen. Jackson, during the heat of the
battle, with a dispatch to Col. Munford to charge, with his cavalry, a
battery which was doing heavy execution, and remained with the
Colonel until the enemy’s lines broke up in full retreat, when he
rejoined Gen. Jackson and kept with him in the nine mile pursuit,
which caused him to be the recipient of another scolding from Gen.
Ewell, who informed him that he was no courier for Gen. Jackson,
and that his business was to keep his (Ewell’s) Division supplied with
couriers, and to obey his orders and nobody else’s. It is needless to
say that the lesson was laid to heart and closely followed thereafter.
The army bivouacked in Brown’s Gap that night, and the next day
the usual rain storm which follows a battle poured down upon them,
as they still waited to see and do whatever “Old Stonewall” might
decide upon as best for them; and two days after, the great
commander put his people in camp at Mount Meridian, where, for
several very beautiful June days, the troops passed away the time,
fishing and bathing in the blue Shenandoah, and visiting the
wonderful Weyer’s Cave, while each day a regular detail was made
to go to Port Republic and “make believe” build a bridge as if
Jackson intended to try another campaign down the Valley, when, in
reality, he was preparing to march his army to the relief of the
Confederate Capital, which was now closely environed by the
magnificent army of McClellan, and was anxiously waiting the critical
moment when the last spadeful of dirt should be thrown, and the
“Young Napoleon” would replace his sappers and miners with the
splendid battalions who were to immortalize the name of McClellan
by taking, under his plans and direction, the now world-renowned
City of Richmond.
White’s company was in splendid condition, the ranks full, the
horses thriving and the men all armed equal to any cavalry in the
army, and all they wanted was for their Captain to come up and take
command again. While at Mount Meridian Gen. Jackson had divine
service regularly, and appointed times for praise and thanksgiving to
the God of battles who had crowned his arms with victory; while
from all around our borders came news of Confederate successes,
and rumors that foreign nations had recognized the independence of
the Southern Confederacy. So that the future was brilliant with hope
and no man in the army would have willingly exchanged his
Confederate dollars for an equal amount of greenbacks.
CHAPTER V.

About the 20th of June the army crossed the Blue Ridge, and
moved quietly towards the beleaguered capital; but the men did
not know any more about their destination than the enemy, who
never knew, until his artillery boomed upon McClellan’s flank at
Richmond, that Jackson had left the Valley. On arriving at
Charlottesville, Capt. White, now entirely recovered from the
effects of his wound, rejoined his company, and it now appeared
that the little band of scouts and couriers was to be the
foundation upon which a larger command was to be built up, for
here the news was received that Capt. George W. Chiswell, of
Maryland, was on the march from that State with a full company
to join White’s Cavalry, and all the boys began to look forward to
the time when the irksome duty of waiting upon the Generals
and playing telegraph for an army, was to be exchanged for the
more congenial and pleasant one of once more scouting on the
frontier. Encamped at Charlottesville they had seen a battalion of
men commanded by Major John Scott, of Fauquier Co., Va., and
organized by that officer to act as Partisan rangers. It seemed
that mainly through the influence of Major Scott, a bill had been
introduced into the Confederate Congress, and which afterwards
became a law, authorizing the formation of such bands, and
offering premiums in captured property for an independent
border warfare upon the outposts and communications of the
enemy’s army, and this idea struck the minds of White’s men
very forcibly as containing the very principle upon which their
company had been formed, and the one they most desired to
have applied to their own particular case, and they believed that
in strict justice, Capt. White could get the authority under the
law to become a Partisan, as soon as his command was large
enough to justify it, and all hailed with joyful acclamation the
report that Maryland men were coming to join them; in fact the
advance guard of the company met them at Charlottesville in the
persons of Ed. J. Chiswell, Sam. White, Frank. Williams and
Elijah Viers.
Some anecdotes of Gen. Jackson, and the manner in which he
was regarded by his men, and the enemy too, were current in the
army during this campaign, and were true in idea if not in detail.
Before leaving camp at Mount Meridian, an order was issued
instructing the men not to tell what or whose troops they were, and
to answer all questions on the subject with Gen. Ewell’s
abomination, "don’t know," as a precaution against the enemy
getting a knowledge of Jackson’s movement from the Valley. One
day the General saw a soldier crossing a field towards some cherry
trees, and as the great abundance of cherries along the route had
caused any amount of straggling, he resolved to make an example
of this man. So riding up to him he inquired, “What division do you
belong to?” "Don’t know," said the soldier. “What brigade?” asked
the General; and again the soldier replied, "don’t know." “Well,”
asked Jackson, “what regiment do you belong to?” thinking he had
now found an answerable question; but again the man replied,
"don’t know," and with some asperity of tone the General exclaimed,
“What do you know, sir?” when the cute “gray jacket” answered—"I
know that old Stonewall ordered me not to know anything, and
damned if I ain’t going to stick to it."
The General turned and rode away without a word, smiling at the
extremely literal construction of orders which had saved the soldier
from the punishment he had meditated for him.
Gen. Jackson got aboard the cars at Louisa C. H., to go to
Richmond, and took a seat in the same car in which a Yankee Major,
who had been captured among some of the raiding parties on the
Rail Road, was being carried also to Richmond.
The Major entered into conversation with the quiet officer, not
knowing, of course, who he was talking to, and began explaining to
him the absolute certainty of McClellan’s capture of the Confederate
capital. After listening for some time to the manner in which each
division of Lee’s army was tied up by a stronger force from the other
side, “Stonewall” ventured the remark, "But suppose Jackson’s army
should move from the Valley and strike McClellan in flank and rear
while he is engaging Lee in front." “Oh,” said the Major, "there’s no
danger of that, Jackson has been badly crippled in his engagements
in the Valley, and is now hemmed in closely by Fremont’s army, so
that he can’t move." “But,” persisted the Confederate, “suppose he
should getaway and come to Richmond.” "No, I say it’s no use to talk
about that," said the Major, "for he can’t get away, it is impossible."
“Yes,” said the other, “and I say it is possible, for he has already
whipped Fremont, and his army will be in front of Richmond in less
than twenty-four hours.” The Yankee looked at him a moment, and
with an anxious expression asked, “Who are you, sir?” “I am Gen.
Jackson,” replied the hero; upon which the Major smacked his hands
together exclaiming, “Whipped again, by God!” and at once subsided
into silence.
When the army of Jackson reached its position and it was plain to
everybody that the time had come for the great battle, the men who
had followed “Stonewall” all over the Valley, and had seen his banner
wave in triumph on every field, were rendered still more proud of
their great leader by seeing, about noon on the day of “Cold
Harbour,” the men whose names were already encircled with a halo
of glorious deeds performed during the war, ride up and report to
Gen. Jackson for instruction.
Longstreet, A. P. Hill, Magruder, and Stuart, all acknowledged the
solemn soldier as their superior, and took his orders for the day’s
work.
That day’s work too was a sad and bloody one, and when night
ended the conflict, many were the corpses strewn over the carnage-
stained ground, and terrible arose the groans and shrieks of
mangled men; but the enemy still held the front and all thought the
morning sun must look down on a repetition of the same unchristian
work.
Gen. Ewell was found about midnight by the men who were sent
to him to relieve the couriers who had passed with him through
"Cold Harbour’s" baleful death-fires, lying along his lines, which were
drawn close up to the enemy, waiting for some sign to commence
anew the work of slaughter; but when daylight broke over the battle
lines the men in blue had disappeared, and soon after, Gen. Lee
found one of White’s boys and sent him to find Gen. Stuart and take
him to the Commander-in-chief.
This conference ended in Stuart posting off to see what had
become of the enemy, and it wasn’t long until that enterprising
cavalier had found out all about him.
In the operations which followed, Gen. Ewell moved with his
division to Despatch Station, on the York River Rail Road; and as a
matter of course White’s cavalry went with him. On their way to that
place they passed Yankee camps where the fires were still burning,
the camp-kettles of old ham and vegetables, and the coffee, still
boiling; while at many of them there were wagon loads, in some
instances houses full, of supplies of all kinds on fire; but what
created the greatest excitement of all, was a report that the Yankees
had poisoned the wells all around their camps by throwing into them
the supplies of medicines which their surgeons could not carry away
in their hasty retreat.
These rumors grew out of the fact that large quantities of powder
and cartridges had been tumbled into some of the wells, and those
who drank the water readily imagined it to be poisoned, not only
from the taste, but also that several of them were made sick by it;
and all threatened summary vengeance on the prisoners, but the
true state of the case was soon discovered and the excitement
quelled.
On arriving at the Station Gen. Ewell caused the railroad bridge
over the Chickahominy to be destroyed and a part of the track torn
up, and being now between McClellan and the White House, waited
for whatever force might come down the road.
About 4 o’clock in the afternoon a sound as of an enormous train
of cars was heard on the railroad, and every man was on the lookout
for something interesting to occur, supposing that the Yankees did
not know the road was cut and were attempting to run some trains
through, and knowing that if this should be the case they would
certainly meet a bloody overthrow at the bridge. The 13th Virginia
infantry was lying on the railroad, and White’s boys gathered on the
bank of the river, when soon, in the distance, appeared the most
singular looking affair any of them had ever seen on a railroad track.
It was a train of cars certainly, but high up over the locomotive was
built an affair that looked very much like a barn, being made of
plank and very long.
The general impression of the men at first sight was that it was a
contrivance from which the Yankees could fire at any rebels they
might discover, and thus keep the track clear; but there was very
little time to think much about it, for the iron-horse, under a full
head of steam, was carrying it at a rapid rate towards them, and
pretty soon the infernal machine leaped from the track into the
Chickahominy, and at the same moment a blaze of fire went up from
it that seemed to meet and melt into the blue of the sky, while an
explosion, so terrible that men lying on the ground a hundred yards
distant were lifted bodily, and in some cases had the blood forced
from ears and nostrils, broke out on the evening air. Just as soon as
they got their senses together White’s boys walked quietly off to
their horses, which had been feeding in an oat field a quarter of a
mile distant, and concluded they didn’t want to be around when
McClellan run his trains to the White House. This curiously contrived
affair must have contained three or four tons of powder and artillery
ammunition, for shells were exploding constantly from the time the
machine blew up until dark, but fortunately did no damage.
The next day Col. Bradley T. Johnson, of the 1st Maryland,
(afterward Brigadier General of the Maryland Line,) and Capt. White
were prospecting along the river for the enemy, the Colonel having
with him a rifle cannon with which he occasionally “felt the woods”
on the opposite side, and in the evening elicited a reply from several
batteries, whose smoke rolled lazily up through the trees in white,
foggy-looking masses, and showed that the “Young Napoleon” still
had a line of battle there. During the firing Gen. Ewell, accompanied
by White’s company, rode out to Col. Johnson, who showed him the
Yankee positions, remarking, at the same time, “and by the way,
General, I think I heard the long roll.” By this time the Colonel’s one
iron gun was attracting considerable attention from the Yankee
artillery, and their shells were flying very plentifully around him,
when Gen. Ewell turned his horse, and remarking to his escort "we’ll
go back now, boys," rode over the hill towards Despatch Station,
and in so doing passed in full view of the enemy’s line, who now
opened warmly upon him, and just before reaching the woods a
heavy shot passed between the General’s head and his horse’s neck,
causing the old fellow to make a very sudden backward motion, but
he instantly righted up, and noticing that the shot had struck a large
pine tree about twenty feet from the ground, and cut it off so clear
and sudden that the upper part of it came down perpendicularly and
stuck in the ground beside the stump, he exclaimed "wasn’t that
beautiful; wasn’t that well done!" but some of the boys remarked
afterwards that they didn’t know exactly whether he had reference
to his dodge or to the cutting of the tree, and they were afraid to
ask him.
On the 30th of June Gen. Jackson’s corps crossed the
Chickahominy at Grapevine bridge, and pushing on after the
retreating Yankees came up with them at White Oak Swamp, where
he had to fight them several hours with his artillery before his army
could get over. During the arrangement for this fight Capt. White
marched his company along the battle-line with “Old Stonewall,” and
after the latter had gotten his seventy guns in position, we halted to
watch the result. The enemy was firing constantly, but Gen. Jackson
made no reply until he had everything arranged to his notion, when
he gave the signal to commence firing, and it was soon evident that
he was more than a match for the Yankees. While the roar of the
guns was waking the echoes of swamp and forest, Gen. Jackson
rode along the line, where the shells from the enemy’s batteries
were flying the thickest, and, greatly to our wonder, held one hand
up as high as his shoulder nearly all the time, but wonder turned to
reverence when found that our hero was praying to the God of
battles to spare the lives of his men and crown their arms with
victory. Before long the bridge over the swamp was uncovered, and
Jackson’s infantry went across, capturing several of the enemy’s
guns and many prisoners. Here White’s men got into a snap with
some of the Pennsylvania Bucktail riflemen, but the Captain led them
in a charge, in which they captured a whole set of German-silver
wind instruments for a band, and several prisoners, killing and
wounding some of the “Bucktails.” They also got a splendid suit of
armor belonging to a Colonel, over which they had a great deal of
amusement, but in their experiments with the breastplate they
learned that it was bullet-proof against Colt’s army revolvers and all
the guns they could find, with one exception, and that was the
Maynard rifle, which tore a hole in it large enough for a hen’s egg to
pass through.
On the 1st of July we went to Malvern Hill, and the company was
busy enough during all of that long and bloody afternoon, carrying
dispatches for the several Generals operating in connection with
Ewell, and acting as provost guard to stop the soldiers from
straggling.
At the close of the battle, which continued until dark, Capt. White
took a detail of his men to Gen. Ewell, who had sent for him, and
found that officer, in company with Gen. Whiting, lying on the
ground to the left of the road, and with the advanced vedettes of
the army, conversing in whispers, the enemy being so close that
they could not talk in an ordinary tone without being heard by them;
and when White and his boys had crawled up to the General, finding
him with great difficulty, he sent them back, saying he was going to
advance his infantry line pretty soon, and had no scouting to do, as
he had found the enemy and they were in his front—so close that he
could throw a stone over their line.
White and his men crept back in the same noiseless manner to
their horses, where they waited anxiously for the opening fire of the
intended advance; but it was not made, or, if made, the Yankees had
gone, and the ever-memorable campaign of seven days’ battle
around Richmond was at an end; while with it ended the Northern
policy of conducting the war according to the established rules of
humanity recognized by civilized nations, for now McClellan, who
had treated the citizens inside of his military lines humanely, and had
respected their rights and protected their property, as far as
possible, from the usual pillaging that attends the movements of
every large army, was to give place to another who had nothing but
his brutality to recommend him to the favor of the “greatest and
best government the world ever saw,” which was now represented in
Washington City by a crew of foul birds of the devil’s own hatching,
whose names will make the cheeks of Americans crimson with
shame as long as American history is read; and Gen. Pope, from his
“headquarters in the saddle,” announced that henceforth the
business of his army should be to investigate the color of the coat
tails of the rebels, and that the time had arrived when a new era in
military tactics should dawn upon the astonished world through the
transcendent genius of “John the Pope,” and that under him the
battles of Abolitiondom should be fought with fire and sword,
according to the most approved rules laid down by the aborigines of
North America, with all the improvements which the Spanish
greasers of Mexico had been enabled to add from the familiarity of
their fathers with the horrible scenes of the infernal inquisition; all of
which had been revised and corrected within the sound of Mr.
Seward’s little tinkling bell for special use in the Grand Army of “John
the Pope,” and the world was assured that the war had commenced
in earnest; while those whose attention had heretofore been called,
by accident, to the career of Mr. Pope, and had formed their opinion
therefrom, predicted that women and children would suffer now, for
the chosen Sachem of the little-souled Yankee Nation was on the
war-path, and the influence of the Northern people in whose hearts
the God-given principle of chivalric forbearance towards the weak
and helpless had an abiding place, was literally smothered to death
in the smoky vengeance which the nigger crusaders had
manufactured for crushing the rebellion—“vide” Brownlow, Stevens
& Co.
CHAPTER VI.

For several days after the close of the seven days’ campaign
the army lay quiet, and White’s people had a delightful camp at
Meadow Bridge, about 7 miles from Richmond, on the Rail Road,
from which they could send to the city daily for such luxuries as
the markets afforded; and during this time there was not much
to do in the way of carrying dispatches, so that there was little to
do except rest. Here the company held an election for Orderly
Sergeant, which resulted in the choice of C. M. C. Whaley, for
that important position, and the list of non-commissioned
officers was now full, viz: Edward S. Wright, 2d Sergt.; Benjamin
F. Conrad, 3d Sergt.; John Dove, 4th Sergt.; and J. Mortimore
Kilgour, 5th Sergeant and Quartermaster; John T. Tribbey, 1st
Corporal; Daniel C. Pettingall, 2d Corporal; William Snoots, 3d
Corporal; and Peter J. Kabrich, 4th Corporal.
About the 10th of July, Gen. Ewell marched his division to his old
camp near Liberty Mills, on the Rapidan, where for some weeks he
remained watching “Mr. Head-quarters-in-the-saddle,” who was
prospecting towards Gordonsville, in the new “On to Richmond”
movement of his own and father Abraham’s invention, and ravaging
all the country inside of his lines in the barbarous manner which had
been predicted of him from the beginning of his reign, which was as
literally a “reign of terror,” to the defenseless people under his
dominion, as ever was the bloody revolution to the citizens of Paris
during the days when flame and murder held high carnival at
command of the devils incarnate who ruled in France.
White’s company had now increased to nearly one hundred men,
and the Captain spent much time in scouting in Madison County,
which was just on the border of the “grand army,” and very much
infested with its cavalry raiding parties.
On one occasion, with about thirty men, he drove a strong force of
infantry and cavalry from Madison C. H., making the citizens imagine
that they were once more free from the terrible dominion of Pope.
And again, from the mountain top near Wolfton, he discovered a
company of cavalry engaged in plundering a farm-house, and as
rapidly as possible came down on them; but owing to the fact that
some of his men had been seen by the enemy as they descended
the mountain, he was only able to catch about half a dozen, chasing,
however, the remainder out of their hats, and into their camp. About
the last of July, Capt. White left camp at dark, and marching all
night, with twenty men, reached a farm-house five miles from
Stanardsville about daylight, and halting his command, he sent
Lieut. Myers, with the citizen pilot who had volunteered to guide
him, to look up the Yankees. On reaching the Conway river, about
sunrise, they discovered seven Yankees on foot, going from a camp
over the river to a citizen’s house for breakfast, and sending the
guide with all haste to inform the Captain, the Lieutenant took a
position at the gate, about one hundred yards from the house, to
watch the “boys in blue” until the command could come up and get
them.
After about an hour’s watching and waiting, which, to the lonely
picket appeared like four hours, the Captain came up with a part of
his squad, and before the Yankees knew it, the rebels were in the
yard; when, hastily leaving the table, they each “took a tree,” and
with their carbines attempted to fight it out; but it was too late, and
with what grace they could command, the foragers had to “on to
Richmond.”
The next expedition White made was for the purpose of
bushwhacking a patrol of cavalry, which daily passed over the road
from Robertson river to Madison C. H., and reaching the road in the
evening, he dismounted his men and placed them in the woods
alongside of it, sending Lieut. Myers, with Ferro and Spicer, up the
road as a decoy, expecting the Yankees to chase these men past the
ambuscade, when the others would open on them with their double-
barrels and buckshot; but the

"Best laid schemes o’ mice and men,


Gang aft agley,"

and the patrol failed to pass that evening.


In the morning the Captain moved his people by the Poorhouse to
another point on the road; but, after waiting about two hours, found
the enemy advancing in strong force of infantry and cavalry to
occupy the Court House, and on exchanging a few shots found a full
brigade developed against him, when he retired.
On the way to camp in the afternoon the Confederate pickets at
Jack’s Shop, without any warning at all, fired upon the little
company, fortunately without doing any damage, when the Captain
galloped forward alone and succeeded in rallying the retreating
pickets and convincing them that they were running from their own
men.
When White’s men came up they found their Captain talking very
sharply to the pickets about firing on him before they halted him,
and high words were passing, when one of the firing party said "if
you wasn’t a Captain you shouldn’t talk that way;" but the Captain
exclaimed "no I ain’t; I’m no Captain; I’m Lige White, and can whip
you any way! Come on! I dare you!" But nobody took up the
gauntlet; and with a pleasant little malediction on cowards
everywhere, but especially on picket, the ranger chief marched on to
camp.
About the 6th of August Gen. Jackson commenced to show some
uneasiness, and ordered Gen. Ewell down the road towards Louisa,
but came back the next evening, and instead of halting at the old
camp, kept right on towards Culpeper, and commenced picketing
beyond Robertson river. The boys begun to have ideas that the man
with the movable headquarters had better commence moving; but
when they found that Jackson’s Quartermaster-General (Banks) was
in front, they said they "just knew ’Old Stonewall’ was getting scarce
of supplies and only came up after some."
On the morning of the 9th, as White’s boys were lazily lying
around the shady yard of the house where General Ewell’s
headquarters were, talking about the prospects, in imagination, of
ever seeing Loudoun again, and listening to the General’s baby-talk
to some little children he had coaxed to come to him on the porch,
Gen. Jackson rode up, and very soon the two were studying intently
some maps and papers which they spread out on the floor.
Gen. Ewell’s ideas appeared to be in accord with "Stonewall’s,"
and they soon laid themselves out for a rest; but after dinner
everybody got busy all at once, and it wasn’t very long until we
found ourselves face to face with a Yankee line of cavalry deployed
as vedettes, and apparently bent on investigating the rebel
operations and ascertaining why they came so near to Gen. Banks’
wagon trains at Culpeper C. H. Their cavalry was commanded by
Gen. Prince, who had been a classmate of Stuart at West Point, and
was a fine officer, and a gentleman. His troops were splendidly
drilled, and the first that White’s men had seen who performed their
evolutions on the field at the sound of the bugle. About 3 o’clock
Capt. White and Lieut. Myers rode out on the lines, to gratify their
curiosity, to see what was going on, and before they were aware of
it almost, were witnessing the movements of a regiment of cavalry,
that deployed most beautifully as the bugle notes floated musically
on the air, and in a short time had advanced to a fence not a
hundred yards from the curiosity hunters, who quietly rode off as a
shell from one of Jackson’s guns exploded in a group of Yankee
cavalry. While riding up the line a Yankee approached them from the
woods, but scampered away again as Capt. White called to him
“come here to me, you rascal.” About an hour after this Gen. Ewell
called for his cavalry to go with him, and riding at a gallop, soon
reached the foot of Slaughter Mountain, where White’s boys, by
order of the General, dismounted, and dragged Lattimer’s Battery of
artillery to the top of the mountain, where the “Napoleon of the
Valley,” as General Jackson called Capt. Lattimer, commenced firing
as soon as his first piece was in position, and until his own men
came up with the remainder of the battery, White’s men acted as
gunners for him. By this time the blue and the gray were getting into
a very warm fight down on the plain at the foot of the mountain,
and Lattimer’s first shot was a fine one, exploding exactly at a
Yankee battery, but the blue jackets instantly replied with one gun,
which sent a shell within two feet of the muzzle of Capt. L.’s piece,
striking the trail of the gun-carriage.
The shells and solid shot now hailed thick around the Confederate
position on the mountain, and the Louisiana brigade, which had
taken post there, enjoyed it hugely, some of the men being on the
open ground in front, instead of in rear of the battery, where they
belonged, would run to the places where the Yankee shot tore up
the earth and coolly sit down, saying they were safe now, “as
lightning never struck twice in the same place,” but some of them
lost their heads by the operation in spite of the proverb.
The battle raged with great violence until dark, and even when
her sable wing had spread over the wild scene of blood and death,
the artillery continued to fire, and if there is anything in war that can
be called splendidly beautiful, it is a night cannonade, when high
overhead, in the very middle, apparently, of the black field, the
hissing shells fly in curving lines of beauty, leaving behind them a
track of sparkling flame, until the explosion blazes a lurid glare all
around the sky, which can he likened to nothing better than to the
fitful flashings of Aurora in her most gorgeous masquerades.
When the firing ceased White’s men had left the mountain and
advanced to a house near where the Yankee battery which had been
the recipient of Lattimer’s first compliment had stood, the enemy
having been driven back a considerable distance, and here they laid
down and slept soundly till daylight, when their first notion was to
look around for Yankees and plunder, in which interesting occupation
they passed the time until noon, having secured a number of
prisoners and quite a large quantity of arms and other trophies of
the battle-field.
About 1 o’clock the company retired to a large spring, near the
house before spoken of, and unbitting their horses, turned them out
to graze, while the men lay in the shade of the trees around the
spring reading the Yankee papers they had gathered up. The Captain
was very busily engaged in conversation with Mr. Henry Ball, who
had just come from Loudoun, and brought to the Captain the
delightful intelligence that his wife was near the old camp at
Somerset, having accompanied Mr. Ball through the Yankee lines
without difficulty.
A small detail of the company was assisting Major Christie,
ordnance officer of the division, to remove a quantity of ammunition
from a broken-down wagon, about a quarter of a mile above, when
the officer in command of the infantry skirmish line passed along
and informed the Captain that the pickets were all withdrawn from
his front and he must look out for Yankees. “All right,” responded
White, and straightway forgot all about it in the interest of his talk
with Mr. Ball.
Soon after this a commotion was heard in the direction of the
ordnance detail, and before the men had time to get up, a squadron
of Yankee cavalry charged down upon them, firing, yelling, and
making everything look very blue. There was of course great
consternation among White’s people, but all scrambled to their
horses—the Captain mounting his own before putting the bit in its
mouth—and as soon as they found themselves in their
“headquarters,” the confusion manifestly subsided, so that when
Capt. White called on them to follow him in a charge upon the
enemy, they responded gallantly, and chased the Yankee squadron in
most splendid style over the same track they had come, at the same
time rescuing Major Christie and his detail from the hands of the
Yankees. Two of the men who were with the Major had already
effected their escape, viz: Jas. H. Mock, by splendid riding, and
Thomas Spates by literally outrunning his horse, a thing until then
entirely unheard of. The old Major was doing his best to get away on
foot, but the enemy had him surrounded and were striking him over
the head and back with their sabres, but they instantly left him when
the pistols of White’s boys begun cracking among them, and the old
man mounted behind Lieut. Marlow, who carried him out of danger;
and always thereafter there was no difficulty in Capt. White’s men
getting all the ammunition they wanted from the ordnance
department of Ewell’s Division.
The horses of Lieut. Myers and Sergt. Conrad carried them some
distance in pursuit of the enemy after the balance of the company
had retired, and were not stopped until the two men found
themselves exposed to the fire of a line of infantry, which wounded
Conrad’s horse, when they too fell back, but not until the Sergeant
had cursed heartily the Yankees who shot his steed. From his
position on the top of Slaughter Mountain Gen. Ewell had witnessed
the whole of the gallant affair, and he complimented the Captain
very highly, calling it “a beautiful thing.”
This advance of the Yankees, and skirmish of White, brought on a
fight among the cavalry of both armies, which resulted in the
discomfiture of the enemy and capture of Gen. Prince.
The next morning Capt. White obtained permission to visit his
wife, and the command of the company devolved upon Lieut. Myers,
who was called upon to go, with a few men, to see that the Yankees
did not raid upon the wagon train, and on reaching them found
everything in great confusion owing to a report that the enemy’s
cavalry was about to attack the train; but the Lieutenant and his
party soon rallied, and formed into line, about two hundred infantry
stragglers who were about the wagons, and thus restored order
among quartermasters and teamsters.
After dark, when the company had rejoined the General, the
division withdrew from the mountain, and White’s men were left to
keep up the fires and make the Yankees believe the whole force was
still there; and once, when Sam White and John Marlow piled hay on
a fire, making a blaze that lighted up the side of the mountain, the
General threatened to “throw a pistol ball among them if they did so
any more,” but they quietly promised to return all the pistol balls he
threw them; however, they put no more hay on the fires. About
midnight the General ordered Lieut. Myers to take his company and
march rapidly to the bridge at Liberty Mills, with instructions to hold
it and prevent the Yankees from destroying it before the infantry
could get up. About daylight they reached the bridge, and in half an
hour an order came to send ten men, as couriers, to report to the
General on a road north of the Rapidan, but after considerable
difficulty in finding that number of men whose horses could stand
the trip, the detail was sent on the wrong road and missing the
General, excited his ire against Lieut M., and when he reached camp
and met the Lieutenant he abused him considerably for not obeying
his order, winding up with asking why he had not sent the detail;
and as the Lieutenant commenced to explain he unfortunately used
the expression, “I supposed, General,” when the General broke out,
“You supposed; you supposed, you say; what right had you to
suppose anything about it, sir; do as I tell you, sir; do as I tell you.”
That was the end of it, and during all the whole tirade of words the
subordinate had only had an opportunity to use three. The whole
force was again in the camp at Somerset, and now the Captain and
his people began to talk about a raid to Loudoun for the purpose of
chastising a band of renegades and Yankees which, under Sam.
Means, was reported to be harassing the people of that county very
severely; but, like foreign recognition and rumors of peace, it
appeared to be more talk than anything else, and the men, as a
general thing, hardly thought it possible to reach the “promised
land,” although it was the heartfelt aspiration of each to once more
behold it and enjoy the pleasure of sweet companionship with
homes and loved ones again. On the 16th, one week after the battle
of Cedar Run, General Jackson marched across the Rapidan towards
Culpeper C. H., and now hope burned brightly in Southern hearts,
for all the men believed that Gen. Lee could march into the North
Country and conquer a willing peace treaty from the Government at
Washington.
Pope made a stand on the Rappahannock, and while waiting for
the Southern army to drive him back again Capt. White perfected his
plans for the Loudoun expedition, and at Warrenton White Sulphur
Springs got Gen. Ewell’s sanction to it. When, on the 25th of August,
“Stonewall” left the main army and started on his flank movement to
Manassas, White marched with him, crossing the river opposite
Orleans, after which he made as fast time as possible in order to
gain the front of Jackson’s corps, which he succeeded in doing at
Salem. Just as his company passed the last regiment the men, who
had halted to rest, called out, "you wouldn’t have caught up with us
if the Colonel’s horse hadn’t given out." At sunset the raiding party,
having cleared all the troops, marched to the Bull Run Mountain,
which point they reached about daylight, and where they proposed
to lie over until night of the 26th. During the day the true-hearted
citizens of the neighborhood brought in plenty to eat, and some of
them spent a great part of the day in the camp, among them Mr.
Ball, Mr. Simpson, Mr. Wynkoop and others.
When the dark came down over the mountain the Captain formed
his men, consisting of about twenty of his own company, with Lieuts.
Myers and Marlow, about twenty of Capt. Randolph’s company, with
Capt. R. and Lieuts. Redmond and Mount, and half a dozen of Gen.
Jackson’s scouts under that splendid soldier Dr. Gallaher. After the
line was formed White made a short speech, telling his command
that his object in the expedition was to whip Means’ men, and that
no matter how much force they had he intended to do it; that he
knew where they were, and if the expedition failed it would be the
fault of his own men; closing by saying with King Henry, if any man
among them had no stomach for the fight upon such terms he was
now at liberty to return. The little force, augmented by the addition
of Messrs. Henry Ball and J. Simpson, now took up the line of march
for Waterford, passing along the mountain all the way, and arriving
at Franklin’s Mill an hour before daylight, when a halt was ordered
and scouts sent out to ascertain if any changes had been made in
the disposition of Means’ command.
While lying here a party of eight was heard passing the road from
Leesburg, who, from their conversation, were rightly judged to have
been scouting all night to learn if there was any movements of the
Southern army to the northward, and their words proved that they
were perfectly satisfied and felt entirely secure, for among other
things their leader was heard to declare, as they watered their
horses within ten feet of one of White’s scouts, that "there wasn’t a
rebel soldier north of the Rappahannock."
As soon as this party passed beyond hearing, White moved his
people to Mr. Hollingsworth’s barn-yard, where about twenty of them
were dismounted, under command of Capt. Randolph, and ordered
to march to the enemy’s quarters, which were in the Baptist
meeting-house, about one hundred yards distant, with instructions
not to fire until they entered the house, or, in case the enemy was
outside, to get into the yard with them before firing, and then to
rush upon them and go with them into the house. The Captain held
the remainder of his men mounted, and rode to the brow of the hill
in the road by Hollingsworth’s gate to wait for the movement of
Randolph to drive the Yankee boys from their quarters, when the
cavalry would dash down and capture them.
Dawn was just beginning to turn the black of night to the gray of
early morn when the movement commenced, and on Capt.
Randolph’s party getting near enough to see, they discovered Means’
whole force standing in the yard listening to the report of their
scouting party, which had just come in, and though they looked
wonderingly at the infantry advance of White’s army, not one of
them said a word; but in spite of his orders, which could have been
executed with perfect safety, Randolph ordered his men to fire as
soon as they reached the corner of the palings around the yard,
which caused the Yankees to break and rush into the house in great
confusion, having their commander, Lieut. Slater, badly wounded;
and now, instead of following them, as his orders required, Randolph
retired to Virts’ house, just opposite; but the gallant Gallaher, with
Jack Dove and a few others, tried to execute the order, and while
Gallaher, springing into one window, fired his revolver bullets among
the demoralized “boys in blue,” the others poured their buckshot in
at the other windows.
As soon as the firing commenced White brought his cavalry down
the road at a gallop, and halting long enough to fire a round or two
at the side windows of the meeting-house, discovered quite a
number of Means’ men leaping from the windows and making the
fastest kind of time across the lots below the house, so calling on his
boys to follow the Captain made a dash down into town, but only
succeeded in capturing two of the fugitives. From here some of the
men galloped down to Means’ house in the hope of getting that
gentleman, but he was by that time “over the hills and far away,”
according to his custom when rebel bullets were on the wing.
Returning to the meeting-house, in broad daylight, White found
his infantry laying close siege to it, and standing in the vestibule was
the daring Webster, who had assumed command of the Yankees,
and who, seeing White’s mounted men riding up, supposed them to
be a reinforcement for himself, and began firing upon Randolph’s
men at Virt’s house, calling, as he did so, for his own men to come
out and fight. A few pistol balls near him showed him his mistake,
when he deliberately turned on the cavalry and emptied his revolver
at them, after which he stepped back into the house and
commenced to barricade the doors. White’s whole force now
dismounted and opened a brisk fire at the windows, which was
returned by Webster, Cox, and a few others, whom Webster
succeeded in bringing from under the benches long enough to take a
shot; but pretty soon it was discovered that ammunition was running
short in White’s ranks, and knowing the impossibility of taking the
place by assault now, the Captain prepared to withdraw his people,
but on reaching the horses of the dismounted men he resolved upon
shooting the horses of the Yankees, which had been tied in the yard
during the fight, and presented to the gaze of the now baffled
Confederates a prize well worth fighting for, composed as they were
of the very best horses of Loudoun, a land always noted for fine
ones, and equipped in the most superb style of the U. S. A. Previous
to this, however, an attempt had been made to negotiate a
surrender by sending Mrs. Virts, under a truce, to make the
proposition, but on her second mission the enemy informed her that
if she came again they would shoot her; and now nothing remained
but to get away in safety, which could only be done by depriving the
Yankees of the means of following; and collecting the remaining
cartridges a detail was sent to kill the horses; but while this party
was getting in position around Virts’ house it appears that the enemy
were so badly frightened they were trying to force their commander
to make terms, and a few shots from Ben. Conrad and Ross
Douglass at some Yankees they saw by a window, precipitated
matters and brought Webster out with a flag of truce. He demanded
the usual terms in such cases, viz: his men to be released on parole,
their private property respected, and officers to retain their side
arms; which White immediately granted, and the affair was
concluded as soon as possible, the victors getting fifty-six horses,
saddles and bridles, about one hundred fine revolvers and as many
carbines, with a vast quantity of plunder which they were unable to
carry off; and paroling twenty-eight prisoners, which, with the two
previously captured, made thirty in all.
White lost Brook Hays, killed, and Corporal Peter J. Kabrich,
mortally wounded; both gallant soldiers as ever drew a sabre. A few
others were slightly injured. The enemy lost about seven or eight in
killed and wounded.
The scene at the surrender, when Means’ men, after being formed
in line, laid down their arms, was a curious one. Many of them were
old friends, and had been schoolboys with some of White’s men; and
in one instance, brothers met: one, Wm. Snoots, being a Sergeant in
White’s company, and the other, Charles, a member of Means’
command. Rebel and Yankee had swallowed up the feeling of
brotherhood, or rather, that feeling had intensified the bitterness and
hatred with which enemies in the hour of conflict regard each other;
and the rebel would have certainly shot his Yankee brother, even
after the surrender, but for the interference of one of the officers. As
soon as possible, after getting everything in movable shape, and
arranging for the care of Kabrich, who was too badly hurt to be
moved, and for the burial of Hays, the raiders turned their faces
towards the South again, expecting to rejoin Gen. Jackson that
night. At the point where the line of march diverged from the
Leesburg road, Capt. White left Lieut. Myers in charge of the
column, and taking with him a small detail, galloped into Leesburg,
where he created quite a commotion, causing a few Yankee soldiers
there to depart in the shortest time imaginable, and making the
Southern people of that extremely Southern town almost wild with
joy.
They had been under the galling rule of Yankeedom, as
administered by such as Geary, until simple endurance had almost
culminated in despair, and the advent of White, so unexpectedly,
among them, was hailed as an omen that their day was beginning to
dawn; and consequently, in their freshly blooming hope, they petted
and lionized to their heart’s content the little band of boys in gray
who came to assure them that soon they would be free from the
rule of their hated tyrants.
The two parties united about sunset, at Aldie, where all partook of
an excellent supper at Mr. Henry Ball’s, and where the Captain again
met his wife, but not for long could he remain in this earthly Eden,
for while here the Rev. John Pickett notified the command that he
had found a brigade of Yankee cavalry at the Plains, on the
Manassas Gap Rail Road, and immediately the overloaded little band
prepared for a night march to Manassas, making the third night of
sleepless travel.
But all kept up, and about 9 o’clock on the morning of the 28th
August, Capt. White reported to Gen. Ewell, and when evening came
the boys carried their General from the battle-field to the house of
Mr. Buckner, he having been badly wounded in the leg. And it now
appeared that what they had considered as irksome duty, that of
acting as couriers for Gen. Ewell and his brigadiers, was to the
company the easiest and most pleasant they had ever or would ever
perform; and they felt bitterly the loss of the best friend, of
influence, they had in the army, in the person of Gen. Ewell. After
this the company took but little part in the battle, but lay quietly in
the yard around the house where their General was, until the close
of the battle, when the country was cleared of the enemy to such an
extent that people from the border could get out to the army, and
here many young men came and enrolled themselves in White’s
company.
Citizens, also, who had heard of the capture of Means’ horses at
Waterford, came to look at the stock, and as that command had
been mounted on horses taken from the people of Loudoun, and
Capt. White invariably returned their property, it was not long until
all the captured horses, so far as White’s men were concerned, were
among the things that had been.
Pope’s army, too, as an army, was in the same situation, and the
quarters for “Stonewall Jackson and 16,000 prisoners,” which the
mighty bummer had ordered to be prepared at Washington, were
not occupied—for John had to “skedaddle,” and just in his rear “old
Stonewall” with that identical little party of 16,000 “foot cavalry”
pushed bravely on, and with him went White and all his mounted
men fit for duty, while Myers was sent to Loudoun in charge of
dismounted men, and such as had broken down horses, for the
double purpose of recruiting in both men and horses.

You might also like