shapely

Manipulation and analysis of geometric objects

https://github.com/shapely/shapely

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    6 of 170 committers (3.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary

Keywords from Contributors

gdal closember cython ogr gtk qt tk wx unit-testing yapf
Last synced: 6 months ago · JSON representation ·

Repository

Manipulation and analysis of geometric objects

Basic Info
Statistics
  • Stars: 4,234
  • Watchers: 89
  • Forks: 600
  • Open Issues: 247
  • Releases: 26
Created about 14 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation

README.rst

=======
Shapely
=======

.. Documentation at RTD — https://readthedocs.org

.. image:: https://readthedocs.org/projects/shapely/badge/?version=stable
   :alt: Documentation Status
   :target: https://shapely.readthedocs.io/en/stable/

.. Github Actions status — https://github.com/shapely/shapely/actions

.. |github-actions| image:: https://github.com/shapely/shapely/workflows/Tests/badge.svg?branch=main
   :alt: Github Actions status
   :target: https://github.com/shapely/shapely/actions?query=branch%3Amain

.. PyPI

.. image:: https://img.shields.io/pypi/v/shapely.svg
   :alt: PyPI
   :target: https://pypi.org/project/shapely/

.. Anaconda

.. image:: https://img.shields.io/conda/vn/conda-forge/shapely
   :alt: Anaconda
   :target: https://anaconda.org/conda-forge/shapely

.. Coverage

.. |coveralls| image:: https://coveralls.io/repos/github/shapely/shapely/badge.svg?branch=main
   :target: https://coveralls.io/github/shapely/shapely?branch=main

.. Zenodo

.. .. image:: https://zenodo.org/badge/191151963.svg
..   :alt: Zenodo
..   :target: https://zenodo.org/badge/latestdoi/191151963

Manipulation and analysis of geometric objects in the Cartesian plane.

.. image:: https://c2.staticflickr.com/6/5560/31301790086_b3472ea4e9_c.jpg
   :width: 800
   :height: 378

Shapely is a BSD-licensed Python package for manipulation and analysis of
planar geometric objects. It is using the widely deployed open-source
geometry library `GEOS `__ (the engine of `PostGIS
`__, and a port of `JTS `__).
Shapely wraps GEOS geometries and operations to provide both a feature rich
`Geometry` interface for singular (scalar) geometries and higher-performance
NumPy ufuncs for operations using arrays of geometries.
Shapely is not primarily focused on data serialization formats or coordinate
systems, but can be readily integrated with packages that are.

What is a ufunc?
----------------

A universal function (or ufunc for short) is a function that operates on
*n*-dimensional arrays on an element-by-element fashion and supports array
broadcasting. The underlying ``for`` loops are implemented in C to reduce the
overhead of the Python interpreter.

Multithreading
--------------

Shapely functions generally support multithreading by releasing the Global
Interpreter Lock (GIL) during execution. Normally in Python, the GIL prevents
multiple threads from computing at the same time. Shapely functions
internally release this constraint so that the heavy lifting done by GEOS can
be done in parallel, from a single Python process.

Usage
=====

Here is the canonical example of building an approximately circular patch by
buffering a point, using the scalar Geometry interface:

.. code-block:: pycon

    >>> from shapely import Point
    >>> patch = Point(0.0, 0.0).buffer(10.0)
    >>> patch
    
    >>> patch.area
    313.6548490545941

Using the vectorized ufunc interface (instead of using a manual for loop),
compare an array of points with a polygon:

.. code:: python

    >>> import shapely
    >>> import numpy as np
    >>> geoms = np.array([Point(0, 0), Point(1, 1), Point(2, 2)])
    >>> polygon = shapely.box(0, 0, 2, 2)

    >>> shapely.contains(polygon, geoms)
    array([False,  True, False])

See the documentation for more examples and guidance: https://shapely.readthedocs.io

Requirements
============

Shapely 2.2 requires

* Python >=3.10
* GEOS >=3.10
* NumPy >=1.21

Installing Shapely
==================

We recommend installing Shapely using one of the available built
distributions, for example using ``pip`` or ``conda``:

.. code-block:: console

    $ pip install shapely
    # or using conda
    $ conda install shapely --channel conda-forge

See the `installation documentation `__
for more details and advanced installation instructions.

Integration
===========

Shapely does not read or write data files, but it can serialize and deserialize
using several well known formats and protocols. The shapely.wkb and shapely.wkt
modules provide dumpers and loaders inspired by Python's pickle module.

.. code-block:: pycon

    >>> from shapely.wkt import dumps, loads
    >>> dumps(loads('POINT (0 0)'))
    'POINT (0.0000000000000000 0.0000000000000000)'

Shapely can also integrate with other Python GIS packages using GeoJSON-like
dicts.

.. code-block:: pycon

    >>> import json
    >>> from shapely.geometry import mapping, shape
    >>> s = shape(json.loads('{"type": "Point", "coordinates": [0.0, 0.0]}'))
    >>> s
    
    >>> print(json.dumps(mapping(s)))
    {"type": "Point", "coordinates": [0.0, 0.0]}

Support
=======

Questions about using Shapely may be asked on the `GIS StackExchange
`__ using the "shapely"
tag.

Bugs may be reported at https://github.com/shapely/shapely/issues.

Copyright & License
===================

Shapely is licensed under BSD 3-Clause license.
GEOS is available under the terms of GNU Lesser General Public License (LGPL) 2.1 at https://libgeos.org.

Owner

  • Name: shapely
  • Login: shapely
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
message: "Please cite this software using these metadata."
type: software
title: Shapely
version: "2.1.1"
date-released: "2025-05-19"
doi: 10.5281/zenodo.5597138
abstract: "Manipulation and analysis of geometric objects in the Cartesian plane."
repository-artifact: https://pypi.org/project/Shapely
repository-code: https://github.com/shapely/shapely
license: "BSD-3-Clause"
authors:
  - given-names: Sean
    family-names: Gillies
    orcid: https://orcid.org/0000-0002-8401-9184
  - given-names: Casper
    family-names: "van der Wel"
    orcid: https://orcid.org/0000-0002-0488-2237
  - given-names: Joris
    family-names: "Van den Bossche"
    orcid: https://orcid.org/0000-0003-3284-2977
  - given-names: "Mike W."
    family-names: Taves
    orcid: https://orcid.org/0000-0003-3657-7963
  - given-names: Joshua
    family-names: Arnott
  - given-names: "Brendan C."
    family-names: Ward
    orcid: https://orcid.org/0000-0002-0813-9774
  - name: others
keywords:
  - cartography
  - geometry
  - GEOS
  - GIS
  - topology

GitHub Events

Total
  • Create event: 16
  • Release event: 3
  • Issues event: 136
  • Watch event: 328
  • Delete event: 11
  • Issue comment event: 434
  • Push event: 84
  • Gollum event: 3
  • Pull request review comment event: 73
  • Pull request review event: 129
  • Pull request event: 159
  • Fork event: 37
Last Year
  • Create event: 16
  • Release event: 3
  • Issues event: 136
  • Watch event: 328
  • Delete event: 11
  • Issue comment event: 434
  • Push event: 84
  • Gollum event: 3
  • Pull request review comment event: 73
  • Pull request review event: 129
  • Pull request event: 159
  • Fork event: 37

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 2,081
  • Total Committers: 170
  • Avg Commits per committer: 12.241
  • Development Distribution Score (DDS): 0.651
Past Year
  • Commits: 125
  • Committers: 28
  • Avg Commits per committer: 4.464
  • Development Distribution Score (DDS): 0.664
Top Committers
Name Email Commits
Sean Gillies s****s@g****m 726
Joris Van den Bossche j****e@g****m 308
Casper van der Wel c****w@g****m 264
Mike Taves m****s@g****m 183
Joshua Arnott j****h@s****t 76
Brendan Ward b****d@a****m 46
Oliver Tonnhofer o****t@b****m 44
dependabot[bot] 4****] 37
Jacob Wasserman j****n@g****m 24
Aron Bierbaum a****m@g****m 18
Pieter Roggemans p****s@g****m 16
Tom Caruso c****2@g****m 16
Idan Miara i****n@m****m 14
Allan Adair a****r@g****m 13
Martin Fleischmann m****n@m****t 9
Johannes Schönberger j****r@d****e 9
Hannes k****s 8
georgeouzou g****k@g****m 7
Thibault Deutsch t****h@g****m 7
Erwin Sterrenburg e****g@g****m 6
Phil Elson p****b@g****m 6
Ariel Kadouri a****l@a****m 5
Gabi Davar g****o@g****m 5
Pierre PACI v****t@g****m 5
Krishna Chaitanya b****4@g****m 5
Kevin Wurster w****k@g****m 5
Jeremiah England 3****d 5
Howard Butler h****c@g****m 5
Chad Hawkins c****h@c****m 5
Ben Beasley c****e@m****t 5
and 140 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 338
  • Total pull requests: 548
  • Average time to close issues: 10 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 243
  • Total pull request authors: 67
  • Average comments per issue: 3.78
  • Average comments per pull request: 2.57
  • Merged pull requests: 434
  • Bot issues: 1
  • Bot pull requests: 68
Past Year
  • Issues: 72
  • Pull requests: 190
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 11 days
  • Issue authors: 61
  • Pull request authors: 24
  • Average comments per issue: 2.38
  • Average comments per pull request: 1.54
  • Merged pull requests: 140
  • Bot issues: 1
  • Bot pull requests: 26
Top Authors
Issue Authors
  • jorisvandenbossche (25)
  • mwtoews (13)
  • sgillies (11)
  • theroggy (6)
  • martinfleis (5)
  • idanmiara (5)
  • DOSull (4)
  • RichardBowenGM (3)
  • hahaha1213817 (3)
  • kylebarron (3)
  • JuriaanSioux (3)
  • GeorgySk (3)
  • jobh (2)
  • Zaczero (2)
  • MatthieuMillequant (2)
Pull Request Authors
  • jorisvandenbossche (186)
  • mwtoews (109)
  • dependabot[bot] (70)
  • theroggy (32)
  • idanmiara (19)
  • caspervdw (11)
  • martinfleis (10)
  • sgillies (9)
  • brendan-ward (5)
  • quassy (4)
  • musicinmybrain (4)
  • rgangopadhya (3)
  • sea-bass (3)
  • EwoutH (3)
  • Oreilles (3)
Top Labels
Issue Labels
geos (34) upstream bug (30) bug (20) release (13) documentation (10) enhancement (8) shapely-1.8 (7) good first issue (7) needs info (5) needs discussion (5) shapely 2.0 (3) wontfix (2) decision (1) dependencies (1) duplicate (1) packaging (1) performance (1) windows (1) admin (1) security (1) floating point precision (1)
Pull Request Labels
dependencies (70) github_actions (13) deprecation (12) documentation (5) enhancement (2) performance (2) release (2) bug (2) wontfix (1)

Packages

  • Total packages: 5
  • Total downloads:
    • pypi 54,655,052 last-month
  • Total docker downloads: 31,142,036
  • Total dependent packages: 1,670
    (may contain duplicates)
  • Total dependent repositories: 9,590
    (may contain duplicates)
  • Total versions: 163
  • Total maintainers: 5
pypi.org: shapely

Manipulation and analysis of geometric objects

  • Versions: 129
  • Dependent Packages: 1,400
  • Dependent Repositories: 7,674
  • Downloads: 54,655,014 Last month
  • Docker Downloads: 31,142,036
Rankings
Dependent packages count: 0.0%
Downloads: 0.1%
Dependent repos count: 0.1%
Docker downloads count: 0.6%
Average: 0.9%
Stargazers count: 1.8%
Forks count: 2.9%
Maintainers (3)
Last synced: 6 months ago
spack.io: py-shapely

Manipulation and analysis of geometric objects in the Cartesian plane.

  • Versions: 6
  • Dependent Packages: 12
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 2.5%
Dependent packages count: 5.1%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: shapely
  • Versions: 17
  • Dependent Packages: 234
  • Dependent Repositories: 958
Rankings
Dependent packages count: 0.3%
Dependent repos count: 0.8%
Average: 3.8%
Stargazers count: 7.0%
Forks count: 7.2%
Last synced: 6 months ago
anaconda.org: shapely

Shapely is a BSD-licensed Python package for manipulation and analysis of planar geometric objects.

  • Versions: 10
  • Dependent Packages: 24
  • Dependent Repositories: 958
Rankings
Dependent packages count: 1.2%
Dependent repos count: 4.8%
Average: 8.8%
Stargazers count: 14.2%
Forks count: 14.9%
Last synced: 6 months ago
pypi.org: shapely-cellvit

Geometric objects, predicates, and operations

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 38 Last month
Rankings
Dependent packages count: 10.7%
Average: 35.5%
Dependent repos count: 60.2%
Maintainers (1)
Last synced: 6 months ago

Dependencies

setup.py pypi
  • numpy >=1.13
.github/workflows/lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pre-commit/action v3.0.0 composite
.github/workflows/release.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/create-release v1 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • actions/upload-release-asset v1 composite
  • ilammy/msvc-dev-cmd v1 composite
  • pypa/cibuildwheel v2.11.4 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/tests.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ilammy/msvc-dev-cmd v1 composite
pyproject.toml pypi
  • numpy >=1.14
docs/environment.yml pypi