Add all local circuit work — year-by-year SVGs and tooling
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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')
|
||||
)
|
||||
Reference in New Issue
Block a user