Source code for descarteslabs.common.vector.models

# Copyright 2018-2024 Descartes Labs.

from typing import Any, Dict
from uuid import uuid4

from pydantic import BaseModel, Field


[docs]class VectorBaseModel(BaseModel): uuid: str = Field( default_factory=uuid4, json_schema_extra={"primary_key": True}, )
[docs]class PointBaseModel(VectorBaseModel): geometry: str = Field(json_schema_extra={"geometry": "POINT"})
[docs]class LineBaseModel(VectorBaseModel): geometry: str = Field(json_schema_extra={"geometry": "LINESTRING"})
[docs]class PolygonBaseModel(VectorBaseModel): geometry: str = Field(json_schema_extra={"geometry": "POLYGON"})
[docs]class MultiPointBaseModel(VectorBaseModel): geometry: str = Field(json_schema_extra={"geometry": "MULTIPOINT"})
[docs]class MultiLineBaseModel(VectorBaseModel): geometry: str = Field(json_schema_extra={"geometry": "MULTILINESTRING"})
[docs]class MultiPolygonBaseModel(VectorBaseModel): geometry: str = Field(json_schema_extra={"geometry": "MULTIPOLYGON"})
[docs]class GenericFeatureBaseModel(VectorBaseModel): geometry: str = Field(json_schema_extra={"geometry": "GEOMETRY"}) properties: Dict[str, Any] = {}