Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fitodic committed Sep 13, 2019
1 parent fd76026 commit ca7bb1f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/chapters/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ the polygon (i.e. do not intersect the polygon's boundary). In that
case, the output centerline can be reduced to a single line or even a
single point.

When the centerline consists of less than two lines, a ``RuntimeError``
When the centerline consists of less than two lines, the ``TooFewRidgesError``
is raised, the ``create_centerline`` script skips the geometry in
question and continues processing the other geometries.
16 changes: 14 additions & 2 deletions docs/chapters/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,20 @@ This library provides the ``create_centerlines`` command-line script for creatin
Python
======

If you want to create your own scripts or use the ``Centerline`` class directly, you can import it:
If you want to use the ``Centerline`` class directly, you can import it and instatiate it with geometric data (of type ``shapely.geometry.Polygon`` or ``shapely.geometry.MultiPolygon``) and the object's attributes (optional):

.. code:: python
from centerline.geometry import Centerline
>>> from shapely.geometry import Polygon
>>> from centerline.geometry import Centerline
>>> polygon = Polygon([[0, 0], [0, 4], [4, 4], [4, 0]])
>>> attributes = {"id": 1, "name": "polygon", "valid": True}
>>> centerline = Centerline(polygon, **attributes)
>>> centerline.id == 1
True
>>> centerline.name
'polygon'
>>> centerline.geoms
<shapely.geometry.base.GeometrySequence object at 0x7f7d24116210>
2 changes: 1 addition & 1 deletion docs/modules/centerline.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
centerline's API
API
==================

Module contents
Expand Down

0 comments on commit ca7bb1f

Please sign in to comment.