Fields

OSMField

class osm_field.fields.OSMField(*args, **kwargs)

Bases: django.db.models.TextField

Parameters:
  • lat_field (str) – The name of the latitude field. None (and thus standard behavior) by default.
  • lon_field (str) – The name of the longitude field. None (and thus standard behavior) by default.

All default field options.

formfield(**kwargs)
Returns:A CharField with a OSMWidget.
latitude_field_name

The name of the related LatitudeField.

longitude_field_name

The name of the related LongitudeField.

LatitudeField

class osm_field.fields.LatitudeField(*args, **kwargs)

Bases: django.db.models.FloatField

All default field options.

The validators parameter will be appended with validate_latitude() if not already present.

formfield(**kwargs)
Returns:A FloatField with max_value 90 and min_value -90.

LongitudeField

class osm_field.fields.LongitudeField(*args, **kwargs)

Bases: django.db.models.FloatField

All default field options.

The validators parameter will be appended with validate_longitude() if not already present.

formfield(**kwargs)
Returns:A FloatField with max_value 180 and min_value -180.

Utilities

Location

class osm_field.fields.Location(lat, lon, text)

A wrapper class bundling the description of a location (text) and its geo coordinates, latitude (lat) and longitude (lon).

Parameters:
  • lat (float) – The latitude
  • lon (float) – The longitude
  • str – The description