The different PostGIS geometry object types are modeled by PPyGIS as Python classes. Methods provided by their common base class ppygis.Geometry allow Psycopg to transparently translate between the EWKB representation used when communicating with the database and Python objects.
This is the base class of all geometry objects. It provides common serialization and geometry access methods and must not be instantiated directly.
Serialization
Converts geometry from its EWKB representation to Python objects.
This method is called by Psycopg to convert geometry retrieved from the database. It can also be used to interpret data obtained using the PostgreSQL COPY TO bulk download command.
Converts geometry from Python objects to its EWKB representation.
This method can be used to prepare data for the PostgreSQL COPY FROM bulk upload command.
Converts geometry from Python objects to its EWKB representation and encloses the results in quotes.
This method is called by Psycopg to convert geometry sent to the database.
Geometry
The SRID of the geometry object if defined. This can be modified, added and deleted.
Convenience properties
Boolean read-only property indicating whether the geometry object has a z coordinate.
Boolean read-only property indicating whether the geometry object has an m coordinate.
Boolean read-only property indicating whether the geometry object’s SRID is defined.
This class holds a single point.
Constructs a point. The point has two, three or four dimensions, depending on whether the optional z and m coordinates are provided. The point’s SRID can be provided or left undefined.
The x coordinate. This coordinate may be modified but not deleted.
The y coordinate. This coordinate may be modified but not deleted.
The z coordinate if the point has one. This coordinate can be modified, added and deleted.
The m coordinate if the point has one. This coordinate can be modified, added and deleted.
This class holds a line consisting of multiple points.
Constructs a line from a sequence of ppygis.Point objects with identical dimensions. The line’s SRID can be provided or left undefined; those of the points are ignored.
A list of the points in the line. This may be modified, subject to the conditions described for the constructor.
This class holds a polygon consisting of one or more rings.
Constructs a polygon from a sequence of ppygis.LineString rings with identical dimensions. The polygon’s SRID can be provided or left undefined; those of the rings are ignored.
A list of the rings in the polygon. This may be modified, subject to the conditions described for the constructor.
This class holds a collection of geometry objects, allowing different types to be mixed.
Constructs a collection from a sequence of geometry objects with identical dimensions. The sequence may contain any combination of object types, including ppygis.GeometryCollection. The collection’s SRID can be provided or left undefined. SRIDs defined for the collection and any of its geometry objects must be identical.
A list of the geometry objects in the collection. This may be modified, subject to the conditions described for the constructor.
This class holds a collection of points.
Constructs a collection from a sequence of ppygis.Point objects with identical dimensions. The collection’s SRID can be provided or left undefined. SRIDs defined for the collection and any of its points must be identical.
A list of the points in the collection. This may be modified, subject to the conditions described for the constructor.
This class holds a collection of lines.
Constructs a collection from a sequence of ppygis.LineString objects with identical dimensions. The collection’s SRID can be provided or left undefined. SRIDs defined for the collection and any of its lines must be identical.
A list of the lines in the collection. This may be modified, subject to the conditions described for the constructor.
This class holds a collection of polygons.
Constructs a collection from a sequence of ppygis.Polygon objects with identical dimensions. The collection’s SRID can be provided or left undefined. SRIDs defined for the collection and any of its polygons must be identical.
A list of the polygons in the collection. This may be modified, subject to the conditions described for the constructor.