Skip to Content
Mastering Geospatial Analysis with Python
book

Mastering Geospatial Analysis with Python

by Silas Toms, Paul Crickard, Eric van Rees
April 2018
Beginner to intermediate content levelBeginner to intermediate
440 pages
11h 36m
English
Packt Publishing
Content preview from Mastering Geospatial Analysis with Python

Creating geometries with Shapely

Just like OGR, you can use Shapely to create geometries. Jupyter Notebook will plot the geometries after you've created them, as opposed to OGR. You don't have to use extra plot statements to do this, just repeat the variable name used to store the geometries:

In:   from shapely.geometry import Polygon      p1 = Polygon(((1, 2), (5, 3), (5, 7), (1, 9), (1, 2)))      p2 = Polygon(((6,6), (7,6), (10,4), (11,8), (6,6)))      p1       # A new command line is required for printing the second polygon:In:   p2      # Point takes tuples as well as positional coordinate valuesIn:   from shapely.geometry import Point      point = Point(2.0, 2.0)      q = Point((2.0, 2.0))      q       # line geometryIn:    from shapely.geometry import LineString line = LineString([(0, 0), ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Geospatial Analysis with Python

Learning Geospatial Analysis with Python

Joel Lawhead

Publisher Resources

ISBN: 9781788293334Supplemental Content