fr/fr_env/lib/python3.8/site-packages/shapely/linref.py

25 lines
677 B
Python
Raw Normal View History

2021-03-07 12:03:19 +05:30
"""Linear referencing
"""
from shapely.topology import Delegating
class LinearRefBase(Delegating):
def _validate_line(self, ob):
super(LinearRefBase, self)._validate(ob)
if not ob.geom_type in ['LinearRing', 'LineString', 'MultiLineString']:
raise TypeError("Only linear types support this operation")
class ProjectOp(LinearRefBase):
def __call__(self, this, other):
self._validate_line(this)
self._validate(other)
return self.fn(this._geom, other._geom)
class InterpolateOp(LinearRefBase):
def __call__(self, this, distance):
self._validate_line(this)
return self.fn(this._geom, distance)