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

Introduction To Gis Programming And Fundamentals With Python And Arcgis Hu instant download

The document is an introduction to GIS programming using Python and ArcGIS, authored by Chaowei Yang and collaborators. It covers fundamental concepts of GIS, programming techniques, and practical applications of Python in GIS. The book includes hands-on experiences and detailed explanations of various programming topics related to GIS data visualization and manipulation.

Uploaded by

sepesaeinare
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)
5 views

Introduction To Gis Programming And Fundamentals With Python And Arcgis Hu instant download

The document is an introduction to GIS programming using Python and ArcGIS, authored by Chaowei Yang and collaborators. It covers fundamental concepts of GIS, programming techniques, and practical applications of Python in GIS. The book includes hands-on experiences and detailed explanations of various programming topics related to GIS data visualization and manipulation.

Uploaded by

sepesaeinare
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/ 82

Introduction To Gis Programming And Fundamentals

With Python And Arcgis Hu download

https://ebookbell.com/product/introduction-to-gis-programming-
and-fundamentals-with-python-and-arcgis-hu-9953468

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Introduction To Gis For The Petroleum Industry Dean E Gaddy

https://ebookbell.com/product/introduction-to-gis-for-the-petroleum-
industry-dean-e-gaddy-5309268

A Gentle Introduction To Gis T Sutton O Dassau M Sutton

https://ebookbell.com/product/a-gentle-introduction-to-gis-t-sutton-o-
dassau-m-sutton-1797140

Spatial Thinking In Planning Practice An Introduction To Gis Yiping


Fang

https://ebookbell.com/product/spatial-thinking-in-planning-practice-
an-introduction-to-gis-yiping-fang-10719420

Mapping A Critical Introduction To Cartography And Gis Jeremy W


Cramptonauth

https://ebookbell.com/product/mapping-a-critical-introduction-to-
cartography-and-gis-jeremy-w-cramptonauth-4307662
Introduction To Mathematical Techniques Used In Gis 1st Edition Peter
Dale Author

https://ebookbell.com/product/introduction-to-mathematical-techniques-
used-in-gis-1st-edition-peter-dale-author-12194630

An Introduction To Spatial Data Analysis Remote Sensing And Gis With


Open Source Software 1st Edition Martin Wegmann

https://ebookbell.com/product/an-introduction-to-spatial-data-
analysis-remote-sensing-and-gis-with-open-source-software-1st-edition-
martin-wegmann-51627318

Gis An Introduction To Mapping Technologies 2nd Edition Patrick


Mchaffie

https://ebookbell.com/product/gis-an-introduction-to-mapping-
technologies-2nd-edition-patrick-mchaffie-49462954

Gis An Introduction To Mapping Technologies 1st Edition Patrick


Mchaffie Author Sungsoon Hwang Author Cassie Follett Author

https://ebookbell.com/product/gis-an-introduction-to-mapping-
technologies-1st-edition-patrick-mchaffie-author-sungsoon-hwang-
author-cassie-follett-author-12053382

Gis For Planning And The Built Environment An Introduction To Spatial


Analysis Ed Ferrari Alasdair Rae

https://ebookbell.com/product/gis-for-planning-and-the-built-
environment-an-introduction-to-spatial-analysis-ed-ferrari-alasdair-
rae-42676742
Introduction to

Programming and
Fundamentals with

Chaowei Yang
Introduction to GIS
Programming and
Fundamentals with
Python and ArcGIS®
Introduction to GIS
Programming and
Fundamentals with
Python and ArcGIS®

Chaowei Yang
With the collaboration of
Manzhu Yu
Qunying Huang
Zhenlong Li
Min Sun
Kai Liu
Yongyao Jiang
Jizhe Xia
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742

© 2017 by Taylor & Francis Group, LLC


CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works

Printed on acid-free paper

International Standard Book Number-13: 978-1-4665-1008-1 (Hardback)

This book contains information obtained from authentic and highly regarded sources. Reasonable
efforts have been made to publish reliable data and information, but the author and publisher ­cannot
assume responsibility for the validity of all materials or the consequences of their use. The authors
and publishers have attempted to trace the copyright holders of all material reproduced in this
publication and apologize to copyright holders if permission to publish in this form has not been
obtained. If any copyright material has not been acknowledged please write and let us know so we
may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information
storage or retrieval system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.
copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC),
222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that
provides licenses and registration for a variety of users. For organizations that have been granted a
photocopy license by the CCC, a separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and
are used only for identification and explanation without intent to infringe.

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
For Chaowei Yang's parents, Chaoqing Yang and Mingju Tang,

for continually instilling curiosity and an exploring spirit


Contents

Preface......................................................................................................................xv
Acknowledgments............................................................................................... xxi
Editor................................................................................................................... xxiii
Contributors......................................................................................................... xxv

Section I Overview

1. Introduction......................................................................................................3
1.1 Computer Hardware and Software..................................................... 3
1.2 GIS and Programming..........................................................................5
1.3 Python...................................................................................................... 7
1.4 Class and Object..................................................................................... 9
1.5 GIS Data Models................................................................................... 10
1.6 UML....................................................................................................... 11
1.7 Hands-On Experience with Python.................................................. 14
1.8 Chapter Summary............................................................................... 16
Problems........................................................................................................... 17

2. Object-Oriented Programming.................................................................. 19
2.1 Programming Language and Python............................................... 19
2.2 Class and Object................................................................................... 21
2.2.1 Defining Classes..................................................................... 21
2.2.2 Object Generation................................................................... 23
2.2.3 Attributes................................................................................. 23
2.2.4 Inheritance............................................................................... 25
2.2.5 Composition............................................................................ 26
2.3 Point, Polyline, and Polygon............................................................... 27
2.4 Hands-On Experience with Python.................................................. 30
2.5 Chapter Summary...............................................................................30
Problems........................................................................................................... 31

Section II Python Programming

3. Introduction to Python................................................................................. 35
3.1 Object-Oriented Support..................................................................... 35
3.2 Syntax.................................................................................................... 36
3.2.1 Case Sensitivity....................................................................... 36
3.2.2 Special Characters.................................................................. 36

vii
viii Contents

3.2.3 Indentation............................................................................... 36
3.2.4 Keywords................................................................................. 37
3.2.5 Multiple Assignments............................................................ 38
3.2.6 Namespace............................................................................... 38
3.2.7 Scope......................................................................................... 38
3.3 Data Types............................................................................................. 40
3.3.1 Basic Data Types..................................................................... 40
3.3.2 Composite Data Types...........................................................42
3.4 Miscellaneous....................................................................................... 48
3.4.1 Variables................................................................................... 48
3.4.2 Code Style................................................................................ 49
3.5 Operators............................................................................................... 50
3.6 Statements............................................................................................. 53
3.7 Functions...............................................................................................54
3.8 Hands-On Experience with Python.................................................. 56
3.9 Chapter Summary............................................................................... 56
Problems........................................................................................................... 57

4. Python Language Control Structure, File Input/Output,


and Exception Handling.............................................................................. 61
4.1 Making Decisions................................................................................ 61
4.2 Loops......................................................................................................64
4.3 Other Control Structures.................................................................... 66
4.4 File Input/Output................................................................................. 67
4.5 Exceptions............................................................................................. 69
4.6 Hands-On Experience with Python.................................................. 70
4.6.1 Find the Longest Distance between Any Two Points........ 70
4.6.2 Hands-On Experience: I/O, Create and Read a File.......... 70
4.6.3 Hands-On Experience: I/O, Flow Control, and File.......... 72
4.6.4 Hands-On Experience: Input GIS Point Data
from Text File........................................................................... 74
4.7 Chapter Summary............................................................................... 75
Problems........................................................................................................... 75

5. Programming Thinking and Vector Data Visualization......................77


5.1 Problem: Visualizing GIS Data..........................................................77
5.2 Transforming Coordinate System.....................................................80
5.2.1 How to Determine Ratio Value?........................................... 82
5.3 Visualizing Vector Data......................................................................84
5.4 Point, Polyline, Polygon....................................................................... 86
5.5 Programming Thinking...................................................................... 87
5.5.1 Problem Analysis.................................................................... 88
5.5.2 Think in Programming.......................................................... 88
5.5.3 Match Programming Language Patterns
and Structure.......................................................................89
Contents ix

5.5.4 Implement Program............................................................... 89


5.6 Hands-On Experience with Python.................................................. 90
5.6.1 Reading, Parsing, and Analyzing Text File Data...............90
5.6.2 Create GIS Objects and Check Intersection........................ 92
5.7 Chapter Summary............................................................................... 95
Problems........................................................................................................... 95

6. Shapefile Handling....................................................................................... 97
6.1 Binary Data Manipulation.................................................................. 97
6.2 Shapefile Introduction....................................................................... 101
6.3 Shapefile Structure and Interpretation........................................... 102
6.3.1 Main File Structure of a Shapefile...................................... 102
6.3.1.1 Main File Header................................................... 102
6.3.1.2 Feature Record....................................................... 104
6.3.2 Index File Structure (.shx).................................................... 105
6.3.3 The .dbf File........................................................................... 107
6.4 General Programming Sequence for Handling Shapefiles.......... 107
6.5 Hands-On Experience with Mini-GIS............................................ 108
6.5.1 Visualize Polylines and Polygons....................................... 108
6.5.2 Interpret Polyline Shapefiles............................................... 109
6.6 Chapter Summary............................................................................. 113
Problems......................................................................................................... 113

7. Python Programming Environment........................................................ 115


7.1 General Python IDE........................................................................... 115
7.1.1 Python Programming Windows........................................ 115
7.1.1.1 Command-Line GUI............................................. 115
7.1.1.2 Interactive GUI...................................................... 115
7.1.1.3 File-Based Programming..................................... 116
7.1.2 Python IDE Settings............................................................. 117
7.1.2.1 Highlighting.......................................................... 117
7.1.2.2 General Setting of the Programming
Window................................................................. 118
7.1.2.3 Fonts Setup for the Coding.................................. 118
7.1.3 Debugging............................................................................. 118
7.1.3.1 SyntaxError............................................................ 120
7.1.3.2 Run-Time Exceptions............................................ 121
7.1.3.3 Handling Exceptions............................................ 122
7.1.3.4 Add Exception Handles and Clean-Up
Actions to File Read/Write.................................. 123
7.2 Python Modules................................................................................. 124
7.2.1 Module Introduction............................................................ 125
7.2.2 Set Up Modules..................................................................... 125
7.2.3 System Built-In Modules...................................................... 126
7.3 Package Management and Mini-GIS.............................................. 127
x Contents

7.3.1 Regular GIS Data Organization.......................................... 127


7.3.2 Mini-GIS Package................................................................. 128
7.4 Hands-On Experience with Mini-GIS............................................ 131
7.4.1 Package Management and Mini-GIS................................. 131
7.4.2 Run and Practice the Mini-GIS Package............................ 132
7.5 Chapter Summary............................................................................. 135
Problems......................................................................................................... 135

8. Vector Data Algorithms.............................................................................. 137


8.1 Centroid............................................................................................... 137
8.1.1 Centroid of a Triangle.......................................................... 137
8.1.2 Centroid of a Rectangle........................................................ 137
8.1.3 Centroid of a Polygon........................................................... 138
8.2 Area...................................................................................................... 139
8.2.1 Area of a Simple Polygon..................................................... 139
8.2.2 Area of a Polygon with Hole(s)........................................... 140
8.3 Length.................................................................................................. 141
8.3.1 Length of a Straight Line Segment..................................... 141
8.3.2 Length of a Polyline.............................................................. 142
8.4 Line Intersection................................................................................. 142
8.4.1 Parallel Lines......................................................................... 145
8.4.2 Vertical Lines......................................................................... 145
8.5 Point in Polygon................................................................................. 146
8.5.1 A Special Scenario................................................................ 146
8.6 Hands-On Experience with Python................................................ 148
8.6.1 Using Python to Draw a Polygon and Calculate
the Centroid........................................................................... 148
8.6.2 Using Python to Draw Polygon and Calculate
the Area of Polygon.............................................................. 148
8.6.3 Using Python to Draw Line Segments and
Calculate the Intersection.................................................... 148
8.7 Chapter Summary............................................................................. 150
Problems......................................................................................................... 150

Section III Advanced GIS Algorithms and Their


Programming in ArcGIS
9. ArcGIS Programming................................................................................. 153
9.1 ArcGIS Programming....................................................................... 153
9.2 Introduction to ArcPy Package........................................................ 154
9.2.1 ArcPy Functions, Classes, and Modules........................... 154
9.2.2 Programming with ArcPy in ArcMap............................... 155
9.2.3 Programming with ArcPy in Python Window
outside ArcMap..................................................................... 156
Contents xi

9.2.4 Using Help Documents........................................................ 157


9.3 Automating ArcTools with Python................................................. 158
9.4 Accessing and Editing Data with Cursors..................................... 160
9.4.1 SearchCursor......................................................................... 160
9.4.2 UpdateCursor........................................................................ 164
9.4.3 InsertCursor........................................................................... 164
9.4.4 NumPy................................................................................... 165
9.5 Describing and Listing Objects........................................................ 166
9.5.1 Describe.................................................................................. 166
9.5.2 List........................................................................................... 167
9.6 Manipulating Complex Objects....................................................... 169
9.7 Automating Map Production........................................................... 172
9.8 Creating ArcTools from Scripts........................................................ 172
9.9 Handling Errors and Messages....................................................... 176
9.10 External Document and Video Resources...................................... 177
9.11 Implementing Spatial Relationship Calculations
Using ArcGIS.....................................................................................178
9.12 Summary............................................................................................. 180
9.13 Assignment......................................................................................... 182

10. Raster Data Algorithm............................................................................... 185


10.1 Raster Data.......................................................................................... 185
10.2 Raster Storage and Compression..................................................... 186
10.2.1 Run Length Coding.............................................................. 187
10.2.2 Quad Tree............................................................................... 188
10.3 Raster Data Formats.......................................................................... 189
10.3.1 TIFF......................................................................................... 189
10.3.2 GeoTIFF.................................................................................. 190
10.3.3 IMG......................................................................................... 190
10.3.4 NetCDF................................................................................... 190
10.3.5 BMP......................................................................................... 190
10.3.6 SVG.......................................................................................... 191
10.3.7 JPEG........................................................................................ 191
10.3.8 GIF........................................................................................... 191
10.3.9 PNG......................................................................................... 191
10.4 Color Representation and Raster Rendering................................. 191
10.4.1 Color Representation............................................................ 191
10.4.2 Raster Rendering.................................................................. 194
10.5 Raster Analysis................................................................................... 196
10.6 Hands-On Experience with ArcGIS................................................ 198
10.6.1 Hands-On Practice 10.1: Raster Color Renders................. 198
10.6.2 Hands-On Practice 10.2: Raster Data Analysis:
Find the Area with the Elevation Range between
60 and 100 and the Land Cover Type as “Forest”............ 199
xii Contents

10.6.3 Hands-On Practice 10.3. Access the Attribute


Information of Raster Dataset and Calculate the Area...... 200
10.7 Chapter Summary............................................................................. 205
Problems......................................................................................................... 205

11. Network Data Algorithms......................................................................... 207


11.1 Network Representation................................................................... 207
11.1.1 Basics Network Representation.......................................... 207
11.1.2 Directed and Undirected Networks.................................. 207
11.1.3 The Adjacency Matrix.......................................................... 209
11.1.4 Network Representation in GIS.......................................... 209
11.2 Finding the Shortest Path.................................................................. 210
11.2.1 Problem Statement................................................................ 210
11.2.2 A Brute Force Approach for the Shortest
Path Algorithm...................................................................... 211
11.2.3 Dijkstra Algorithm................................................................ 212
11.3 Types of Network Analysis.............................................................. 214
11.3.1 Routing................................................................................... 214
11.3.2 Closest Facility...................................................................... 214
11.3.3 Service Areas......................................................................... 214
11.3.4 OD Cost Matrix..................................................................... 216
11.3.5 Vehicle Routing Problem..................................................... 216
11.3.6 Location-Allocation.............................................................. 217
11.4 Hands-On Experience with ArcGIS................................................ 218
11.5 Chapter Summary............................................................................. 221
Problems.........................................................................................................222

12. Surface Data Algorithms...........................................................................223


12.1 3D Surface and Data Model.............................................................. 223
12.1.1 Surface Data...........................................................................223
12.1.2 Surface Data Model..............................................................223
12.1.2.1 Discrete Data..........................................................223
12.1.2.2 Continuous Data....................................................225
12.2 Create Surface Model Data............................................................... 228
12.2.1 Create Grid Surface Model.................................................. 228
12.2.2 Creating TIN Surface Model............................................... 229
12.2.3 Conversion between TIN and Raster Surface
Models.................................................................................... 229
12.3 Surface Data Analysis........................................................................ 230
12.3.1 Elevation................................................................................. 230
12.3.2 Slope........................................................................................ 231
12.3.3 Aspect..................................................................................... 232
12.3.4 Hydrologic Analysis.............................................................234
12.4 Hands-On Experience with ArcGIS................................................ 236
Contents xiii

12.4.1 Hands-On Practice 12.1: Conversion among DEM,


TIN, and Contours................................................................ 236
12.4.2 Hands-On Practice 12.2: Generate Slope and Aspect...... 239
12.4.3 Hands-On Practice 12.3: Flow Direction........................... 239
12.5 Chapter Summary............................................................................. 242
Problems......................................................................................................... 242

Section IV Advanced Topics

13. Performance-Improving Techniques....................................................... 247


13.1 Problems.............................................................................................. 247
13.2 Disk Access and Memory Management......................................... 248
13.2.1 File Management................................................................... 249
13.2.2 Comprehensive Consideration............................................ 249
13.3 Parallel Processing and Multithreading......................................... 251
13.3.1 Sequential and Concurrent Execution............................... 251
13.3.2 Multithreading...................................................................... 251
13.3.3 Load Multiple Shapefiles Concurrently
Using Multithreading........................................................... 252
13.3.4 Parallel Processing and Cluster, Grid,
and Cloud Computing......................................................... 253
13.4 Relationship Calculation and Spatial Index...................................254
13.4.1 Bounding Box in GIS............................................................ 255
13.4.2 Spatial Index.......................................................................... 256
13.5 Hands-On Experience with Mini-GIS............................................ 257
13.5.1 Data Loading with RAM as File Buffer............................. 257
13.5.2 Data Loading with Multithreading.................................... 258
13.5.3 Bounding Box Checking to Speed Up Intersection......... 258
13.5.4 Line Intersection Using R-Tree Index................................. 261
13.6 Chapter Summary............................................................................. 262
Problems......................................................................................................... 263

14. Advanced Topics.......................................................................................... 265


14.1 Spatial Data Structure....................................................................... 265
14.1.1 Raster Data Structure in NetCDF/HDF............................ 265
14.1.2 Application of NetCDF/HDF on Climate Study.............. 266
14.2 GIS Algorithms and Modeling......................................................... 270
14.2.1 Data......................................................................................... 270
14.2.2 Density Analysis................................................................... 271
14.2.3 Regression Analysis (OLS and GWR)................................ 272
14.3 Distributed GIS................................................................................... 275
14.3.1 System Architecture............................................................. 276
14.3.2 User Interface......................................................................... 277
xiv Contents

14.4 Spatiotemporal Thinking and Computing..................................... 280


14.4.1 Problem: Dust Simulation and Computing
Challenges.......................................................................... 280
14.4.2 Methodology 1: Utilizing High-Performance
Computing to Support Dust Simulation........................... 281
14.4.3 Methodology 2: Utilizing Spatiotemporal Thinking
to Optimize High-Performance Computing..................... 281
14.4.3.1 Dust Storms’ Clustered Characteristics:
Scheduling Methods............................................. 282
14.4.3.2 Dust Storms’ Space–Time Continuity:
Decomposition Method........................................ 283
14.4.3.3 Dust Storm Events Are Isolated:
Nested Model.........................................................284
14.4.4 Methodology 3: Utilizing Cloud Computing
to Support Dust Storm Forecasting....................................284
14.5 Chapter Summary............................................................................. 285
Problems......................................................................................................... 286

References............................................................................................................ 287
Index...................................................................................................................... 291
Preface

Why Another GIS Programming Text?


Geographical information system (GIS) has become a popular tool under-
pinning many aspects of our daily life from routing for transportation to
finding a restaurant to responding to emergencies. Convenient GIS tools
are developed with different levels of programming from scripting, using
python for ArcGIS, to crafting new suites of tools from scratch. How much
programming is needed for projects largely depends on the GIS software,
types of applications, and knowledge structure and background of the
application designer and developer. For example, simple scripting i­ ntegrates
online ­ mapping applications using Google maps. Customized spatial
­analyses applications are routinely using ArcGIS with minimum program-
ming. Many develop an application leveraging open-source software for
managing big data, modeling complex phenomena, or responding to con-
current users for popular online systems. The best design and development
of such ­applications require designers and developers to have a thorough
understanding of GIS principles as well as the skill to choose between com-
mercial and open-source software options. For most GIS professionals, this
is a ­challenge because most are either GIS tool end users or information
­technology (IT) professionals with a limited understanding of GIS.
To fill this gap, over the last decade, Chaowei Yang launched an introduc-
tory GIS programming course that was well received. Enrollment continues
to rise and students report positive feedback once they are in the workplace
and use knowledge developed from the class. To benefit a broader spectrum
of students and professionals looking for training materials to build GIS
programming capabilities, this book is written to integrate and refine the
authors’ knowledge accumulated through courses and associated research
projects.
The audience for this book is both IT professionals to learn the GIS
­principles and GIS users to develop programming skills. On the one hand,
this book provides a bridge for GIS students and professionals to learn and
practice programming. On the other hand, it also helps IT professionals with
programming experience to acquire the fundamentals of GIS to better hone
their programming skills for GIS development.
Rather than try to compete with the current GIS programming literature,
the authors endeavor to interpret GIS from a different angle by integrating
GIS algorithms and programming. As a result, this book provides a practical
knowledge that includes fundamental GIS principles, basic programming
skills, open-source GIS development, ArcGIS development, and advanced

xv
xvi Preface

topics. Structured for developing GIS functions, applications, and systems,


this book is expected to help GIS/IT students and professionals to become
more competitive in the job market of GIS and IT industry with needed
­programming skills.

What Is Included in the Text?


This book has four sections. Section I (Chapters 1 and 2) is an overview of GIS
programming and introduces computer and programming from a ­practical
perspective. Python (integral programming language for ArcGIS) program-
ming is extensively presented in Section II (Chapters 3 through 8) in the
context of designing and developing a Mini-GIS using hands-on e­ xperience
following explanations of fundamental concepts of GIS. Section III (Chapters
9 through 12) focuses on advanced GIS algorithms and ­information on how to
invoke them for programming in ArcGIS. Advanced topics and ­performance
optimization are introduced in Section IV (Chapters 13 and 14) using the
Mini-GIS developed.
Chapter 1 introduces computer, computer programming, and GIS.
In ­addition, the Unified Markup Language (UML) is discussed for capturing
GIS models implemented through simple Python programming. Chapter 2
introduces object-oriented programming and characteristics with examples
of basic GIS vector data types of Point, Polyline, and Polygon.
Chapter 3 introduces Python syntax, operators, statements, miscella-
neous features of functions, and Python support for object-oriented pro-
gramming. Using GIS examples, Chapter 4 introduces Python language
control ­structures, file input/output, and exception handling. Chapter 5
presents programming thinking using the visualization of vector data
as an example of the workflow of this critical process in programming.
Chapter 6 introduces the Python integrated programming environment
(IDE), modules, package management, and the Mini-GIS package. Chapter
7 discusses shapefile formats and steps on how to handle shapefiles
within the Mini-GIS. Chapter 8 introduces vector data processing algo-
rithms and includes line intersection, centroid, area, length, and point in
polygon. This presentation includes how Mini-GIS/ArcGIS supports these
algorithms.
Chapter 9 bridges Sections II and III by introducing ArcGIS program-
ming in Python using ArcPy, ArcGIS programming environment, automat-
ing tools, accessing data, describing objects, and fixing errors. Chapter 10
introduces raster data algorithms, including raster data format, storage, and
compression with hands-on experience using ArcGIS. Chapter 11 addresses
network data algorithms for representing networks and calculating the
shortest path in principles and using ArcGIS. Chapter 12 explores surface or
Preface xvii

3D data representation of 3D data, converting data formats and 3D ­analyses


for elevation, slope, aspect, and flow direction with examples in ArcGIS
programming.
Chapter 13 introduces performance-improving techniques and includes
storage access and management, parallel processing and multithreading,
spatial index, and other techniques for accelerating GIS as demonstrated in
Mini-GIS. Advanced topics, including GIS algorithms and modeling, spatial
data structure, distributed GIS, spatiotemporal thinking, and computing, are
presented in Chapter 14.

Hands-On Experience
As a practical text for developing programming skills, this book makes
every effort to ensure the content is as functional as ­possible. For every
introduced GIS fundamental principle, algorithm and element, an example
is explored as a hands-on experience using Mini-GIS and/or ArcGIS with
Python. This learning workflow helps build a thorough understanding of
the fundamentals and naturally maps to the fundamentals and program-
ming skills.
For system and open-source development, a step-by-step development of
a python-based Mini-GIS is presented. For application development, ArcGIS
is adopted for illustration.
The Mini-GIS is an open-source software developed for this text and can be
adopted for building other GIS applications. ArcGIS, a commercial p ­ roduct
from ESRI, is used to experience state-of-the-art commercial s­oftware.
For learning purpose, ArcGIS is available for free from ESRI.

Online Materials
This book comes with the following online materials:

• Instructional slides for instructors using this text for classroom


­education and professionals to assist in learning GIS programming.
• Python codes for class exercises and hands-on experiences and
structured and labeled by chapter to code the chapter’s sequence.
• Mini-GIS as an open-source package for learning the GIS
­fundamentals and for exemplifying GIS principles and algorithms.
• Answers to problems for instructors to check their solutions.
xviii Preface

The Audience for and How to Use This Text


This text serves two functions: a text for systematic building GIS program-
ming skills and a reference for i­dentifying a python solution for specific
GIS algorithms or function from scratch and/or ArcGIS. The text is intended
to assist four categories of readers:

• Professors teaching GIS programming or GIS students learning with


a specific focus on hands-on experience in classroom settings.
• Programmers wanting to learn GIS programming by scanning
through Section I and Chapters 3 and 4, followed by a step-by-step
study of the remaining chapters.
• GIS system designers most interested in algorithm descriptions,
algorithms implementation from both scratch and ArcGIS to
­
­assemble a practical knowledge about GIS programing to aid in GIS
choice for future development.
• IT professionals with a curiosity of GIS for GIS principles but
­skipping the programming exercises.

The intent of the authors for such a broad audience is based on the desire to
cultivate a competitive professional workforce in GIS development, enhance
the literature of GIS, and serve as a practical introduction to GIS research.

How Did We Develop This Text?


The text material was first developed by Professor Chaowei Yang in 2004
and offered annually in a classroom setting during the past decade. During
that time span, many students developed and advanced their programming
skills. Some became professors and l­ecturers in colleges and were invited
to write specific book chapters. Keeping the audience in mind, several
­professors who teach GIS programming in different cultural backgrounds
and university settings were invited to review the book chapters.
The following is the book development workflow:

• Using his course materials, Professor Yang structured this book


with Irma Shagla’s help, and the text’s structure was contracted to be
­published as a book. Assistant Professor Qunying Huang, University
of Wisconsin, Madison, explored using the earlier versions of the
text’s materials. Assistant Professors Huang and Zhenlong Li,
University of South Carolina, developed Section II of the text in
­collaboration with Professor Yang.
Preface xix

• Dr. Min Sun, Ms. Manzhu Yu, Mr. Yongyao Jiang, and Mr. Jizhe Xia
developed Section III in collaboration with Professor Yang.
• Professor Yang edited and revised all chapters to assure a common
structure and composition.
• Ms. Manzhu Yu and Professor Yang edited the course slides.
• Assistant Professor Li, Mr. Kai Liu, Mrs. Joseph George, and
Ms. Zifu Wang edited Mini-GIS as the software for the text.
• After the above text and course materials were completed, four
­professors and two developers were invited to review the text’s
content.
• The assembled materials for the text were finally reviewed by
several professionals, including Ms. Alena Deveau, Mr. Rob
­
Culbertson, and Professor George Taylor.
• The text was formatted by Ms. Minni Song.
• Ms. Manzhu Yu and Professor Yang completed a final review of the
chapters, slides, codes, data, and all relevant materials.
Acknowledgments

This text is a long-term project evolving from the course “Introduction to GIS
Programming” developed and refined over the past decade at George Mason
University. Many students and professors provided constructive s­ uggestions
about what to include, how best to communicate and challenge the students,
and who should be considered as audience of the text.
The outcome reflects Professor Yang’s programming career since his
undergraduate theses at China’s Northeastern University under the
­
­mentoring of Professor Jinxing Wang. Professor Yang was further mentored
in programming in the GIS domain by Professors Qi Li and Jicheng Chen.
His academic mentors in the United States, Professors David Wong and
Menas Kafatos, provided support over many decades, giving him the chance
to teach the course that eventually led to this text.
Professor Yang thanks the brilliant and enthusiastic students in his
classes at George Mason University. Their questions and critiques honed
his ­ teaching skills, improved the content, and prompted this effort of
­developing a text.
Professor Yang thanks his beloved wife, Yan Xiang, and children—Andrew,
Christopher, and Hannah—for accommodating him when stealing valuable
family time to complete the text.
Ms. Manzhu Yu extends her gratitude to the many colleagues who
­provided support, and read, wrote, commented, and assisted in the editing,
­proofreading, and formatting of the text.
Assistant Professor Huang thanks her wonderful husband, Yunfeng Jiang,
and lovely daughter, Alica Jiang.
Dr. Min Sun thanks her PhD supervisor, Professor David Wong, for
­educating her. She also thanks David Wynne, her supervisor in ESRI where
she worked as an intern, and her other coworkers who collectively helped
her gain a more complete understanding of programming with ESRI
­products. Last but not least, she thanks her parents and lovely dog who
accompanied her when she was writing the text.
Yongyao Jiang thank his wife Rui Dong, his daughter Laura, and his par-
ents Lixia Yao and Yanqing Jiang.

xxi
Editor

Chaowei Yang is a professor of geographic information science at George


Mason University (GMU). His research interest is on utilizing spatiotem-
poral principles to optimize computing infrastructure to support science
­discoveries. He founded the Center for Intelligent Spatial Computing and the
NSF Spatiotemporal Innovation Center. He served as PI or Co-I for p ­ rojects
totaling more than $40 M and funded by more than 15 agencies, organiza-
tions, and companies. He has published 150+ articles and developed a num-
ber of GIS courses and training programs. He has advised 20+ postdoctoral
and PhD students who serve as professors and scientists in highly acclaimed
U.S. and Chinese institutions. He received many national and international
awards, such as the U.S. Presidential Environment Protection Stewardship
Award in 2009. All his achievements are based on his practical knowledge
of GIS and geospatial information systems. This book is a collection of such
practical knowledge on how to develop GIS tools from a programming
­perspective. The content was offered in his programming and GIS algorithm
classes ­during the past 10+ years (2004–2016) and has been adopted by his
students and colleagues serving as professors at many universities in the
United States and internationally.

xxiii
Contributors

Fei Hu is a PhD candidate at the NSF Spatiotemporal Innovation Center,


George Mason University. He is interested in utilizing high-performance
cloud computing technologies to manage and mine big spatiotemporal
data. More specifically, he has optimized the distributed storage system
(e.g., HDFS) and parallel computing framework (e.g., Spark, MapReduce) to
­efficiently manage, query, and analyze big multiple-dimensional array-based
datasets (e.g., climate data and remote sensing data). He aims to ­provide
­scientists with on-demand data analytical capabilities to relieve them from
time-consuming computational tasks.

Qunying Huang is an assistant professor in the Department of Geography


at the University of Wisconsin, Madison. Her fields of expertise include geo-
graphic information science (GIScience), cyber infrastructure, s­ patiotemporal
big data mining, and large-scale environmental modeling and simulation.
She is very interested in applying different computing models, such as clus-
ter, grid, GPU, citizen computing, and especially cloud computing, to address
contemporary big data and computing challenges in the GIScience. Most
recently, she is leveraging and mining social media data for various applica-
tions, such as emergency response, disaster mitigation, and human mobility.
She has published more than 50 scientific articles and edited two books.

Yongyao Jiang is a PhD candidate in Earth systems and geoinforma-


tion sciences at the NSF Spatiotemporal Innovation Center, George Mason
University. He earned an MS (2014) in GIScience at Clark University and a BE
(2012) in remote sensing at Wuhan University. His research focuses on data
discovery, data mining, semantics, and cloud computing. Jiang has received
the NSF EarthCube Visiting Graduate Student Early-Career Scientist Award
(2016), the Microsoft Azure for Research Award (2015), and first prize in the
Robert Raskin CyberGIS Student Competition (2015). He serves as the tech-
nical lead for MUDROD, a semantic discovery and search engine project
funded by NASA’s AIST Program.

Zhenlong Li is an assistant professor in the Department of Geography


at the University of South Carolina. Dr. Li’s research focuses on spatial
high-­ performance computing, big data processing/mining, and geospa-
tial ­cyberinfrastructure in the area of data and computational intensive
GISciences. Dr. Li’s research aims to optimize spatial computing infra-
structure by integrating cutting-edge computing technologies and ­spatial
principles to support domain applications such as climate change and
­
­hazard management.

xxv
xxvi Contributors

Kai Liu is a graduate student in the Department of Geography and


GeoInformation Sciences (GGS) in the College of Science at George Mason
University. Previously, he was a visiting scholar at the Center of Intelligent
Spatial Computing for Water/Energy Science (CISC) and worked for 4 years
at Heilongjiang Bureau of Surveying and mapping in China. He earned a BA
in geographic information science at Wuhan University, China. His research
focuses on geospatial semantics, geospatial metadata management, spatio-
temporal cloud computing, and citizen science.

Min Sun is a research assistant professor in the Department of Geography


and Geoinformation Science at George Mason University. Her research
interests include measuring attribute uncertainty in spatial data, developing
visual analytics to support data exploration, WebGIS, and cloud computing.
She is an expert in ArcGIS programming and also serves as the assistant
director for the U.S. NSF Spatiotemporal Innovation Center.

Jizhe Xia is a research assistant professor at George Mason University.


He earned a PhD in Earth systems and geoinformation sciences at the
George Mason University in the spring of 2015. Dr. Xia’s research ­interests
are s­patiotemporal computing, cloud computing, and their applications
in g­eographical sciences. He proposed a variety of methods to utilize
­spatiotemporal patterns to optimize big data access, service quality (QoS)
evaluation, and cloud computing application.

Manzhu Yu is a PhD candidate in the Department of Geography and


Geoinformation Science, George Mason University. Her research interests
include spatiotemporal methodology, pattern detection, and spatiotemporal
applications on natural disasters. She received a Presidential Scholarship
from 2012 to 2015. She has published approximately 10 articles in renowned
journals, such as PLoS ONE and IJGIS, and contributed as a major author in
several book chapters.
Section I

Overview
1
Introduction

This chapter introduces the basic concepts of computer, hardware, software,


and programming, and sets up the context for GIS programming.

1.1 Computer Hardware and Software


A computer is a device that has the capability to conduct different types of
automated tasks based on specific instructions predefined by or through
interactions with end users. For example, clicking on the ArcGIS icon will
execute ArcGIS software. We can select a destination and starting point to
trigger a routing analysis to identify a driving route using Google Maps.
Computers are some of the fastest-evolving technologies as reflected by the
processing capability of small calculators to supercomputers. The size of the
devices has reduced from computers occupying a building to mobile devices
in pockets (Figure 1.1). The user interactions range from typing punched
cards (early computers) to human–computer interaction, such as speaking to
invoke an action or task.
There are two important components of a computer (Hwang and Faye
1984): (1) the physical device that can conduct automated processing, and
(2) instruction packages that can be configured to provide specific functional-
ity, such as word processing or geographic information processing. The first
component of a computer, the hardware, is touchable as physical machines. The
second component, the software, may be purchased with the hardware in the
form of an operating system, or installed by downloading online. Computer
hardware can be configured or programmed to perform different tasks; thus,
a computer may also be called a general-purpose device. The software var-
ies greatly, whether it is providing document-processing capability, financial
management, tax return processing, or scientific simulations such as climate
change or the spread of disease. Depending on the type of software, it is
either procured publicly (freeware) or proprietary (requiring purchase and
licensing). Depending on the usage, software can be categorized as system
software, application software, or embedded software (Figure 1.2). System
software refers to the basic software that must be installed for a computer
to operate. Windows and Linux are examples of operating system (OS) soft-
ware, an essential component of a computer. Application software supports

3
4 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

(a) (b)

FIGURE 1.1
(a) NASA supercomputer. (From NASA supercomputer at http://www.nas.nasa.gov/hecc/
resources/pleiades.html.) (b) Other computers: personal computer (PC), laptop, pad. (From differ-
ent computers at http://www.computerdoc.com.au/what-are-the-different-types-of-computers.)

specific groups of tasks, such as Microsoft Word for document processing


and Microsoft Outlook for emails. Embedded software is a type of firmware
that is burned onto hardware and becomes part of that hardware. Embedded
software exists longer on a computer than any other software. The firmware
will always come with the hardware when you purchase a computer, so the
firmware will not have to be changed as frequently, especially when updat-
ing a web browser or Turbo Tax Return routinely.
Geographic information system (GIS) is one type of application software
that deals primarily with geographic information (Longley et al. 2001). The
global positioning system (GPS, Misra and Enge 2006) is used for locating
geographic places, and can be installed in both cars and smart phones for
routing. GIS software includes two categories: professional GIS and light-
weight GIS. Professional GIS software, such as ArcGIS, provides the most

Application software
Word, Web browser, ArcGIS

System software
Windows, Linux,...

Embedded software

Hardware

FIGURE 1.2
Different types of software.
Introduction 5

complete set of GIS functionalities for professionals in the GIS domain. Less
intense, but popular, GIS software used to view the geographic environment
are the online mapping application, such as Google Maps and Google Earth.

1.2 GIS and Programming


GIS originates from several domains and refers to the system designed to
capture, observe, collect, store, and manage geographic data, and to pro-
vide tools for spatial analyses and visualization (Longley et al. 2001). GIS
can help obtain geographic data to be used for decision making, such as
choosing routes for emergency response. GIS is known to have started from
the Canadian natural resource inventory computer program led by Roger
Tomlinson in the 1960s. GIS is becoming increasingly popular on mobile
devices as a means of analyzing information and patterns related to traffic
and weather.
Coined by Mike Goodchild, the term “GIS” can also refer to the field of
geographic information science or GIScience—the study of the scientifically
applied GIS principles and technologies (Goodchild 1992). According to
GIS scientists, GIScience involves remote sensing, global navigation satellite
systems, and GIS. Additionally, in various domains, GeoInformatics may be
applied to remote sensing, global navigation satellite system, and GIS infor-
mation. These topics, however, will not be explored in this book.
GIS is the system comprising hardware (computer, mobile devices, GPS),
software (ArcGIS or online mapping), and data (geographic information)
that can be utilized to accomplish a set of functionalities for a group of users.
All three components must be utilized for GIS to work effectively. A sig-
nificant difference between GIS and other software applications is its ability
to manage and manipulate the large volume and complexity of geographic
data, which comprises embedded spatiotemporal and attribute information.
The complex character of GIS data demands a specific suite of software to
extract information for decision making. Mature software packages are pub-
licly available, including the most up-to-date set of ArcGIS software and the
latest edition of Google Maps web mapping software.
The process of developing software is called programming. Programming
instructs the computer to accomplish a task based on the orders. There are
many different types of programming levels (Mitchell 1996). The lowest
level to program are based on the specific hardware instructions supported
by the central processing units (CPU), and used by smart-instrument devel-
opers. Because CPU instructions are processed as a sequence of 0s and 1s,
assembling language is developed to assist developers to remember those
instructions. Both languages are considered low level and are specific to the
hardware. Advanced languages have been developed to facilitate human
6 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

understanding, but are still restricted by the hardware instructions. For


example, C programming language is commonly used to develop software
(Kernighan and Ritchie 2006). To make the programming organization more
similar to how we view the world, C++ was proposed to support object-
oriented programming based on C (Stroustrup 1995). Since then, many dif-
ferent programming languages have been developed and are used in GIS
programming. For instance, Java is a language for cross-platform appli-
cation development proposed by Sun Microsystems (Arnold et al. 2000).
JavaScript is used to conduct scripting (simpler) programming for manip-
ulating objects within a web browser. In addition to Java and JavaScript,
ArcGIS has recently added Python to its list of programming languages
(Van Rossum 2007).
Why do we need GIS programming? Mature GIS software and applica-
tion templates provide many tools to accomplish our daily tasks; however, in
order to understand the fundamentals of how GIS works and to customize
software for specific problems, programming is required. The following list
gives programming examples:

• Customizing software for application: The National Park Service is


developing a simple web mapping application to allow the general
public to interactively select and view information for a particular
National Park. Using an online mapping tool such as Google Maps
and selecting a park with your mouse will trigger a query of the
selected information for that park. In this scenario, we need geo-
graphic information about the parks, a program for front-end user
interaction, and a database query language that will generate result
for the selected park.
• Automating a process: Suppose there are 100 geographic datasets col-
lected in text file format and we need to convert them into a shape-
file, a native data file format used by ArcView and ArcGIS, for
further processing. ArcGIS can perform the conversion one by one,
but doing this manually 100 times is monotonous. Therefore, a sim-
ple scripting tool to automatically read and process the 100 datasets
into shapefiles would be beneficial. Using Python scripts in ArcGIS
provides the capability to do so.
• Satisfying simple GIS needs: Suppose there is a transportation com-
pany that needs to track their company vehicles’ positions based
on 5-minute intervals. However, the company cannot afford to pur-
chase a professional GIS software license. To resolve the issue, the
company can use Python to create a map to show the company’s
service region and vehicle locations every 5 minutes. This program-
ming may include Zoom In/Out, and Move/Pan features, anima-
tions based on locations, and a selection of one or many vehicles.
Introduction 7

• Cultivating advanced GIS professionals: Suppose a group of students


are asked to invent a routing algorithm based on predicted traf-
fic conditions and real-time traffic information. The students will
need to organize the road network information comparing real-time
and predicted network speed. It is essential to use the most accu-
rate predicted information in the routing process. Programming is
needed throughout the entire process for network management and
routing, and for reconstructing the results into map form or written
directions.

Geographic information has become increasingly important in all walks


of human life, whether it is for scientific discovery, forecasting natural disas-
ters, advancing technologies of observations, or creating public awareness
about location and routing. While some applications require complete GIS
technologies to produce valuable results, many geographic information
applications do not require sophisticated geographic information systems.
For the latter case, open-source or small geospatial information software
is utilized, while commercial GIS systems such as ArcGIS, are available for
the former case. To better address both needs, it is essential to understand
the fundamentals of how GIS works and its basic geographic information
processing. This chapter introduces the background structure for building
such capabilities: computer hardware and software, GIS and programming,
GIS data models and Unified Markup Language (UML, Fowler 2004), and
Python. Hands-on programming experience is needed for understanding
the concepts and developing the essential skills utilized by GIS professionals
in their work and research. Based on GIS fundamentals, this book will help
you develop and improve systematic programming skills and will provide a
more in-depth understanding of GIS fundamentals. Owing to its popularity
within the GIS community, Python will be the primary programming lan-
guage used in this book.

1.3 Python
Python was originally developed by a Dutch programmer, Guido van
Rossum, in 1990. Van Rossum was reportedly a fan of the British comedy
series, Monty Python’s Flying Circus, and upon developing the open-source
programming language, he borrowed to the name “Python” for the language
and his nonprofit institution, the Python Software Foundation.
Similar to programming languages C++ and Java, Python is an object-­
oriented and interactive language. Python is dynamic in that it uses an auto-
matic memory management mechanism to allocate and release memory for
8 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

data (variables). Python and ArcGIS regularly release new versions of their
programs; this book is based on Python release 2.7 and ArcGIS 10.1.
There are many reasons for choosing Python, including the following:*

• It is excellent for programming beginners, yet superb for experts.


• The syntax of Python is very simple and easy to learn. When you
become familiar with them, you will feel that it is really very handy.
• It is highly scalable and well suited for both large and small projects.
• It is in a rapid development phase. Almost every half year, there is a
new major release.
• It is portable cross-platform. This means that a program written in
Windows can be run using the Linux or Mac operating systems.
• It is easily extensible. You can always add more class functions to
your current project.
• It has powerful standard libraries.
• Many third parties also provide highly functional packages for you
to utilize. Instead of developing GIS functions from scratch, you
can simply download the source code and integrate them into your
project.
• It is a fully object-oriented language, simple yet elegant, and stable
and mature.

There are several steps to learning Python for GIS programming:

• Get familiar with the concept of class and object (Chapters 1 and 2).
• Learn the syntax of Python, including variables, data types, struc-
tures, controls, statements, and other programming structures
(Chapters 1 through 4).
• Build Python programs from scratch and integrate open-source
libraries to facilitate programming (Chapter 5).
• Become comfortable with the Python programming environment
(Python interpreter or Python Text editor, Chapter 6).
• Solve GIS problems by writing code for GIS algorithms (Chapters 7
through 13).

These components are introduced in the above order throughout this


book. This chapter introduces important concepts such as object-oriented
programming, UML, and GIS models.

* http://pythoncard.sourceforge.net/what_is_python.html.
Introduction 9

1.4 Class and Object


Within this section, we will discuss two types of fundamental concepts: class
and object (Rumbaugh et al. 1991). Class uses a set of attributes and behav-
iors to represent a category of real-world phenomena. For example, Figure 1.3
shows how to extract the student attributes and behaviors.
Another example is online shopping on Amazon or eBay. Both the custom-
ers and online products must be abstracted into classes:

• Customers would have a customer ID, shipping address, and bill-


ing address. Customer behavior would include adding or deleting a
product to the shopping cart.
• Products would have a product ID, product name, and product
price. Product behavior would include setting the price, and totaling
the product quantity/amount.

An object is a specific instance of a class. We can consider objects as


instances of classes by assigning values to their attributes. Specifically, a
class is the abstraction of a category or collection of real-world entities while
an object is a specific real-world entity within the class. Within a computer, a
class is the template and an object is the specific entity that occupies the com-
puter memory. The computer can operate on both the attributes and behav-
iors of an object. For example, when a student logs in to their college web
system with a username and password, the system will create a new stu-
dent object. The computer reads each student as an independent object with
several different attributes (e.g., username, password, and student ID). After
logging in, a student is able to search, register, or add/drop classes using the
object in the system, which represents him or her specifically. Chapter 2 will
introduce how to define classes and objects using Python.

FIGURE 1.3
An example of representing students with the Student class.
10 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

1.5 GIS Data Models


GIS data models are used to capture essential geospatial elements of a spe-
cific problem (Longley et al. 2001). There are three types of data models: vec-
tor data, raster data, and special data. Vector data models consist of point,
polyline, and polygon model types. Raster data includes equally split cells of
digital elevation models and images. Special data are composed of network
and linear data. This book highlights different types of GIS data models, but
will focus mainly on vector data models.
A point can refer to a class of vector data represented by a pair of x, y coor-
dinates in a two-dimensional (2D) space or a tuple of x, y, and z coordinates in
a three-dimensional (3D) space. For example, a city is represented as a point
on a world map. Each city has a group of attributes, which would include the
city name, population, average household income, and acro-names. Another
example using points is a map depicting all the restaurants within a certain
region. In addition to its point location, each restaurant will contain other
relevant information, including its name, room capacity, cuisine, and the
year it opened. In these cases, the point is a general classification, whereas
the city or the restaurant is a more specific type of class containing different
attributes. When designing, each point of the rectangle can represent a class
(Figure 1.4). This diagram is also referred to as a UML class diagram. The
first row refers to the name of the class: City; the second row refers to the
attributes of the class: name and averageIncome; the third row refers to a set of
methods: getName, getAverageIncome, and setName.
Polylines are a class of vector data represented by a list of points. For
instance, a river can be represented as a polyline on a map, which then can
be categorized as a type of polyline class. A polyline class may include point
coordinates, relevant attributes, and a set of methods. Another polyline data-
set example can be roads, highways, and interstates. Both examples are cat-
egories of polylines. Rivers can be represented using UML (Figure 1.5). The
first row of the UML is the subject of the class: River; the second row includes
the river’s attributes: name and coordinates; and the third row refers to the
methods the programmer will use: getName, setCoordinates, and setName.

FIGURE 1.4
A UML diagram for the City class.
Introduction 11

FIGURE 1.5
The River class includes three parts.

FIGURE 1.6
The County class includes three parts.

Polygons are another class of vector data that are also represented by a list
of points; however, with polygons, the first and last points are the same. For
example, on the map of the state of Virginia, a specific county, like Fairfax
County, can be represented as a polygon. The county is a type of polygon
class, which includes a list of points, relevant attributes, and a set of meth-
ods. Countries on a world map may also be represented as polygons. In
either case, both the county and country are types of polygons. As shown
in Figure 1.6, the first row is the subject name: County; the second row is the
subject’s attributes: name and population; and the third row refers to the meth-
ods: getName, setPopulation, and setName.
Developing more methods will require adding more methods and attri-
butes to each class to capture the evolution of the data models and the
functionality of software; UML diagrams are used to standardize their rep-
resentation. This section uses class diagrams and relevant UML standards
for the point, polyline, and polygon classes.

1.6 UML
In 1997, the Object Management Group (OMG)* created the UML to record
the software design for programming. Software designers and programmers

* See OMG at http://www.omg.org/.


12 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

use UML to communicate and share the design. Similar to the English lan-
guage in which we communicate through sharing our ideas via talking or
writing, UML is used for modeling an application or problem in an object-
oriented fashion. UML modeling can be used to facilitate the entire design
and development of software.
The UML diagram is used to capture the programming logic. There are
two types of diagrams that we will specifically discuss: class diagrams and
object diagrams (Figure 1.7).
The UML class diagram can represent a class using three parts: name,
attributes, and methods. The attributes and methods have three different
accessibilities: public (+), private (-), and protected (#). Attributes and meth-
ods are normally represented in the following format:

• Attributes: accessibility attribute Name: Attribute data type, for


example, +name: String
• Methods: accessibility method Name (method arguments): method
return type, for example, +setName(name:String): void

Public refers to the method/attributes that can be accessed by other


classes. Private methods/attributes cannot be accessed by any other
classes.
Protected methods/attributes cannot be accessed by other classes except
those classes inherited from this class (explained below).
There are several fundamental relationships among different classes:
dependency, inheritance, composition, and aggregation. Dependency repre-
sents one class dependent on another. Inheritance is an important relation-
ship in which a class is a subtype of another class. Figure 1.8 illustrates the
dependency between geometry and coordinate systems in that the existence
of geometry depends on a coordinate system. This relationship is repre-
sented by a dashed line and an arrow from the geometry to the coordinate
system class. The relationship between a point, line, and polygon are classi-
fied within the geometry class.
Aggregation and composition are two other important relationships in
UML. Aggregation represents “has a” relationship in UML. For example,
a state is an aggregation of a number of counties (Figure 1.9a). Composition
represents, or “owns” relationship. For example, a multipoint class may be
composed of two or more points (Figure 1.9b).
The relationship can be quantified by the number of elements involved.
For example, a line includes 2+ points and a state includes 0+ counties. There
are six different types of this multiplicity relationship (Figure 1.10). A mul-
tipoint is composed of two or more points (Figure 1.9b) and a state is aggre-
gated by zero or more counties.
An object is an instantiation of a class. The object diagram shows a complete
or partial view of the model system structure at a specific time. So, the state
Introduction

Diagram

Structure Behavior
diagram diagram

Class Component Object Activity Use case


diagram diagram diagram diagram diagram

Composite State
Profile Deployment Package Interaction
structure machine
diagram diagram diagram diagram
diagram diagram

Interaction
Sequence Communication Timing
Notation: UML overview
diagram diagram diagram
diagram

FIGURE 1.7
The class diagram and object diagram used in this book.
13
14 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

Geometry Coordinate system

Point Line Polygon

FIGURE 1.8
Inheritance and dependency.

(a) (b)
Composition
Counties Aggregation State Point MultiPoint
0..* 2..*
Hollow Filled
diamond diamond

FIGURE 1.9
(a) Aggregation and (b) composition are two polar relationships among classes.

FIGURE 1.10
Multicity relationship among classes.

of an object can be changed. Figure 1.11’s class name is worldMap, and its
object is the coordinate system that changed from WGS 1972 to WGS 1984
after performing reprojection.

1.7 Hands-On Experience with Python


A point is the basic data model within GIS. This section will examine
how to create a point class, including coordinates and calculations of the
Introduction 15

FIGURE 1.11
worldMap is an object of the Map class and the state is changing with different operations.

distances between points. You will learn how to create point objects from
point class.

1. Open the program (Figure 1.12):


Windows→All Programs→ArcGIS→Python 2.7
or
Windows→All Programs→Python 2.7→IDLE (Python GUI)

FIGURE 1.12
Launch the Python programming window (GUI).
16 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

>>> import math


>>> class Point():
def __init__(self):
self.x = 0
self.y = 0
def setXY(self,x,y):
self.x = x
self.y = y
def calDis(self,p):
return math.sqrt((self.x-p.x)**2+(self.y-p.y)**2)

>>> p1 = Point()
>>> p2 = Point()
>>> p1.setXY(1,2)
>>> p2.setXY(2,3)
>>> p1.calDis(p2)
1.4142135623730951
>>>

CODE 1.1
Creating a point class and generating two points, then calculating the distance between the
two points.

2. Type in the point class codes as shown in Code 1.1.

Programming tips:

1. Coding should be exactly the same as the figure shows.


2. The init method is defined with four underscores: two “_” before
and two after “init.”
3. Python is case sensitive, so lower- and uppercase of the same letter
will make a difference.
4. There is no need to understand every statement for now; they will be
gradually explained in the following chapters.

1.8 Chapter Summary


This chapter briefly introduced GIS programming and included

• A general introduction to computer hardware and software


• Definitions of GIS and programming
• Python in a practical context
• Practical knowledge about several GIS data models
Introduction 17

• The unified modeling language for modeling object-oriented GIS


data
• Relevant hands-on experience

PROBLEMS
• Define computer, programming, software, and GIS.
• What are the different methods to categorize software?
• What are the three GIS data models found on the UML diagram?
• Explain why we need to learn GIS programming.
• Use the UML diagram to model the relationship between polylines.
• Use the UML diagram to model the relationship between polygons.
• Practice Python’s Chapter 3 tutorial: https://docs.python.org/3/tuto-
rial/introduction.html.
• Use Python to calculate the distance between Point (1, 2) and Point
(2, 2).
• Discuss how to identify classes used on a world map and how to use
UML to capture those classes.
2
Object-Oriented Programming

This chapter introduces object-oriented programming in regard to Python’s


programming language, classes and objects, object generation, inheritance,
GIS classes and objects, and a general programming experience.

2.1 Programming Language and Python


Programming language is defined as an artificial language used to write
instructions that can be translated into machine language and then executed
by a computer. This definition includes four important aspects: (1) artificial
language, a type of programming language created solely for computer com-
munication; (2) instruction based, a programming language with l­imited
instructions supported by a specific computer or CPU; (3) translation, the
conversion from human instructions to a technical computer program,
or CPU; and (4) translator, of which there are two types: interpreter and
­compiler (Aho and Ullman 1972).
There are two different methods computer programmers use to convert
languages into a legible format on the computer. One method requires a
­computer programmer to compile a group of statements written in a spe-
cific language and convert them into a machine-readable format prior to
running the program. The other method entails simultaneously translating
the ­language while running the program. For example, in C programming,
we need to use C compiler to translate the program into machine codes
before execution. Similarly, C++ and Java are compiling-type program-
ing languages. BASIC programming language is an interpreter l­anguage
(Lien 1981), in which the interpreter will translate the program while it
is ­ running. Likewise, Python, Perl, and PHP are considered interpreter
­languages. Therefore, in order to successfully use Python on a computer, a
Python ­interpreter must also be installed.
Programming languages have evolved considerably from machine and
assembly languages to intermediate and advanced languages (Rawen 2016).
Machine language instructions are represented in a specific sequence using
0s and 1s. One single digit, or number, is called a bit. A combination of
three bits is called an octal number (an eight digit combination using the
numbers 0–7), whereas a combination of four bits is called a hex number

19
20 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

FIGURE 2.1
Print ‘A’ 1000 times using different types of languages.

(a 16 digit combination using the numbers 0–15). Assembly languages depict


the machine bit operations with easy-to-remember text representations.
Intermediate languages are typically more powerful and easy to code.
Advanced languages are more similar to human language, do not have
access to specific hardware functions, and are executed on several different
hardware types.
The example uses different representations for the “print letter ‘A’ for 1000
times” (Figure 2.1).
Machine languages become increasingly difficult to understand by
humans, so only specific CPUs are able to read the language accurately
(Hutchins 1986). Therefore, in GIS programming, we normally use advanced
languages such as C, Java, or Python instead of machine or assembly
language.
C is a typical procedural language that was developed around 1969–
1973 and became available to the general public around 1977–1979. It was
­officially standardized by the ANSI X3J11 committee in the mid-1980s and has
become one of the most commonly used languages in the computer ­industry.
The early editions of GRASS (Geographic Resource Analysis Support
System, Neteler and Mitasova 2013) GIS* open-source software and ArcGIS
were developed using C. Bjarne Stroustrup of Bell Laboratories expanded
C to C++ in order to support object-oriented features. C++ s­ upports C fea-
tures in function calls and object-oriented classes/objects fashion. Both C
and C++ are complex for beginning programmers. Since 1999, ISO/ANSI has

* http://grass.osgeo.org/.
Object-Oriented Programming 21

standardized C++ to improve and maintain state-of-the-art q ­ uality within


the industry. C and C++ are commonly used in Linux and have i­nfluenced
other languages such as C# and Java.
Developed by Sun at SunWorld’95, Java is a pure object-oriented language
developed to target Internet and cross-platform applications. Over time, Java
has become increasingly popular among IT companies such as Microsoft,
Borland/Eclipse, IBM, and Sun. The official Java resource can be found at
java.sun.com and an open-source compiler/programming environment can
be found on the Eclipse Foundation website at www.eclipse.com.
Python is an interactive language programming system created by
Guido van Rossum in 1990. Python is dynamically written and uses auto-
matic ­memory management. The nonprofit Python Software Foundation
consistently updates and manages this open-source project. Python is
fully ­developed in that it can write once and run many times on different
­platforms. This book will analyze and explain Python as it is applied to GIS
and ArcGIS* ­programming. You can download any version from Python’s
­website; ­however, not all versions interactively work with ArcGIS. Python
is easy to learn and use, and is supported by ArcGIS, which is why we have
chosen it to be the programming language for this book.

2.2 Class and Object


Classes and objects are widely used in Python. Class defines the template for a
category of objects with name, attributes, and methods. Objects are instances
of classes with attributes and methods. The attributes and methods can
be referred to using a ‘.’. For example, the coordinate attributes and calDis
method of a point object created from a Point class can be referred to using
point.x, point.y, and point.calDis().

2.2.1 Defining Classes


Python provides the mechanism to define a class using the keyword
class with the syntax of ‘class className:’, for example, ‘class Point:’, ‘class
Polyline:’, or ‘class Polygon:’. The attributes and methods can be defined for a
class using the ‘def’ keyword. Figure 2.2 shows the Python code for defining
a Point class with attributes name, x, y defined and the method setName()
defined. In the __init__ method, “0, 0” was passed in as value for x, y, and
name.
Many classes define a special method named __init__() to create/­construct
objects. The method will be called when we create an object using the class

* http://www.esri.com/software/arcgis.
22 Introduction to GIS Programming and Fundamentals with Python and ArcGIS®

Colon for the opening of the


class body
Keyword to Name of this class
Init function Colon for the opening
define all classes
of the method body
The first argument
is always self

Keyword used to The default value for


define function The second argument x
argument name is x

Method name
Assign value
Dot used to call
the attribute

FIGURE 2.2
An example of defining a Point class with Python.

(such as Point class here). The __init__ method has four ‘_’—two before and
two after ‘init’—to make it the construction method that will be used when
creating an object. For all methods defined by a class, the first parameter is
always ‘self’, which refers to the object itself. This can be used to refer to the
attributes and methods of the objects. For example, the __init__ method will
create a point object with self as the first parameter and x, y, name initial val-
ues for the object. By default (without specifying the values), the values for
x, y, and name will be 0, 0, and blank string, respectively. The first two state-
ments of Code 2.1 create two point objects (point0 and point1). The object
point0 is created with default values and point1 is created with arguments

>>> class Point:


def __init__(self, x=0, y=0, name=''):
self.x = x
self.y = y
self.name = name
def setName(self,name):
self.name = name

>>> point0 = Point()


>>> point1 = Point(1,1,'first point')
>>> point0.x, point0.y, point0.name
(0, 0, '')
>>> point1.x, point1.y, point1.name
(1, 1, 'first point')
>>> point1.setName('second point')
>>> point1.name
'second point'
>>>

CODE 2.1
Creating a point may pass in value to the object through parameters.
Object-Oriented Programming 23

of 1, 1, and ‘first point’. If no parameters are given when creating point0, the
default values 0, 0, and ’ ’ will be used. When ­values (1, 1, ’first point’) are
given parameters, the __init__ method will assign the values passed into the
attributes of point1.

2.2.2 Object Generation


To create an object, type objectName = className() with none or multiple
parameters, which will be passed to the attributes declared in the __init__()
methods.

objectName = className(value1,value2,…)

In Code 2.1, we generated two objects, point0 and point1. While declaring
object point0, no parameter is passed while three values (1, 1, ’first point’) are
used to generate point1.
To refer to an object’s attribute or method, we start with the objectName,
followed by a period and then end with the attribute name or method name.

objectName.attributeName
objectName.methodName()

Code 2.1 uses .x, .y, and .name following the objects point0 and point1
to refer to the attributes x, y, and name. The instruction point1.setName() is
called to change the name of point1 to ‘second point’.

2.2.3 Attributes
Each class may have one or more attributes. Section 1.4 explains how attri-
butes can be public, private, or protected to indicate different accessibility by
other objects. How do you explicitly specify the public and private attributes
while declaring a class?

• Public: Attributes in Python are, by default, “public” all the time.


• Private: Attributes that begin with a double underscore (“_”).
Such attributes can be protected as private because it cannot be
directly accessed. However, they can be accessed by object._ClassName
_attributeName, for example, test._Test_foobar, where test is an object
of Test class, and _foobar is a private attribute (Code 2.2).
• Protect: Attributes prefix with a single underscore “_” by convention.
However, they still can be accessed outside of the class in Python.

Another important attribute in Python is the static attribute, which is used


to hold data that is persistent and independent of any object of the class
Exploring the Variety of Random
Documents with Different Content
Chaucer describes the Moon as Lady Cynthia:—

“Her gite was gray and full of spottis blake,


And on her brest a chorle paintid ful even
Bearing a bush of Thornis on his bake
Which for his theft might climb no ner the heven.”

Allusion is here made to the Man in the Moon, bearing a Thorn-


bush on his shoulders—one of the most widely-diffused superstitions
still extant. It is curious that, in several legends respecting this
inhabitant of the Moon, he is represented as having been engaged,
when on earth, in gardening operations. Kuhn relates a tradition in
the Havel country. One Christmas Eve, a peasant felt a great desire
to eat a Cabbage; and, having none himself, he slipped stealthily
into his neighbour’s garden to cut some. Just as he had filled his
basket, the Christ Child rode past on his white horse, and said:
“Because thou hast stolen in the holy night, thou shalt immediately
sit in the Moon with thy basket of Cabbage.” At Paderhorn, in
Westphalia, the crime committed was not theft, but hindering people
from attending church on Easter-Day, by placing a Thorn-bush in the
field-gate through which they had to pass. In the neighbourhood of
Wittingen, the man is said to have been exiled to the Moon because
he tied up his brooms on Maunday Thursday; and at Deilinghofen, of
having mown the Grass in his meadows on Sunday. A Swabian
mother at Derendingen will tell her child that a man was once
working in his vineyard on Sunday, and after having pruned all his
Vines, he made a bundle of the shoots he had just cut off, laid it in
his basket, and went home. According to one version, the Vine-
shoots were stolen from a neighbour’s Vineyard. When taxed either
with Sabbath-breaking or with the theft, the culprit loudly protested
his innocence, and at length exclaimed: “If I have committed this
crime, may I be sent to the Moon!” After his death this fate duly
befell him, and there he remains to this day. The Black Forest
peasants relate that a certain man stole a bundle of wood on Sunday
because he thought on that day he should be unmolested by the
foresters. However, on leaving the forest, he met a stranger, who
was no other than the Almighty himself. After reproving the thief for
not keeping the Sabbath-day holy, God said he must be punished,
but he might choose whether he would be banished to the Sun or to
the Moon. The man chose the latter, declaring he would rather
freeze in the Moon than burn in the Sun; and so the Broom-man
came into the Moon with his faggot on his back. At Hemer, in
Westphalia, the legend runs that a man was engaged in fencing his
garden on Good Friday, and had just poised a bundle of Thorns on
his fork when he was at once transported to the Moon. Some of the
Hemer peasants, however, declare that the Moon is not only
inhabited by a man with a Thorn-bush and pitchfork, but also by his
wife, who is churning, and was exiled to the Moon for using a churn
on Sunday. According to other traditions, the figure in the Moon is
that of Isaac bearing the faggot on his shoulders for his own
sacrifice on Mount Moriah; or Cain with a bundle of Briars; or a tipsy
man who for his audacity in threatening the Moon with a Bramble he
held in his hand, was drawn up to this planet, and has remained
there to the present day.
CHAPTER XV.
Plant Symbolism and Language.
T HE antiquity of floral emblems probably dates from the
time when the human heart first beat with the gentle
emotions of affection or throbbed with the wild pulsations
of love. Then it was that man sought to express through
the instrumentality of flowers his love of purity and beauty, or to
typify through their aid the ardour of his passionate desires; for the
symbolism of flowers, it has been conjectured, was first conceived as
a parable speaking to the eye and thence teaching the heart.
Driven, in his struggle for existence, to learn the properties of
plants in order to obtain wholesome food, man found that with the
beauty of their form and colour they spoke lovingly to him. They
could be touched, tasted, handled, planted, sown, and reaped: they
were useful, easily converted into simple articles of clothing, or bent,
twisted, and cut into weapons and tools. Flowers became a language
to man very early, and according to their poisonous, soothing, or
nutritious qualities, or on account of some peculiarities in their
growth or shape which seemed to tell upon the mysteries of life,
birth, and death, he gave them names which thenceforth became
words and symbols to him of these phenomena.
Glimpses of the ancient poetical plant symbolism have been found
amid the ruins of temples, graven on the sides of rocks, and
inscribed on the walls of mighty caves where the early nations of
India, Assyria, Chaldæa, and Egypt knelt in adoration. The Chinese
from time immemorial have known a comprehensive system of floral
signs and emblems, and the Japanese have ever possessed a mode
of communicating by symbolic flowers. Persian literature abounds in
chaste and poetical allegories, which demonstrate the antiquity of
floral symbolism in that far Eastern land: thus we are told that Sadi
the poet, when a slave, presented to his tyrant master a Rose
accompanied with this pathetic appeal:—“Do good to thy servant
whilst thou hast the power, for the season of power is often as
transient as the duration of this beautiful flower.” The beauty of the
symbol melted the heart of his lord, and the slave obtained his
liberty.
The Hindu races are passionately fond of flowers, and their
ancient Sanscrit books and poems are full of allusions to their beauty
and symbolic character. With them, the flower of the field is
venerated as a symbol of fecundity. In their mythology, at the
beginning of all things there appeared in the waters the expanded
Lotus-blossom, the emblematic flower of life and light; the Sun,
Moon, and Stars are flowers in the celestial garden; the Sun’s ray is
a full-blown Rose, which springs from the waters and feeds the
sacrificial fire; the Lightning is a garland of flowers thrown by
Narada. Pushpa (flower), or Pushpaka (flowery), is the epithet
applied to the luminous car of the god Kuvera, which was seized by
Râvana, the royal monster of Lankâ, and recaptured by the demi-
god Râma, the incarnation of Vishnu. The bow of Kâma, the Indian
Cupid, darts forth flowers in the guise of arrows. The Indian poetic
lover gathers from the flowers a great number of chaste and
beautiful symbols. The following description of a young maiden
struck down by illness is a fair example of this:—“All of a sudden the
blighting glance of unpropitious fortune having fallen on that Rose-
cheeked Cypress, she laid her head on the pillow of sickness; and in
the flower-garden of her beauty, in place of the Damask Rose,
sprang up the branch of the Saffron. Her fresh Jasmine, from the
violence of the burning illness, lost its moisture, and her Hyacinth,
full of curls, lost all its endurance from the fever that consumed her.”
It was with the classic Greeks, however, that floral symbolism
reached its zenith: not only did the Hellenic race entertain an
extraordinary passion for flowers, but with consummate skill they
devised a code of floral types and emblems adapted to all phases of
public and private life. As Loudon writes, when speaking of the
emblematic use made by the Greeks of flowers:—“Not only were
they then, as now, the ornament of a beauty, and of the altars of the
gods, but the youths crowned themselves with them in the fêtes, the
priests in religious ceremonies, and the guests in convivial meetings.
Garlands of flowers were suspended from the gates of the city in the
times of rejoicing ... the philosophers wore crowns of flowers, and
the warriors ornamented their foreheads with them in times of
triumph.” The Romans, although they adopted most of the floral
symbolic lore of their Hellenic predecessors, and in the case of
emblematic garlands were particularly refined, were still evidently
not so passionately fond of floral symbolism as were the Greeks; and
with the decadence of the Empire, the attractive art gradually fell
into oblivion.
The science of plant symbolism may, if we accept the views of
Miss Marshall, a writer on the subject,[16] be classified into five
divisions. These are, firstly, plants which are symbols, pure and
simple, of the Great Unknown God, or Heaven Father; and embrace
those, the form, colour, or other peculiarities of which led the
priests, the early thinkers to the community, the medicine-men,
magicians, and others, to associate them with ideas of the far-
distant, unknown, incomprehensible, and overwhelming—the
destructive forces of Nature. Such plants were used as hieroglyphics
for these ideas, and became symbols of the Deity or Supreme Power.
To these visible symbols belong plants such as the Lily, Onion,
flowers of heavenly blue colour (symbolising the blue sky), and
leaves threefold or triangular, symbolising God the Creator, Preserver,
and Destroyer.
Secondly, the plants symbolising or suggesting portions or organs
of the human body, internal and external, which to the earliest of
mankind, and certainly to the Egyptian embalmers, were organs of
mystery and importance; such is the heart, the first to beat in the
fœtal, and the last to cease pulsating in the adult organism, &c. To
this section belong heart-shaped leaves and petals; and where, as in
the Shamrock, there is united the threefold emblem and the heart-
shaped leaf, there is a doubly sacred idea united with the form. To
this section belong also plants and fruits such as the Fig,
Pomegranate, &c.
The third section comprises plants that were consecrated or set
apart as secret and sacred, because those who possessed the
knowledge of their powers made use of them to awe the ignorant
people of their race. These plants were supposed to be under the
control of the good or evil powers. They were the narcotics, the
stupefying or the exciting vegetable drugs. The sacred incense in all
temples was compounded of these, and their use has been, and still
is, common to all countries; and as some of these compounds
produced extraordinary or deadly effects, as the very dust of the
burnt incense, when mixed with water, and drunk, brought on a
violent and agonising death, while the fumes might merely produce
delightful and enticing ecstacy, making men and women eloquent
and seemingly inspired, the knowledge was wisely kept secret from
the people, and severe penalties—sometimes even death—awaited
those who illegally imitated, compounded, or used these drugs. To
this section belong the plants used to make the Chinese and
Japanese joss, as well as Opium, Tobacco, Stramonium, and various
opiates now well known.
The fourth section comprises those plants which in all countries
have been observed to bear some resemblance to parts of the
human body. Such plants were valued and utilised as heaven-sent
guides in the treatment of the ills flesh is heir to; and they are the
herbs whose popular names among the inhabitants of every land
have become “familiar in their mouths as household words.” To such
belong the Birth-wort, Kidney-wort, Lung-wort, Liver-wort, Pile-wort,
Nit-grass, Tooth-cress, Heart-clover, and many others known to the
ancient herbalists. It was their endeavours to find out whether or no
the curious forms, spots, and markings of such plants really
indicated their curative powers, that led to the properties of other
herbs being discovered, and a suggestive nomenclature being
adopted for them, such as is found in the names Eyebright, Flea-
bane, Canker-weed, Hunger-grass, Stone-break, &c.
Lastly, in the fifth section of symbolical plants we come to those
which point to a time when symbols were expressed by letters, such
as appear on the Martagon Lily—the true poetical Hyacinth of the
Greeks—on the petals of which are traced the woeful AI, AI,—the
expression of the grief of Phœbus at the death of the fair Adonis.

“In the flower he weaved


The sad impression of his sighs; which bears
Ai, Ai, displayed in funeral characters.”

In this section also are included plants which exhibit in some portion
of their structure typical markings, such as the Astragalus, which in
its root depicts the stars; the Banana, whose fruit, when cut,
exhibits a representation of the Holy Cross; and the Bracken Fern,
whose stem, when sliced, exhibits traces of letters which are
sometimes used for the purposes of love divination. In Ireland,
however, the Pteris aquilina is called the Fern of God, because the
people imagine that if the stem be cut into three sections, on the
first of these sections will be seen the letter G, on the second O, and
on the third D—forming the sacred word God.
In the science of plant symbols, not only the names, but the
forms, perfumes, and properties of plants have to be considered, as
well as the numerical arrangements of their parts. Thus of all sacred
symbolical plants, those consisting of petals or calyx-sepals, or
leaves, divided into the number Five, were formerly held in peculiar
reverence, because among the races of antiquity five was for ages a
sacred number. The reason of this is thus explained by Bunsen:—“It
is well known,” he says, “that the numeral one, the undivided, the
eternal, is placed in antithesis to all other numerals. The figure four
included the perfect ten, as 1+2+3+4=10. So four represents the All
of the universe. Now if we put these together, 4+1 will be the sign
of the whole God-Universe.” Three is a number sacred to the most
ancient as well as modern worship. Pythagoras called it the perfect
number, expressive of “beginning, middle, and end,” and therefore
he made it a symbol of deity. Three therefore plays its rôle in plant
symbology. Thus the Emblica officinalis, one of the sacred plants of
India, was once the exclusive property of the priests, who kept its
medicinal virtues secret: it was held in peculiar reverence because of
its flowers possessing a six-parted calyx; three stamens, combined;
three dichotomous styles; a fleshy fruit, tricoccous and six-seeded;
these being all the sacred or double number of Three. In later days,
the Shamrock or Trefoil, and the Pansy, or Herb Trinity, were
regarded as symbolising the Trinity. Cruciform flowers are, at the
present day, all regarded as of good omen, having been marked with
the Sign of the Cross, and thus symbolising Redemption.
The presence of flowers as symbols and language on the
monuments of Assyria, Babylon, Egypt, India, and other countries of
the past, and the graceful floral adornments sculptured on the
temples of the Græco-Roman period, demonstrate how great a part
flower and plant symbolism played in the early history of mankind.
The Jews, learning the art from the Egyptians, preserved it in their
midst, and introduced plant emblems in their Tabernacle, in their
Temple, and on the garments of the priests. Flowers with golden
rays became symbols of the Sun; and as the Sun was the giver of
life and warmth, the bringer of fertility, the symbolic flowers stood as
symbol-words for these great gifts; and gradually all the mysterious
phenomena connected with birth, reproduction, and fecundity, were
represented in plant, flower, and fruit symbolism; for not only were
flowers early used as a pictorial language, but the priests made use
of fruits, herbs, shrubs, and trees to symbolise light, life, warmth,
and generation. Let us take a few examples:—When in the Spring,
church altars and fonts are piously adorned with white Lilies, which
are, in some countries, carried about, worn, and presented by ladies
to each other in the month of May, few of them, we may be sure,
imagine that they are perpetuating the plant symbolism of the Sun-
worship of ancient Egypt. Miss Marshall tells us that “in Catholic
countries the yellow anthers are carefully removed; their white
filaments alone are left, not, as folks think, that the flower may
remain pure white, but that the fecundating or male organs being
removed, the Lilies may be true flower symbols or visible words for
pure virgins; for the white dawn as yet unwedded to the day—for
the pure cold Spring as yet yielding no blossoms and Summer fruits.”
Of the flowers consecrated to their deities by the symbol-
worshipper of India and Egypt, the most prominent is the sacred
Lotus, whose leaf was the “emblem and cradle of creative might.” It
was anciently revered in Egypt as it is now in Hindustan, Thibet, and
Nepaul, where the people believe it was in the consecrated bosom of
this plant that Brahma was born, and that Osiris delights to float.
From its peculiar organisation the Lotus is virtually self-productive:
hence it became the symbol of the reproductive power of all nature,
and was worshipped as a symbol of the All-Creative Power. The
same floral symbol occurs wherever in the northern hemisphere
symbolic religion has prevailed. The sacred images of the Tartars,
Japanese, and Indians are almost all represented as resting upon
Lotus-leaves. The Chinese divinity, Puzza, is seated in a Lotus, and
the Japanese god is represented sitting in a Water-Lily. The Onion
was formerly held in the highest esteem as a religious symbol in the
mysterious solemnities and divinations of the Egyptians and Hindus.
In the first place, its delicate red veins and fibres rendered it an
object of veneration, as typifying the blood, at the shedding of which
the Hindu shudders. Secondly, it was regarded as an astronomical
emblem, for on cutting through it, there appeared beneath the
external coat a succession of orbs, one within another, in regular
order, after the manner of revolving spheres. The Rose has been
made a symbolic flower in every age. In the East, it is the emblem of
virtue and loveliness. The Egyptians made it a symbol of silence; the
Romans regarded it as typical of festivity. In modern times it is
considered the appropriate symbol of beauty and love,—the half-
expanded bud representing the first dawn of the sublime passion,
and the full-blown flower the maturity of perfect love. The Asphodel,
like the Hyacinth of the ancients, was regarded as an emblem of
grief and sorrow. The Myrtle, from its being dedicated to Venus, was
sacred as a symbol of love and beauty. White flowers were held to
be typical of light and innocence, and were consecrated to virgins.
Sombre and dark-foliaged plants were held to be typical of disaster
and death.
The floral symbols of the Scriptures are worthy of notice. From
the circumstance of Elijah having been sheltered from the
persecutions of King Ahab by the Juniper, that tree has become a
symbol of succour or an asylum. The Almond was an emblem of
haste and vigilance to the Hebrew writers; with Eastern poets,
however, it was regarded as a symbol of hope. Throughout the East,
the Aloe is regarded as a religious symbol, and is greatly venerated.
It is expressive of grief and bitterness, and is religiously planted by
the Mahommedans at the extremity of every grave. Burckhardt says
that they call it by the Arabic name Saber, signifying patience—a
singularly appropriate name; for as the plant is evergreen, it
whispers to those who mourn for the loved ones they have lost,
patience in their affliction. The Clover is another sacred plant
symbol. St. Patrick chose it as an emblem of the Trinity when
engaged in converting the Irish, who have ever since, in the
Shamrock, regarded it as a representative plant. The Druids thought
very highly of the Trefoil because its leaf symbolised the three
departments of nature—the earth, the sea, and the heaven.
But of all plant symbols, none can equal in beauty or sanctity the
Passion Flower, the lovely blossom of which, when first met with by
the Spanish conquerors of the New World, suggested to their
enthusiastic imagination the story of our Saviour’s Passion. The
Jesuits professed to find in the several parts of the Maracot the
crown of thorns, the scourge, the pillar, the sponge, the nails, and
the five wounds, and they issued drawings representing the flower
with its inflorescence distorted to suit their statements regarding its
almost miraculous character. John Parkinson, in his Paradisus
Terrestris (1629), gives a good figure of the Virginian species of the
plant, as well as an engraving of “The Jesuites Figure of the Maracoc
—Granadillus Frutex Indicus Christi Passionis Imago.” But, as a good
Protestant, he feels bound to enter his protest against the
superstitious regard paid to the flower by the Roman Catholics, and
so he writes: “Some superstitious Jesuites would fain make men
believe that in the flower of this plant are to be seen all the markes
of our Saviour’s Passion: and therefore call it Flos Passionis: and to
that end have caused figures to be drawn and printed, with all the
parts proportioned out, as thornes, nailes, spear, whip, pillar, &c., in
it, and as true as the sea burns, which you may well perceive by the
true figure taken to the life of the plant, compared with the figure
set forth by the Jesuites, which I have placed here likewise for
everyone to see: but these be their advantageous lies (which with
them are tolerable, or rather pious and meritorious) wherewith they
use to instruct their people; but I dare say, God never willed His
priests to instruct His people with lies: for they come from the Devill,
the author of them.”
The Passion-flower of the Jesuits. From Parkinson’s Paradisus.

In early times, it was customary in Europe to employ particular


colours for the purpose of indicating ideas and feelings, and in
France where the symbolical meaning of colours was formed into a
regular system, much importance was attached to the art of
symbolising by the selection of particular colours for dresses,
ornaments, &c. In this way, flowers of various hues became the apt
media of conveying ideas and feelings; and in the ages of chivalry
the enamoured knight often indicated his passion by wearing a
single blossom or posy of many-hued flowers. In the romance of
Perceforet, a hat adorned with Roses is celebrated as a favourite gift
of love; and in Amadis de Gaule, the captive Oriana is represented
as throwing to her lover a Rose wet with tears, as the sweetest
pledge of her unalterable faith. Red was recognised as the colour of
love, and therefore the Rose, on account of its tint, was a favourite
emblem. Of the various allegorical meanings which were in the
Middle Ages attached to this lovely flower, a description will be found
in the celebrated Romaunt de la Rose, which was commenced in the
year 1620 by Guillaume de Lorris, and finished forty years later by
Jean de Meung.
In France, during the Middle Ages, flowers were much employed
as emblems of love and friendship. At the banquet given in
celebration of the marriage of Charles the Bold, Duke of Burgundy,
with the English Princess, Margaret, several ingenious automata
were introduced, one being a large unicorn, bearing on its back a
leopard, which held in one claw the standard of England, and on the
other a Daisy, or Marguerite. The unicorn having gone round all the
tables, halted before the Duke; and one of the maîtres d’hôtel,
taking the Daisy from the leopard’s claw, presented it, with a
complimentary address, to the royal bridegroom.
In the same country, an act of homage, unique in its kind, was
paid to a lady in the early part of the seventeenth century. The Duke
of Montausier, on obtaining the promise of the hand of Mademoiselle
de Rambouillet, sent to her, according to custom, every morning till
that fixed for the nuptials, a bouquet composed of the finest flowers
of the season. But this was not all: on the morning of New Year’s
Day, 1634—the day appointed for the marriage—he laid upon her
dressing-table a magnificently-bound folio volume, on the parchment
leaves of which the most skilful artists of the day had painted from
nature a series of the choicest flowers cultivated at that time in
Europe. The first poets of Paris contributed the poetical illustrations,
which were written by the cleverest penmen under the different
flowers. The most celebrated of these madrigals, composed by
Chapelain on the Crown Imperial, represented that superb flower as
having sprung from the blood of Gustavus Adolphus, who fell in the
battle of Lützen; and thus paid, in the name of the Swedish hero, a
delicate compliment to the bride, who was a professed admirer of
his character. According to a statement published some years since,
this magnificent volume, which was called, after the name of the
lady, the Garland of Julia, was disposed of, in 1784, at the sale of
the Duke de la Vallière’s effects, for fifteen thousand five hundred
and ten livres (about £650), and was brought to England.
The floral emblems of Shakspeare are evidence of the great
poet’s fondness for flowers and his delicate appreciation of their uses
and similitudes. In ‘A Winter’s Tale,’ Perdita is made to present
appropriate flowers to her visitors, symbolical of their various ages;
but the most remarkable of Shakspeare’s floral symbols occur where
poor Ophelia is wearing, in her madness, “fantastic garlands of wild
flowers”—denoting the bewildered state of her faculties.
The order of these flowers runs thus, with the meaning of each
term beneath:—

Crow Flowers. Nettles. Daisies.


Fayre Mayde. Stung to the Quick. Her Virgin Bloom.
Long Purples.
Under the cold hand
of Death.

“A fair maid, stung to the quick; her virgin bloom under the
cold hand of death.”

Probably no wreath could have been selected more truly typifying


the sorrows of this beautiful victim of disappointed love and filial
sorrow.
The most noted code of floral signs, used as a language by the
Turkish and Greek women in the Levant, and by the African females
on the coast of Barbary, was introduced into Western Europe by
Lady Mary Wortley Montagu and La Mortraie, the companion in exile
of Charles XII., and obtained in France and England much popularity
as the “Turkish Language of Flowers.” This language is said to be
much employed in the Turkish harems, where the women practise it,
either for the sake of mere diversion in their seclusion, or for
carrying on secret communication.
In France and Germany, the language of flowers has taken deep
root, and in our own country the poetic symbolisms of Shakspeare,
Chaucer, Herrick, Drayton, and others of the earlier bards, laid the
groundwork for the very complete system of floral emblemism, or
language of flowers, which we now possess. A great many works
have been published, containing floral codes, or dictionaries: most of
these, however, possess but little merit as expositions of old symbols
or traditions, and have been compiled principally from modern
sources.
An ancient floral vocabulary, taken from Dierbach’s Flora
Mythologica der Griechen und Römer, and an approved modern
English ‘Dictionary of Flowers,’ are appended, in order to make this
portion of our subject complete.

Ancient Floral Vocabulary.

Absinth The Bitterness and Torments of Love.


Acacia Love, pure and platonic.
Acanthus Love of Fine Arts.
Althea Exquisite Sweetness.
Amaranth Fidelity and Constancy.
Anemone Abandonment.
Angelica Gentle Melancholy.
Argentine Ingenuity.
Aster Elegance.
Balsam Impatience.
Basil Poverty.
Betony Emotion and Surprise.
Bindweed Coquetry.
Bluet Clearness and Light.
Box Firmness and Stoicism.
Bramble Injustice and Envy.
Burdock Importunity.
Buttercup Sarcasm.
Calendula Anxiety.
Camellia Constancy and Steadfastness.
Carrot Good Character.
Cinquefoil Maternal Love.
Colchicum Bad Character.
Cypress Mourning and Grief.
Dahlia Sterile Abundance.
Daisy (Easter) Candour and Innocence.
Dandelion Oracle.
Darnel Vice.
Digitalis Work.
Dittany Discretion.
Elder Humility.
Ephemeris Transient Happiness.
Everlasting Flwr. Constancy.
Fennel Merit.
Fern Confidence.
Forget-me-not Faithful Remembrance.
Foxglove Adulation.
Fuchsia Amiability.
Fumitory Hatred.
Geranium Folly.
Hawthorn Sweet Hope.
Heliotrope Eternal Love.
Hellebore Wit.
Hemlock Perfidy.
Holly Defence.
Honeysuckle Bond of Affection.
Hyacinth Amenity.
Hydrangea Coldness.
Iris Indifference.
Ivy Attachment.
Jasmine Amiability.
Jonquil Amorous Languor.
Jujube-tree Relief.
Larkspur Open Heart.
Laurel Victory and Glory.
Lavender Silence.
Lilac First Troubles of Love.
Lily Purity and Majesty.
Maidenhair Bond of Love.
Marjoram Consolation.
Marvel of Peru Flame of Love.
Mallow Maternal Tenderness.
Mint Wisdom and Virtue.
Milfoil Cure and Recovery.
Moonwort Bad Payment.
Myrtle Love.
Narcissus Self-esteem and Fatuity.
Nettle Cruelty.
Olive Peace.
Orange-tree Virginity, Generosity.
Peony Shame.
Periwinkle Unalterable Friendship.
Pineapple Perfection.
Pink Pure and Ardent Love.
Poppy Sleep.
Privet Youth.
Rose Beauty and Love.
Rosemary Power of Re-kindling extinct Energy.
Rue Fecundity of Fields.
Sage Esteem.
Sensitive-plant Modesty.
Solanum Prodigality.
Spindle-tree Ineffaceable Memory.
Strawberry Intoxication, Delight.
Thyme Spontaneous Emotion.
Trefoil Uncertainty.
Tulip Grandeur.
Valerian Readiness.
Vervain Pure Affection.
Viburnum Coolness.
Violet Modesty.

A Dictionary of Flowers.

Acacia Friendship.
—— Rose Elegance.
Acanthus The Arts.
Achillea millefolia War.
Adonis, Flos Painful Recollections.
Agrimony Thankfulness.
Almond-tree Indiscretion.
Aloe Grief.
Amaranth Immortality.
Amaryllis Pride.
Anemone Forsaken.
—— Field Sickness.
Angelica Inspiration.
Angrec Royalty.
Apple-blossom Preference.
Ash-tree Grandeur.
Asphodel My regrets follow you to the grave.
Aster, China Variety.
—— After-Thought.
Balm of Gilead Cure.
—— Gentle Joking.
Balsam Impatience.
Barberry Sourness of Temper.
Basil Hate.
Beech Prosperity.
Bilberry Treachery.
Bladder-nut Frivolous Amusement.
Borage Bluntness.
Box-tree Stoicism.
Bramble Envy.
Broom Humility and Neatness.
Buckbean Calm Repose.
Bugloss Falsehood.
Bulrush Indiscretion.
Burdock Touch me not.
Buttercup Ingratitude.
Cactus, Virginia Horror.
Canterbury Bell Constancy.
Catchfly Snare.
Champignon Suspicion.
Cherry-tree Good Education.
Chesnut-tree Do me Justice.
Chicory Frugality.
Cinquefoil Beloved Daughter.
Circæa Spell.
Clematis Artifice.
Clotbur Rudeness.
Clove-tree Dignity.
Columbine Folly.
Convolvulus (night) Night.
Coriander Hidden Merit.
Corn Riches.
Corn-bottle Delicacy.
Cornel Cherry Durability.
Cowslip, Amer. You are my Divinity.
Cress Resolution.
Crown Imperial Power.
Cuscuta Meanness.
Cypress Mourning.
Daffodil Self Love.
Daisy Innocence.
—— Garden I share your sentiments.
—— Wild I will think of it.
Dandelion The Rustic Oracle.
Day Lily, Yellow Coquetry.
Dittany Childbirth.
Dock Patience.
Dodder Meanness.
Ebony-tree Blackness.
Eglantine Poetry.
Fennel Strength.
Fig Longevity.
Fir-tree Elevations.
Flax I feel your kindness.
Flower-de-Luce Flame.
Forget-Me-Not Forget me not.
Fraxinella Fire.
Fuller’s Teasel Misanthropy.
Geranium Deceit.
—— Oak-leaved True Friendship.
—— Silver-leaved Recall.
—— Pencilled-leaf Ingenuity.
—— Rose-scented Preference.
—— Scarlet Stupidity.
—— Sorrowful Melancholy Mind.
—— Wild Steadfast Piety.
Grass Utility.
Hawthorn Hope.
Hazel Peace, Reconciliation.
Heart’s Ease Think of me.
Heath Solitude.
Heliotrope, Peruvian Devoted Attachment.
Hellenium Tears.
Hepatica Confidence.
Holly Foresight.
Hollyhock Ambition.
Honeysuckle Generous and Devoted Affection.
Hop Injustice.
Hornbeam Ornament.
Horse-Chesnut Luxury.
Hortensia You are cold.
Hyacinth Game, Play.
Ice-plant Your looks freeze me.
Ipomœa I attach myself to you.
Iris Message.
Ivy Friendship.
Jasmine Amiability.
—— Carolina Separation.
Jonquil Desire.
Juniper Protection.
Larch Boldness.
Larkspur Lightness.
Laurel Glory.
Laurustinus I die if neglected.
Lavender Mistrust.
Leaves, Dead Sadness, Melancholy.
Lilac First Emotions of Love.
—— White Youth.
Lily Majesty.
Lily of the Valley Return of Happiness.
Linden-tree Conjugal Love.
Liverwort Confidence.
London Pride Frivolity.
Lotus Eloquence.
Lucern Life.
Madder Calumny.
Maidenhair Secrecy.
Mallow Beneficence.
Manchineel-tree Falsehood.
Maple Reserve.
Mandrake Rarity.
Marigold Grief.
—— Prophetic Prediction.
—— and Cypress Despair.
Marvel of Peru Timidity.
Meadow Saffron My best days are past.
Mezereon Coquetry. Desire to please.
Mignonette Your qualities surpass your charms.
Milkwort Hermitage.
Mistletoe I surmount all difficulties.
Moonwort Forgetfulness.
Moss Maternal Love.
Mulberry-tree, Black I shall not survive you.
—— White Wisdom.
Musk-plant Weakness.
Myrobalan Privation.
Myrtle Love.
Narcissus Self Love.
Nettle Cruelty.
Nightshade, Bitter-sweet Truth.
—— Enchanter’s Spell.
Nosegay Gallantry.
Oak Hospitality.
Olive Peace.
Ophrys, Spider Skill.
Orange Flower Chastity.
—— Tree Generosity.
Orchis, Bee Error.
Palm Victory.
Parsley Festivity.
Passion Flower Faith.
Peony Shame, Bashfulness.
Peppermint Warmth of Feeling.
Periwinkle Tender Recollections.
Pineapple You are perfect.
Pink Pure Love.
—— Yellow Disdain.
Plane-tree Genius.
Plum-tree Keep your promises.
—— Wild Independence.
Poplar, black Courage.
—— White Time.
Poppy Consolation.
—— Sleep.
—— White My bane, my antidote.
Potato Beneficence.
Primrose Childhood.
—— Evening Inconstancy.
Privet Prohibition.
Quince Temptation.
Ranunculus You are radiant with charms.
Reeds Music.
Rose Love.
—— 100-leaved Grace.
—— Monthly Beauty ever new.
—— Musk Capricious Beauty.
—— Single Simplicity.
—— White Silence.
—— Withered Fleeting Beauty.
—— Yellow Infidelity.
Rosebud A Young Girl.
—— White A Heart unacquainted with Love.
Rosemary Your presence revives me.
Rue, Wild Morals.
Rush Docility.
Saffron Beware of excess.
Sage Esteem.
Sainfoin, Shaking Agitation.
St. John’s Wort Superstition.
Sardonia Irony.
Sensitive-plant Chastity.
Snapdragon Presumption.
Snowdrop Hope.
Sorrel, Wood Joy.
Speedwell Fidelity.
Spindle-tree Your charms are engraven on my
heart.
Star of Bethlehem Purity.
Stock Lasting Beauty.
—— Ten Week Promptness.
Stone Crop Tranquillity.
Straw, Broken Rupture of a Contract.
—— Whole Union.
Strawberry Perfection.
Sunflower False Riches.
Sweet Sultan Happiness.
Sweet William Finesse.
Sycamore Curiosity.
Syringa Fraternal Love.
Tansy, Wild I declare war against you.
Tendrils of Creepers Ties.
Thistle Surliness.
Thorn Apple Deceitful Charms.
Thrift Sympathy.
Thyme Activity.
Tremella Nostoc Resistance.
Truffle Surprise.
Tuberose Dangerous Pleasures.
Tulip Declaration of Love.
Tussilage, Sweet- Justice shall be done to you.
scented
Valerian An Accommodating Disposition.
Valerian, Greek Rupture.
Venus’ Looking-glass Flattery.
Veronica Fidelity.
Vervain Enchantment.
Vine Intoxication.
Violet Modesty.
Violet, White Innocence, Candour.
Wallflower Fidelity in Misfortune.
Walnut Stratagem.
Whortleberry Treachery.
Willow, Weeping Mourning.
Wormwood Absence.
Yew Sorrow.

In the chapter on Magic Plants will be found a list of plants used


by maidens and their lovers for the purposes of divination; and in
Part II., under the respective headings of the plants thus alluded to,
will be found described the several modes of divination. This practice
of love divination, it will be seen, is not altogether unconnected with
the symbolical meaning or language of flowers, and therefore it is
here again adverted to.
In many countries it is customary to pluck off the petals of the
Marigold, or some other flower of a similar nature, while certain
words are repeated, for the purpose of divining the character of an
individual. Göthe, in his tragedy of ‘Faust,’ has touched upon this
rustic superstition, and makes Margaret pluck off the leaves of a
flower, at the same time alternately repeating the words—“He loves
me,”—“He loves me not.” On coming to the last leaf, she joyously
exclaims—“He love me!”—and Faust says: “Let this flower pronounce
the decree of heaven!”

“And with scarlet Poppies around, like a bower,


The maiden found her mystic flower.
‘Now, gentle flower, I pray thee tell
If my lover loves me, and loves me well;
So may the fall of the morning dew
Keep the sun from fading thy tender blue.
Now must I number the leaves for my lot—
He loves me not—loves me—he loves me not—
He loves me—ah! yes, thou last leaf, yes—
I’ll pluck thee not for that last sweet guess!
He loves me!’—‘Yes,’ a dear voice sighed,
And her lover stands by Margaret’s side.”—Miss Landon.

In some places, the following mode of floral divination is resorted


to. The lover, male or female, who wishes to ascertain the character
of the beloved one, draws by lot one of the following flowers, the
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like