File: design.rst

package info (click to toggle)
python-shapely 2.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,528 kB
  • sloc: python: 18,648; ansic: 6,615; makefile: 88; sh: 62
file content (29 lines) | stat: -rw-r--r-- 1,411 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
============
Design Notes
============

Shapely provides classes that implement, more or less, the interfaces in the
OGC's simple feature access specification [1]_. The classes are defined in
similarly named modules under ``shapely.geometry``: ``Point`` is in
``shapely.geometry.point``, ``MultiPolygon`` is in
``shapely.geometry.multipolygon``. These classes derive from
``shapely.geometry.base.BaseGeometry``. The simple features methods of
``BaseGeometry`` call functions registered in a class variable ``impl``. For
example, ``BaseGeometry.area`` calls ``BaseGeometry.impl['area']``.

The default registry is in the ``shapely.impl`` module. Its items are classes
that operate on single geometric objects or pairs of geometric objects.
Pluggability is a goal of this design, but we're not there yet. Some work needs
to be done before anybody can use CGAL as a Shapely backend.

In sum, Shapely's stack is 4 layers:

* Python geometry classes in ``shapely.geometry``
* An implementation registry: an abstraction that permits alternate geometry
  engines, even a mix of geometry engines. The default is in ``shapely.impl``.
* The GEOS implementations of methods for the registry in ``shapely.geos``.
* libgeos: algorithms written in C++.

.. [1] John R. Herring, Ed.,
   “OpenGIS Implementation Specification for Geographic information - Simple
   feature access - Part 1: Common architecture,” Oct. 2006.