A Location represents a place on the earth. Together with Observations, Locations form a contribution. Location and Observation are separate to enable reusing existing Locations for various Observations.
Parameter | Type | Description |
---|---|---|
id |
int | Identifies the location in the database. |
name |
string | Short title of the location. |
description |
string | Longer description about the location. |
geometry |
GEOSGeometry | Shape and geographic location. |
created_at |
datetime | Date and time when location was created. |
creator |
User | User who created the location. |
status |
string | Status of the location, must be one of active , review . Defaults to active . |
private |
boolean | Indicates if the location can be reused with other observations. If true , the location is not re-usable, unless private_for_project is set; then the location is re-usable for the specified project. |
private_for_project |
Project | Optional. Indicates the project, in which the location can be used. |
Location.objects.create(**kwargs)
true
the location is not re-usable, unless private_for_project
is set; then the location is re-usable for the specified project.Location
from django.contrib.gis.geos import GEOSGeometry
from geokey.contributions.models import Location
Location.objects.create(
name='Buckingham Palace',
description='You know, the Queen lives here',
geometry=GEOSGeometry('{ "type": "Point", "coordinates": [ -0.1418781280517578, 51.50128299559082 ] }'),
creator=user,
private=False
)
get_list(user, project_id)
Returns a list of locations that can be used with the project.
django.db.models.query.QuerySet: List of Locations
get_single(user, project_id, location_id)
Returns a single location.
Location