Professional Documents
Culture Documents
Release 0.1.0
Benjamin Trigona-Harany
1 Installation 3
1.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Python Package Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Basic usage 5
2.1 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Geometry subclasses 9
3.1 Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.4 SRIDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.5 Dimensionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.6 Performance considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4 PL/Python 13
4.1 Enabling PL/Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 Function declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Type mappings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4 Arrays and sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.5 Shared data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.6 plpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.7 Aggregate functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5 Examples 19
5.1 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2 External services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.3 Rendering output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.4 Spatial aggregate function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6 plpygis package 23
i
ii
plpygis Documentation, Release 0.1.0
plpygis is a Python conveter to and from the PostGIS geometry type, WKB, EWKB, GeoJSON and Shapely
geometries and additionally supports __geo_interface__. plpygis is intended for use in PL/Python functions.
Contents: 1
plpygis Documentation, Release 0.1.0
2 Contents:
CHAPTER 1
Installation
1.1 Requirements
plpygis has no dependencies beyond an installation of Python 2.7.x or 3.6.x. Additionally, plpygis can use
Shapely (version 1.6 or greater) if available. Without it, conversion to and from Shapely geometries will be impossible.
It is recommended that plpygis is installed into the system installation of Python or it may not be available in
PL/Python functions.
1.3 Source
The package sources are available at https://github.com/bosth/plpygis. Building and installing plpygis from source
can be done with setuptools:
1.3.1 Tests
3
plpygis Documentation, Release 0.1.0
1.3.2 Documentation
Building the documentation from source requires Sphinx. By default, the documentation will be rendered in HTML:
For other documentation output formats, see the options in the docs subdirectory:
$ cd docs
$ make
4 Chapter 1. Installation
CHAPTER 2
Basic usage
plpygis is a Python conveter to and from the PostGIS geometry type, WKB, EWKB, GeoJSON, Shapely geome-
tries and any object that supports __geo_interface__. plpygis is intended for use in PL/Python, allowing
procedural Python code to complement PostGIS types and functions.
2.1 Geometry
New Geometry instances can be created using a Well-Known Binary (WKB) representation of the geometry.
2.1.1 Creation
The shape() method can convert from any instance that provides __geo_interface__ (see A Python Protocol
for Geospatial Data).
An optional srid keyword argument may be used with any of the above to set the geometry’s SRID. If the represen-
tation already provides an SRID (such as with some Shapely geometries) or implies a particular SRID (GeoJSON), it
will be overridden by the user-specified value.
5
plpygis Documentation, Release 0.1.0
Every Geometry has a type that can be accessed using the instance’s type property. The following geometry types
are supported:
• Point
• LineString
• Polygon
• MultiPoint
• MultiLineString
• MultiPolygon
• GeometryCollection
The following EWKB types are not supported:
• Unknown
• CircularString
• CompoundCurve
• CurvePolygon
• MultiCurve
• MultiSurface
• PolyhedralSurface
• Triangle
• Tin
2.1.3 Conversion
Geometry instances can also be converted to other representations using the following properties:
• geojson
• shapely
• wkb
2.2 Exceptions
All plpygis exceptions inherit from the PlpygisError class. The specific exceptions that may be raised are:
2.2. Exceptions 7
plpygis Documentation, Release 0.1.0
Geometry subclasses
Creating a new plpygis geometry from a WKB, GeoJSON or Shapely instance, will produce a new subclass of the
base Geometry class:
• Point
• LineString
• Polygon
• MultiPoint
• LineString
• MultiPolygon
• GeometryCollection
3.1 Creation
New instances of the three base shapes (points, lines and polygons) may be created by passing in coordinates:
3.2 Editing
9
plpygis Documentation, Release 0.1.0
3.3 Composition
Individual LineString instances are composed of a list of Point instances that each represent a vertex in the line.
Similarly, Polygon instances are composed of a list of LineString instances that each represent linear rings.
The lists of vertices or linear rings can be modified, for example by adding a new Point to the end of a LineString.
Note: The first linear ring in a polygon should represent the exterior ring, while subsequent linear rings are internal
boundaries. plpygis will not validate geometries when they are created.
The four collection types, MultiPoint, LineString, MultiPolygon and GeometryCollection, are each
composed of a list of other geometries of the appropriate type. At creation time, the collection types are created by
passing in a list of existing instances:
3.4 SRIDs
plpygis will detect conflicts when multigeometries or collections are created with mixed SRIDs.
Warning: Changing the SRID of an instance that is part of another geometry (such as a Point that is a vertex in
a LineString or a vertex in the linear ring of a Polygon) will not be detected. When converted to a WKB or
Shapely instance, only the SRID of the “parent” geometry will be used.
3.5 Dimensionality
The dimz and dimm boolean parameters will indicate whether the geometry will have Z and M dimensions.
plpygis will attempt to match provided coordinates with the requested dimensions or will set them to an initial
value of 0 if they have not been provided:
The dimensionality of an existing instance may be altered after creation, by setting dimz or dimm. Adding a dimen-
sion will add a Z or M coordinate with an initial value of 0 to the geometry and all geometries encompassed within it
(e.g., each vertex in a LineString or each Point in a MultiPoint will gain the new dimension).
A new dimension may also be added to a single Point by assigning to the z or m properties.
Adding a new dimension to a Point that is a vertex in a LineString or a vertex in the linear ring of a Polygon
will not change the dimensionality of the LineString or the Polygon. The dimensionality of “parent” instance
must also be changed for the new coordinates to be reflected when converting to other representations.
plpygis uses native WKB parsing to extract header information that indicates the geometry type, SRID and the
presence of a Z or M dimension. Full parsing of the entire geometry only occurs when needed. It is therefore possible
to test the type and dimensionality of a Geometry with only the first few bytes of data having been read. Perform
these checks before performing any action that will require reading the remainder of the WKB.
3.6.2 Caching
plpygis will cache the initial WKB it was created from. As soon as any coordinates or composite geometries are
referenced, the cached WKB is lost and a subsequent request that requires the WKB will necessitate it being generated
from scratch. For sets of large geometries, this can have a noticeable affect on performance. Therefore, if doing a
conversion to a Shapely geometry - an action which relies on the availability of the WKB - it is recommended that this
conversion be done before any other operations on the plpygis geometry.
Note: Getting type, srid, dimz and dimm are considered “safe” operations. However writing a new SRID or
changing the dimensionality will also result in the cached WKB being lost. A geometry’s type may never be changed.
PL/Python
Warning: PL/Python is an “untrusted” language, meaning that Python code will have unrestricted access to the
system at the same level as the database administrator.
plpygis is compatible with both Python 2 and Python 3. plpythonu, however, always refers to Python 2 in
PostgreSQL. For Python 3, the language is plpython3u (Python 2 can also explicitly be used with plpython2u).
13
plpygis Documentation, Release 0.1.0
Named arguments are provided as a comma-separated list, with the argument name preceding the argument type:
The mapping between types in PL/Python and is PostgreSQL is covered in the Data Values section of the documenta-
tion; it is the role of plpygis to assist in mapping between PL/Python and PostGIS types.
When authoring a Postgres function that takes a PostGIS geometry as an input parameter or returns a geometry as
output, Geometry objects will provide the automatic conversion between types.
Input parameter
A PostGIS geometry passed as the argument to Geometry() will initialize the instance.
if lon < 0:
return "West"
elif lon > 0:
return "East"
else:
return "Meridian"
$$ LANGUAGE plpythonu;
14 Chapter 4. PL/Python
plpygis Documentation, Release 0.1.0
Return value
Both PostGIS geometry and geography types may be used as arguments or return types. plpygis does not
support box2d, box3d, raster or any topology types.
geometry and geography arguments will be treated identically by plpygis, as they share an common WKB
format.
However, a PL/Python function that has a return value of geography must not have an SRID of any value except
4326. It will also be treated differently by certain PostGIS functions.
Imagine two PL/Python functions that both create a polygon with lower-left coordinates at (0, 0) and upper-right
coordinates at (50, 50). If box_geom has a return type of geometry and box_geog has a return type of
geography, area calculations will be evaluated as follows:
In addition to returning single values, plpygis functions may return a list of geometries that can be either interpreted
as a PostgreSQL array or set.
Python’s yield keyword may also be used to return elements in a set rather than returning them as elements in a list.
Each PL/Python function has access to a shared dictionary SD that can be used to store data between function calls.
As with other data, plpygis.Geometry instances may be stored in the SD dictionary for future reference in later
function calls.
4.6 plpy
The plpy module provides access to helper functions, notably around logging to PostgreSQL’s standard log files.
See Utility Functions in the PostgreSQL documentation.
16 Chapter 4. PL/Python
plpygis Documentation, Release 0.1.0
PostGIS includes several spatial aggregate functions that accept a set of geometries as input parameters. An aggregate
function definition requires different syntax from a normal PL/Python function:
An aggregate will accept individual inputs of the type defined by BASETYPE and incrementally producing a single
type defined by STYPE. If many geometries will be collapsed down to a single geometry, then both BASETYPE
and STYPE will be geometry. If many geometries will produce more than one geometry, then the types will be
geometry and geometry[] respectively.
An example aggregate function would be point_cluster, which takes n input geometries and outputs m geome-
tries, where m < n.
The function indicated by SFUNC must accept the STYPE as the first parameter and BASETYPE as the second pa-
rameter, returning another instance of STYPE. If INITCOND is provided, this will be the value of the first argument
passed to the first call of SFUNC. If it is omitted, the value will be initially set to None.
Alternatively, the SFUNC can simply collect all the individual geometries into a list and then rely on a single
FINALFUNC to create a new list of geometries that represents the clustered points.
The parameter of the FINALFUNC will be a single geometry[], representing the collection of individual points.
18 Chapter 4. PL/Python
CHAPTER 5
Examples
5.1 Conversion
Some functions that analyze or manipulate geometries are possible in SQL but are easier to model in a procedural
language. The following example will use Shapely to find the largest component polygon of a multipolygon.
19
plpygis Documentation, Release 0.1.0
Another application of plpygis is accessing external services or commands directly from PostgreSQL.
nominatim = Nominatim()
location = nominatim.reverse((lat, lon))
return location.address
$$ LANGUAGE plpythonu;
The gj2ascii project allows geometries to be easily rendered with a PL/Python function.
20 Chapter 5. Examples
plpygis Documentation, Release 0.1.0
+ + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + ++
+ + + + + + + + + + + + + + ++
+ + + + + + + + + + + + + ++
+ + + + + + + + + + +
+ + + + +
(1 row)
Normally, the function show as defined above would print the geometries of individual rows, one each per line.
An aggregate version of show would take all the geometries and print them as a single map.
(1 row)
The STYPE of geometry[] indicates that after each individual geometry has been processed, there will be a
PostgreSQL list of individual geometry objects as a result. INITCOND is used to ensure that list starts empty and
can be added to incrementally by the native PostgreSQL function array_append.
The function _final_geom_show will take the STYPE as the single parameter:
PL/Python automatically maps lists to Python arrays, so plpygis is only responsible for converting each elment of
the list (in the example, above this is done using list comprehension: [Geometry(g) for g in geoms]).
22 Chapter 5. Examples
CHAPTER 6
plpygis package
class plpygis.geometry.Geometry
Bases: object
A representation of a PostGIS geometry.
PostGIS geometries are either an OpenGIS Consortium Simple Features for SQL specification type or a PostGIS
extended type. The object’s canonical form is stored in WKB or EWKB format along with an SRID and flags
indicating whether the coordinates are 3DZ, 3DM or 4D.
Geometry objects can be created in a number of ways. In all cases, a subclass for the particular geometry type
will be instantiated.
From an (E)WKB:
>>> Geometry("0101000080000000000000000000000000000000000000000000000000")
<Point: 'geometry(PointZ)'>
The response above indicates an instance of the Point class has been created and that it represents a PostGIS
geometry(PointZ) type.
From a GeoJSON:
23
plpygis Documentation, Release 0.1.0
>>> Geometry.shape(feature)
<LineString: 'geometry(LineString)'>
A Geometry can be read as long as it is one of the following types: Point, LineString, Polygon,
MultiPoint, MultiLineString, MultiPolygon or GeometryCollection. The M dimension will
be preserved.
static from_geojson(geojson, srid=4326)
Create a Geometry from a GeoJSON. The SRID can be overridden from the expected 4326.
static from_shapely(sgeom, srid=None)
Create a Geometry from a Shapely geometry and the specified SRID.
The Shapely geometry will not be modified.
static shape(shape, srid=None)
Create a Geometry using __geo_interface__ and the specified SRID.
type
The geometry type.
srid
The geometry SRID.
geojson
Get the geometry as a GeoJSON dict. There is no check that the GeoJSON is using an SRID of 4326.
wkb
Get the geometry as an (E)WKB.
shapely
Get the geometry as a Shapely geometry. If the geometry has an SRID, the Shapely object will be created
with it set.
bounds
Get the minimum and maximum extents of the geometry: (minx, miny, maxx, maxy).
postgis_type
Get the type of the geometry in PostGIS format, including additional dimensions and SRID if they exist.
class plpygis.geometry.Point(coordinates=None, srid=None, dimz=False, dimm=False)
Bases: plpygis.geometry.Geometry
A representation of a PostGIS Point.
Point objects can be created directly.
The dimz and dimm parameters will indicate how to interpret the coordinates that have been passed as the first
argument. By default, the third coordinate will be interpreted as representing the Z dimension.
x
X coordinate.
y
M coordinate.
z
Z coordinate.
m
M coordinate.
dimz
Whether the geometry has a Z dimension.
Getter True if the geometry has a Z dimension.
Setter Add or remove the Z dimension.
Return type bool
dimm
Whether the geometry has an M dimension.
Getter True if the geometry has an M dimension.
Setter Add or remove the M dimension.
Return type bool
bounds
Get the minimum and maximum extents of the geometry: (minx, miny, maxx, maxy).
from_geojson(geojson, srid=4326)
Create a Geometry from a GeoJSON. The SRID can be overridden from the expected 4326.
from_shapely(sgeom, srid=None)
Create a Geometry from a Shapely geometry and the specified SRID.
The Shapely geometry will not be modified.
geojson
Get the geometry as a GeoJSON dict. There is no check that the GeoJSON is using an SRID of 4326.
postgis_type
Get the type of the geometry in PostGIS format, including additional dimensions and SRID if they exist.
shape(shape, srid=None)
Create a Geometry using __geo_interface__ and the specified SRID.
shapely
Get the geometry as a Shapely geometry. If the geometry has an SRID, the Shapely object will be created
with it set.
srid
The geometry SRID.
type
The geometry type.
wkb
Get the geometry as an (E)WKB.
class plpygis.geometry.LineString(vertices=None, srid=None, dimz=False, dimm=False)
Bases: plpygis.geometry.Geometry
A representation of a PostGIS Line.
LineString objects can be created directly.
25
plpygis Documentation, Release 0.1.0
The dimz and dimm parameters will indicate how to interpret the coordinates that have been passed as the first
argument. By default, the third coordinate will be interpreted as representing the Z dimension.
vertices
List of vertices that comprise the line.
dimz
Whether the geometry has a Z dimension.
Getter True if the geometry has a Z dimension.
Setter Add or remove the Z dimension from this and all vertices in the line.
Return type bool
dimm
Whether the geometry has a M dimension.
Getter True if the geometry has a M dimension.
Setter Add or remove the M dimension from this and all vertices in the line.
Return type bool
bounds
Get the minimum and maximum extents of the geometry: (minx, miny, maxx, maxy).
from_geojson(geojson, srid=4326)
Create a Geometry from a GeoJSON. The SRID can be overridden from the expected 4326.
from_shapely(sgeom, srid=None)
Create a Geometry from a Shapely geometry and the specified SRID.
The Shapely geometry will not be modified.
geojson
Get the geometry as a GeoJSON dict. There is no check that the GeoJSON is using an SRID of 4326.
postgis_type
Get the type of the geometry in PostGIS format, including additional dimensions and SRID if they exist.
shape(shape, srid=None)
Create a Geometry using __geo_interface__ and the specified SRID.
shapely
Get the geometry as a Shapely geometry. If the geometry has an SRID, the Shapely object will be created
with it set.
srid
The geometry SRID.
type
The geometry type.
wkb
Get the geometry as an (E)WKB.
class plpygis.geometry.Polygon(rings=None, srid=None, dimz=False, dimm=False)
Bases: plpygis.geometry.Geometry
A representation of a PostGIS Polygon.
Polygon objects can be created directly.
>>> Polygon([[(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0), (0, 0, 0)]])
<Polygon: 'geometry(PolygonZ)'>
The first polygon in the list of linear rings is the exterior ring, while any subsequent rings are interior boundaries.
The dimz and dimm parameters will indicate how to interpret the coordinates that have been passed as the first
argument. By default, the third coordinate will be interpreted as representing the Z dimension.
rings
List of linearrings that comprise the polygon.
exterior
The exterior ring of the polygon.
interior
A list of interior rings of the polygon.
dimz
Whether the geometry has a Z dimension.
Getter True if the geometry has a Z dimension.
Setter Add or remove the Z dimension from this and all linear rings in the polygon.
Return type bool
dimm
Whether the geometry has a M dimension.
Getter True if the geometry has a M dimension.
Setter Add or remove the M dimension from this and all linear rings in the polygon.
Return type bool
bounds
Get the minimum and maximum extents of the geometry: (minx, miny, maxx, maxy).
from_geojson(geojson, srid=4326)
Create a Geometry from a GeoJSON. The SRID can be overridden from the expected 4326.
from_shapely(sgeom, srid=None)
Create a Geometry from a Shapely geometry and the specified SRID.
The Shapely geometry will not be modified.
geojson
Get the geometry as a GeoJSON dict. There is no check that the GeoJSON is using an SRID of 4326.
postgis_type
Get the type of the geometry in PostGIS format, including additional dimensions and SRID if they exist.
shape(shape, srid=None)
Create a Geometry using __geo_interface__ and the specified SRID.
shapely
Get the geometry as a Shapely geometry. If the geometry has an SRID, the Shapely object will be created
with it set.
srid
The geometry SRID.
type
The geometry type.
27
plpygis Documentation, Release 0.1.0
wkb
Get the geometry as an (E)WKB.
class plpygis.geometry.MultiPoint(points=None, srid=None)
Bases: plpygis.geometry._MultiGeometry
A representation of a PostGIS MultiPoint.
MultiPoint objects can be created directly from a list of Point objects.
wkb
Get the geometry as an (E)WKB.
points
List of all component points.
geometries
List of all component points.
class plpygis.geometry.MultiLineString(linestrings=None, srid=None)
Bases: plpygis.geometry._MultiGeometry
A representation of a PostGIS MultiLineString
MultiLineString objects can be created directly from a list of LineString objects.
29
plpygis Documentation, Release 0.1.0
srid
The geometry SRID.
type
The geometry type.
wkb
Get the geometry as an (E)WKB.
linestrings
List of all component lines.
geometries
List of all component lines.
class plpygis.geometry.MultiPolygon(polygons=None, srid=None, dimz=False, dimm=False)
Bases: plpygis.geometry._MultiGeometry
A representation of a PostGIS MultiPolygon.
MultiPolygon objects can be created directly from a list of Polygon objects.
>>> p1 = Polygon([[(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]], srid=4326)
>>> p2 = Polygon([[(2, 2), (3, 2), (3, 3), (2, 3), (2, 2)]], srid=4326)
>>> MultiPolygon([p1, p2])
<MultiPolygon: 'geometry(MultiPolygon,4326)'>
shape(shape, srid=None)
Create a Geometry using __geo_interface__ and the specified SRID.
shapely
Get the geometry as a Shapely geometry. If the geometry has an SRID, the Shapely object will be created
with it set.
srid
The geometry SRID.
type
The geometry type.
wkb
Get the geometry as an (E)WKB.
polygons
List of all component polygons.
geometries
List of all component polygons.
class plpygis.geometry.GeometryCollection(geometries=None, srid=None, dimz=False,
dimm=False)
Bases: plpygis.geometry._MultiGeometry
A representation of a PostGIS GeometryCollection.
GeometryCollection objects can be created directly from a list of geometries, including other collections.
31
plpygis Documentation, Release 0.1.0
geojson
Get the geometry as a GeoJSON dict. There is no check that the GeoJSON is using an SRID of 4326.
postgis_type
Get the type of the geometry in PostGIS format, including additional dimensions and SRID if they exist.
shape(shape, srid=None)
Create a Geometry using __geo_interface__ and the specified SRID.
shapely
Get the geometry as a Shapely geometry. If the geometry has an SRID, the Shapely object will be created
with it set.
srid
The geometry SRID.
type
The geometry type.
wkb
Get the geometry as an (E)WKB.
geometries
List of all component geometries.
exception plpygis.exceptions.PlpygisError(msg)
Bases: exceptions.Exception
Basic exception for plpygis.
exception plpygis.exceptions.DependencyError(dep, msg=None)
Bases: plpygis.exceptions.PlpygisError, exceptions.ImportError
Exception for a missing dependency.
exception plpygis.exceptions.WkbError(msg=None)
Bases: plpygis.exceptions.PlpygisError
Exception for problems in parsing WKBs.
exception plpygis.exceptions.DimensionalityError(msg=None)
Bases: plpygis.exceptions.PlpygisError
Exception for problems in dimensionality of geometries.
exception plpygis.exceptions.SridError(msg=None)
Bases: plpygis.exceptions.PlpygisError
Exception for problems in dimensionality of geometries.
p
plpygis.exceptions, 32
plpygis.geometry, 23
33
plpygis Documentation, Release 0.1.0
35
plpygis Documentation, Release 0.1.0
P T
type (plpygis.geometry.Geometry attribute), 24
plpygis.exceptions (module), 32
type (plpygis.geometry.GeometryCollection attribute), 32
plpygis.geometry (module), 23
type (plpygis.geometry.LineString attribute), 26
PlpygisError, 32
type (plpygis.geometry.MultiLineString attribute), 30
Point (class in plpygis.geometry), 24
type (plpygis.geometry.MultiPoint attribute), 28
points (plpygis.geometry.MultiPoint attribute), 29
type (plpygis.geometry.MultiPolygon attribute), 31
Polygon (class in plpygis.geometry), 26
type (plpygis.geometry.Point attribute), 25
polygons (plpygis.geometry.MultiPolygon attribute), 31
type (plpygis.geometry.Polygon attribute), 27
postgis_type (plpygis.geometry.Geometry attribute), 24
postgis_type (plpygis.geometry.GeometryCollection at- V
tribute), 32
postgis_type (plpygis.geometry.LineString attribute), 26 vertices (plpygis.geometry.LineString attribute), 26
postgis_type (plpygis.geometry.MultiLineString at-
tribute), 29
W
postgis_type (plpygis.geometry.MultiPoint attribute), 28 wkb (plpygis.geometry.Geometry attribute), 24
postgis_type (plpygis.geometry.MultiPolygon attribute), wkb (plpygis.geometry.GeometryCollection attribute), 32
30 wkb (plpygis.geometry.LineString attribute), 26
postgis_type (plpygis.geometry.Point attribute), 25 wkb (plpygis.geometry.MultiLineString attribute), 30
postgis_type (plpygis.geometry.Polygon attribute), 27 wkb (plpygis.geometry.MultiPoint attribute), 28
wkb (plpygis.geometry.MultiPolygon attribute), 31
R wkb (plpygis.geometry.Point attribute), 25
rings (plpygis.geometry.Polygon attribute), 27 wkb (plpygis.geometry.Polygon attribute), 27
WkbError, 32
S X
shape() (plpygis.geometry.Geometry static method), 24
x (plpygis.geometry.Point attribute), 24
shape() (plpygis.geometry.GeometryCollection method),
32
shape() (plpygis.geometry.LineString method), 26
Y
shape() (plpygis.geometry.MultiLineString method), 29 y (plpygis.geometry.Point attribute), 24
shape() (plpygis.geometry.MultiPoint method), 28
shape() (plpygis.geometry.MultiPolygon method), 30 Z
shape() (plpygis.geometry.Point method), 25 z (plpygis.geometry.Point attribute), 24
shape() (plpygis.geometry.Polygon method), 27
shapely (plpygis.geometry.Geometry attribute), 24
36 Index