Geo fields

Fields for geo data

See: http://docs.mongodb.org/manual/applications/geospatial-indexes/

GeoJSON: http://geojson.org/geojson-spec.html

class yadm.fields.geo.Geo

Base class for GeoJSON data.

class yadm.fields.geo.GeoCoordinates

Base class for GeoJSON data with coordinates.

class yadm.fields.geo.GeoField(types=[<class 'yadm.fields.geo.Point'>, <class 'yadm.fields.geo.MultiPoint'>], **kwargs)

Base field for GeoJSON objects.

from_mongo(document, data)

Convert mongo value to python value.

Parameters:
  • document (BaseDocument) – document
  • value – mongo value
Returns:

python value

to_mongo(document, geo)

Convert python value to mongo value.

Parameters:
  • document (BaseDocument) – document
  • value – python value
Returns:

mongo value

class yadm.fields.geo.GeoOneTypeField(**kwargs)

Base field for GeoJSON objects with one acceptable type.

prepare_value(document, value)

The method is called when value is assigned for the attribute.

Parameters:
Returns:

prepared value

It must be accept value argument and return processed (e.g. casted) analog. Also it is called once for the default value.

class yadm.fields.geo.MultiPoint(points)

Class for GeoJSON MultiPoint objects.

See: http://geojson.org/geojson-spec.html#id5

class yadm.fields.geo.MultiPointField(**kwargs)

Field for MultiPoint.

get_fake(document, faker, depth)

Return fake data for testing.

type

alias of MultiPoint

class yadm.fields.geo.Point(longitude, latitude)

Class for GeoJSON Point objects.

See: http://geojson.org/geojson-spec.html#id2

class yadm.fields.geo.PointField(**kwargs)

Field for Point.

get_fake(document, faker, depth)

Return fake data for testing.

type

alias of Point