Bases: Spatial
Represents a list of points.
Follows the GeoJSON specification (RFC 7946).
Parameters:
Name |
Type |
Description |
Default |
value
|
List[Tuple[float, float]]
|
|
required
|
Examples:
>>> MultiPoint([(0,0), (0,1), (1,1)])
Source code in valor/schemas/symbolic/types.py
| class MultiPoint(Spatial):
"""
Represents a list of points.
Follows the GeoJSON specification (RFC 7946).
Parameters
----------
value : List[Tuple[float, float]], optional
A multipoint.
Examples
--------
>>> MultiPoint([(0,0), (0,1), (1,1)])
"""
def __init__(
self,
value: typing.List[typing.Tuple[float, float]],
):
super().__init__(value=value)
@classmethod
def __validate__(cls, value: typing.Any):
if not isinstance(value, list):
raise TypeError(
f"Expected 'typing.List[typing.Tuple[float, float]]' received type '{type(value).__name__}'"
)
for point in value:
Point.__validate__(point)
@classmethod
def decode_value(
cls, value: typing.Optional[typing.List[typing.List[float]]]
):
"""Decode object from JSON compatible dictionary."""
if value is None:
return None
return cls([(point[0], point[1]) for point in value])
|
Functions
valor.schemas.MultiPoint.decode_value(value)
classmethod
Decode object from JSON compatible dictionary.
Source code in valor/schemas/symbolic/types.py
| @classmethod
def decode_value(
cls, value: typing.Optional[typing.List[typing.List[float]]]
):
"""Decode object from JSON compatible dictionary."""
if value is None:
return None
return cls([(point[0], point[1]) for point in value])
|