-
Book Overview & Buying
-
Table Of Contents
Python GeoSpatial Analysis Essentials
By :
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Once you have installed it, you can check that it's working by firing up your Python interpreter and typing import osgeo.gdal and then import osgeo.ogr."
A block of code is set as follows:
import osgeo.ogr
shapefile = osgeo.ogr.Open("TM_WORLD_BORDERS-0.3.shp")
layer = shapefile.GetLayer(0)
for i in range(layer.GetFeatureCount()):
feature = layer.GetFeature(i)
feature_name = feature.GetField("NAME")
geometry = feature.GetGeometryRef()
geometry_type = geometry.GetGeometryName()
print i, feature_name, geometry_typeWhen we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
from osgeo import ogr
driver = ogr.GetDriverByName("ESRI Shapefile")
dstFile = driver.CreateDataSource("test-shapefile")Any command-line input or output is written as follows:
% python readRaster.py -500 53081919 -84 1 -83 8 -82 9 -81 17 ... 5241 1 5295 1 5300 1 5443 1
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking on the Next button moves you to the next screen."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Change the font size
Change margin width
Change background colour