route from point to point and describe points

This commit is contained in:
Laura Klünder 2016-12-21 00:24:56 +01:00
parent 8a9406275b
commit bbfca9f318
9 changed files with 127 additions and 19 deletions

View file

@ -3,7 +3,7 @@ from collections import OrderedDict
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from shapely.geometry import CAP_STYLE, JOIN_STYLE
from shapely.geometry import CAP_STYLE, JOIN_STYLE, Point
from shapely.geometry.geo import mapping, shape
from c3nav.mapdata.fields import GeometryField
@ -68,6 +68,9 @@ class GeometryMapItem(MapItem, metaclass=GeometryMapItemMeta):
def get_shadow_geojson(self):
return None
def contains(self, x, y):
return self.geometry.contains(Point(x, y))
class GeometryMapItemWithLevel(GeometryMapItem):
"""