Shapely is a python package for manipulation and analysis of planar geometric objects. It provides a set of classes to represent different geometric objects like points, lines, or polygons. It also provides methods to manipulate these objects, such as computing the intersection or union of objects.
It is also designed to interoperate with NumPy and to provide efficient operations on geometric objects. Shapely includes a powerful set of methods for operating on point sets, including union, intersection, difference, and containment tests. Shapely also implements the following geometric primitives: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.
This BSD licensed package is built on the GEOS library and is used in GIS and CAD applications, but it can be used in any application which needs to manipulate and analyze geometry.
Uses of the shapely python package
Take a look at some of the functionality the shapely package provides:
1. Manipulating geometric objects in many different ways
2. Creating geometric objects from scratch
3. Converting between different geometries
4. Geoprocessing (e.g. buffer, union, intersection, difference)
5. Plotting of geometry
6. Querying geometries with OGC standards
Shapely is provided by popular Python distributions like Canopy, Python Package Index and Anaconda therefore can be installed via package management tools like
conda. If you use the Conda package manager to install Shapely, be sure to use the conda-forge channel.
To install shape using pip
pip install shapely
To install the shapely package with conda run following:
conda install -c conda-forge shapely
This blog post is an introduction to the Python Shapely package.
Shapely is a powerful library for geometry, which is a branch of mathematics that studies the properties of geometrical objects that are measurable.
Shapely can be used for things such as calculating the closest distance between two points or finding the intersection between two polygons.