|
- from dataclasses import dataclass
- from typing import Optional, List, Dict, Any, TYPE_CHECKING
-
- from models.geo_json.geometry import GeoJSONGeometry
- from models.geo_json.properties import GeoJSONProperties
-
- if TYPE_CHECKING:
- from models.circuit import Circuit
-
- @dataclass
- class GeoJSONFeature:
- type: str
- properties: GeoJSONProperties
- bbox: Optional[List[float]]
- geometry: GeoJSONGeometry
- @classmethod
- def from_dict(cls, circuit: 'Circuit', data: Dict[str, Any]) -> 'GeoJSONFeature':
- return cls(
- type=data['type'],
- properties=GeoJSONProperties.from_dict(circuit, data['properties']),
- geometry=GeoJSONGeometry.from_dict(data['geometry']),
- bbox=data.get('bbox')
- )
|