Shapely objects and classes

The Shapely library is used for creating and manipulating 2D vector data without the need for a spatial database. Not only does it do away with a database, it also does away with projections and data formats, focusing on geometry only. The strength of Shapely is that it uses easily-readable syntax to create a variety of geometries that can be used for geometric operations.

With the aid of other Python packages, these geometries and the results of geometric operations can be written to a vector file format and projected if necessary—we'll cover examples combing pyproj and Fiona with Shapely's capabilities. An example of a workflow incorporating Shapely might be where you'd read vector geometries out of a shapefile using Fiona, and then use Shapely to simplify or clean up existing geometries, in case things might line up correctly internally or in combination with other geometries. The cleaned-up geometries can be used as input for other workflows, for example, for creating a thematic map or performing data science.

 The Shapely library uses a set of classes that are implementations of three fundamental types of geometric objects—points, curves, and surfaces. If you are familiar with geospatial data and their geometries, they will sound familiar. If you're not, use the examples to get familiar with them:

Geometric object name

Class name

Point

Point

Curve

LineString, LinearRing

Surface

Polygon

Collection of points

MultiPoint

Collection of curves

MultiLineString

Collection of surfaces

MultiPolygon

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset