Previous topic

API References

Next topic

mapfish.protocol

This Page

mapfish.sqlalchemygeom

class mapfish.sqlalchemygeom.GeometryTableMixIn

Class to be mixed in mapped classes.

When used the mapped class exposes

geometry_column()
Class method returning the Column object corresponding to the geometry column.
primary_key_column()
Class method returning the Column object corresponding to the primary key.

When used the mapped object exposes

geometry
The Shapely geometry object representing the geometry value in the database.
fid
The value of the primary key.
toFeature()
Method returning a geojson.Feature object that corresponds to this object.

Example:

Base = declarative_base(metadata=metadata)

class Line(Base, GeometryTableMixIn):
    __tablename__ = 'lines'
    __table_args__ = {
            'autoload' : True,
            'autoload_with' : engine
        }
    
    the_geom = GeometryColumn(Geometry(dimension=2, srid=4326))
fid

The value of the primary key.

geometry

The Shapely geometry object associated to the geometry value.

classmethod geometry_column()

Returns the table’s geometry column or None if the table has no geometry column.

classmethod primary_key_column()

Returns the table’s primary key column

toFeature()

Create and return a geojson.Feature object from this mapped object.