Add all local circuit work — year-by-year SVGs and tooling

This commit is contained in:
2026-03-25 22:17:47 +01:00
parent 6ceeba7fb9
commit c94ebcfb22
1149 changed files with 171650 additions and 421 deletions
+27
View File
@@ -0,0 +1,27 @@
from dataclasses import dataclass, asdict
from typing import List, Dict, Any, TYPE_CHECKING, Optional
from models.geo_json.feature import GeoJSONFeature
if TYPE_CHECKING:
from models.circuit import Circuit
@dataclass
class GeoJSON:
type: str
bbox: Optional[list[float]]
features: List[GeoJSONFeature]
@classmethod
def from_dict(cls, circuit: 'Circuit', data: Dict[str, Any]) -> 'GeoJSON':
return cls(
type=data['type'],
bbox=data['bbox'] if 'bbox' in data else None,
features=[GeoJSONFeature.from_dict(circuit, f) for f in data['features']],
)
def to_dict(self) -> Dict[str, Any]:
"""Convert the GeoJSON object back to a dictionary"""
data = asdict(self)
# Remove None values
return {k: v for k, v in data.items() if v is not None}