Skip to content

types

Custom types, custom Dagster types

ExportResult dataclass

Result of the tile export with tyler for a single tile.

Parameters:

Name Type Description Default
tile_id str

Tile ID

required
cityjson_path Path

Path to the cityjson file

required
gpkg_path Path

Path to the geopackage file

required
obj_paths Sequence[Path]

Paths to the OBJ files

required
wkt str

Tile WKT

required
Source code in bag3d/common/types.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@dataclass
class ExportResult:
    """Result of the tile export with *tyler* for a single tile.

    Args:
        tile_id (str): Tile ID
        cityjson_path (Path): Path to the cityjson file
        gpkg_path (Path): Path to the geopackage file
        obj_paths (Sequence[Path]): Paths to the OBJ files
        wkt (str): Tile WKT
    """

    tile_id: str
    cityjson_path: Path
    gpkg_path: Path
    obj_paths: Sequence[Path]
    wkt: str

    @property
    def has_cityjson(self) -> bool:
        """Has an existing CityJSON file"""
        return self.cityjson_path is not None and self.cityjson_path.exists()

    @property
    def has_gpkg(self) -> bool:
        """Has an existing GeoPackage file"""
        return self.gpkg_path is not None and self.gpkg_path.exists()

    @property
    def has_obj(self) -> bool:
        """Has all the OBJ files and they exist"""
        return len(self.obj_paths) == 3 and all(p.exists() for p in self.obj_paths)

    def __iter__(self):
        for key in self.__dir__():
            if key[:2] != "__":
                yield key, getattr(self, key)

has_cityjson: bool property

Has an existing CityJSON file

has_gpkg: bool property

Has an existing GeoPackage file

has_obj: bool property

Has all the OBJ files and they exist