API Reference¶
The supported public contract is now subpackage-first:
nyc_mesh.modelsnyc_mesh.ionyc_mesh.analysisnyc_mesh.exportnyc_mesh.pipelinenyc_mesh.cli
The root nyc_mesh namespace is intentionally minimal and only exposes
__version__.
Root¶
nyc_mesh ¶
Minimal root namespace for the nyc-mesh package.
Models¶
nyc_mesh.models ¶
Public typed models for nyc-mesh.
BoundingBox
dataclass
¶
Geographic clipping bounds in WGS84 order.
Source code in src/nyc_mesh/models/_core.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
contains ¶
contains(longitude: float, latitude: float) -> bool
Return whether the WGS84 point falls inside the bounding box.
Source code in src/nyc_mesh/models/_core.py
34 35 36 37 38 39 40 | |
BuildingFeature
dataclass
¶
Height-aware building feature reprojected to WGS84 coordinates.
Source code in src/nyc_mesh/models/_core.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
properties
class-attribute
instance-attribute
¶
properties: dict[str, ScalarValue] = field(
default_factory=dict
)
with_properties ¶
with_properties(
updates: dict[str, ScalarValue],
) -> BuildingFeature
Return a copy with merged properties.
Source code in src/nyc_mesh/models/_core.py
97 98 99 100 101 | |
CityGMLBuilding
dataclass
¶
Single CityGML building with an EPSG:2263 footprint and optional height.
Source code in src/nyc_mesh/models/_core.py
59 60 61 62 63 64 65 | |
CityGMLDataset
dataclass
¶
Loaded local CityGML source and parsed building records.
Source code in src/nyc_mesh/models/_core.py
68 69 70 71 72 73 | |
DataSourceMetadata
dataclass
¶
Metadata describing one cached or user-staged public dataset.
Source code in src/nyc_mesh/models/_core.py
179 180 181 182 183 184 185 186 187 188 | |
DEMDataset
dataclass
¶
Loaded digital elevation model.
Source code in src/nyc_mesh/models/_core.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
ExportTarget
dataclass
¶
Destination metadata for export commands.
Source code in src/nyc_mesh/models/_core.py
43 44 45 46 47 48 | |
FootprintDataset
dataclass
¶
Loaded footprint features used for PLUTO-style joins.
Source code in src/nyc_mesh/models/_core.py
123 124 125 126 127 128 | |
FootprintFeature
dataclass
¶
Generic polygon feature loaded from GeoJSON or shapefile footprints.
Source code in src/nyc_mesh/models/_core.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
LidarDataset
dataclass
¶
Loaded LiDAR point cloud.
Source code in src/nyc_mesh/models/_core.py
141 142 143 144 145 146 | |
LidarPoint
dataclass
¶
Single LiDAR point.
Source code in src/nyc_mesh/models/_core.py
131 132 133 134 135 136 137 138 | |
NeighborhoodRequest
dataclass
¶
A named extraction request for a neighborhood-scale clip.
Source code in src/nyc_mesh/models/_core.py
51 52 53 54 55 56 | |
StudyAreaAssetManifest
dataclass
¶
Manifest of the official assets used for one mesh study area.
Source code in src/nyc_mesh/models/_core.py
191 192 193 194 195 196 197 198 199 200 201 202 203 | |
TerrainMeshDataset
dataclass
¶
Triangulated terrain mesh.
Source code in src/nyc_mesh/models/_core.py
170 171 172 173 174 175 176 | |
IO¶
nyc_mesh.io ¶
Public loaders for nyc-mesh.
NYC_BUILDING_FOOTPRINTS_API_URL
module-attribute
¶
NYC_BUILDING_FOOTPRINTS_API_URL = (
"https://data.cityofnewyork.us/resource/5zhs-2jue.json"
)
NYC_CITYGML_ARCHIVE_URL
module-attribute
¶
NYC_CITYGML_ARCHIVE_URL = (
"https://maps.nyc.gov/download/3dmodel/DA_WISE_GML.zip"
)
NYC_DEM_DATASET_URL
module-attribute
¶
NYC_DEM_DATASET_URL = "https://data.cityofnewyork.us/City-Government/1-foot-Digital-Elevation-Model-DEM-/dpc8-z3jc/data?no_mobile=true"
NYC_LIDAR_DATASET_URL
module-attribute
¶
NYC_LIDAR_DATASET_URL = "https://noaa-nos-coastal-lidar-pds.s3.amazonaws.com/laz/geoid18/9306/index.html"
NYC_PLUTO_API_URL
module-attribute
¶
NYC_PLUTO_API_URL = (
"https://data.cityofnewyork.us/resource/64uk-42ks.json"
)
load_citygml ¶
load_citygml(source: str | Path) -> CityGMLDataset
Load building footprints and measured heights from a local CityGML file.
Source code in src/nyc_mesh/io/_core.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
load_dem ¶
load_dem(source: str | Path) -> DEMDataset
Load a DEM from ESRI ASCII grid or JSON grid data.
Source code in src/nyc_mesh/io/_core.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
load_footprints ¶
load_footprints(source: str | Path) -> FootprintDataset
Load footprint polygons from GeoJSON or ESRI shapefile sources.
Source code in src/nyc_mesh/io/_core.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
load_lidar ¶
load_lidar(source: str | Path) -> LidarDataset
Load LiDAR point data from LAS/LAZ, CSV, XYZ, or JSON inputs.
Source code in src/nyc_mesh/io/_core.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
build_asset_manifest ¶
build_asset_manifest(
*,
study_area_name: str,
bbox: BoundingBox,
cache_dir: Path,
citygml_source: Path,
metadata: tuple[DataSourceMetadata, ...],
footprints_source: Path | None = None,
pluto_source: Path | None = None,
dem_source: Path | None = None,
lidar_source: Path | None = None,
) -> StudyAreaAssetManifest
Build a typed manifest for one official mesh study area.
Source code in src/nyc_mesh/io/_official.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
build_enriched_footprint_geojson ¶
build_enriched_footprint_geojson(
footprint_rows: list[dict[str, Any]],
pluto_rows: list[dict[str, Any]],
) -> dict[str, Any]
Merge PLUTO attributes into official building-footprint features.
Source code in src/nyc_mesh/io/_official.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
ensure_citygml_archive ¶
ensure_citygml_archive(
target_path: Path,
*,
refresh: bool = False,
source_url: str = NYC_CITYGML_ARCHIVE_URL,
) -> Path
Download the official CityGML archive when explicitly requested.
Source code in src/nyc_mesh/io/_official.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
fetch_building_footprints_for_bbls ¶
fetch_building_footprints_for_bbls(
bbls: tuple[str, ...], *, page_size: int = 5000
) -> list[dict[str, Any]]
Fetch official building-footprint rows for the supplied BBL set.
Source code in src/nyc_mesh/io/_official.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
fetch_pluto_records_for_bbox ¶
fetch_pluto_records_for_bbox(
bbox: BoundingBox, *, page_size: int = 5000
) -> list[dict[str, Any]]
Fetch PLUTO rows whose centroid falls inside the requested bbox.
Source code in src/nyc_mesh/io/_official.py
72 73 74 75 76 77 78 79 80 81 82 83 | |
metadata_row ¶
metadata_row(
*,
name: str,
source_url: str,
cache_path: Path,
record_count: int,
notes: str = "",
) -> DataSourceMetadata
Create a metadata row timestamped at the current UTC time.
Source code in src/nyc_mesh/io/_official.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
require_local_asset ¶
require_local_asset(
provided_path: str | Path | None,
*,
label: str,
source_url: str,
) -> Path
Resolve a user-staged official asset or raise with download guidance.
Source code in src/nyc_mesh/io/_official.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
Analysis¶
nyc_mesh.analysis ¶
Public analysis helpers for nyc-mesh.
clip_to_bbox ¶
clip_to_bbox(
data: tuple[BuildingFeature, ...], bbox: BoundingBox
) -> tuple[BuildingFeature, ...]
Clip building features to a WGS84 bounding box.
Source code in src/nyc_mesh/analysis/_core.py
45 46 47 48 49 50 51 52 53 54 55 | |
extract_buildings ¶
extract_buildings(
citygml_data: CityGMLDataset,
) -> tuple[BuildingFeature, ...]
Extract height-aware WGS84 building footprints from loaded CityGML data.
Source code in src/nyc_mesh/analysis/_core.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
generate_terrain_mesh ¶
generate_terrain_mesh(
lidar_or_dem_data: LidarDataset | DEMDataset,
) -> TerrainMeshDataset
Generate a lightweight terrain mesh from DEM or LiDAR inputs.
Source code in src/nyc_mesh/analysis/_core.py
155 156 157 158 159 160 161 162 | |
join_pluto ¶
join_pluto(
buildings: tuple[BuildingFeature, ...],
pluto_data: FootprintDataset,
) -> tuple[BuildingFeature, ...]
Join footprint properties onto buildings by id or centroid overlap.
Source code in src/nyc_mesh/analysis/_core.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
Export¶
nyc_mesh.export ¶
Public exporters for nyc-mesh.
export_3d_tiles ¶
export_3d_tiles(
data: tuple[BuildingFeature, ...], target: ExportTarget
) -> Path
Export a minimal Cesium 3D Tiles package backed by a glTF payload.
Source code in src/nyc_mesh/export/_core.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
export_geojson ¶
export_geojson(
data: tuple[BuildingFeature, ...], target: ExportTarget
) -> Path
Export WGS84 building features to a GeoJSON FeatureCollection.
Source code in src/nyc_mesh/export/_core.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
export_geoparquet ¶
export_geoparquet(
data: tuple[BuildingFeature, ...], target: ExportTarget
) -> Path
Export building features to GeoParquet using a WKB geometry column.
Source code in src/nyc_mesh/export/_core.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
export_gltf ¶
export_gltf(
data: tuple[BuildingFeature, ...] | TerrainMeshDataset,
target: ExportTarget,
) -> Path
Export a lightweight glTF scene for 3D viewers.
Source code in src/nyc_mesh/export/_core.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
Pipeline¶
nyc_mesh.pipeline ¶
High-level pipeline helpers for nyc-mesh.
DEFAULT_STUDY_AREAS
module-attribute
¶
DEFAULT_STUDY_AREAS = {
"lower-manhattan-skyline": BoundingBox(
min_lat=40.7035,
min_lon=-74.0185,
max_lat=40.7178,
max_lon=-73.9975,
),
"empire-state-building": BoundingBox(
min_lat=40.7445,
min_lon=-73.9899,
max_lat=40.7502,
max_lon=-73.9839,
),
}
extract_citygml_buildings ¶
extract_citygml_buildings(
source: str | Path, *, bbox: BoundingBox | None = None
) -> tuple[BuildingFeature, ...]
Load local or archived CityGML, extract buildings, and optionally clip.
Source code in src/nyc_mesh/pipeline.py
58 59 60 61 62 63 64 65 66 67 | |
build_study_area_manifest ¶
build_study_area_manifest(
*,
study_area_name: str,
bbox: BoundingBox,
cache_dir: str | Path,
citygml_path: str | Path | None = None,
allow_citygml_download: bool = False,
dem_path: str | Path | None = None,
lidar_path: str | Path | None = None,
) -> StudyAreaAssetManifest
Prepare official cache assets for one mesh study area.
Source code in src/nyc_mesh/pipeline.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
extract_manifest_buildings ¶
extract_manifest_buildings(
manifest: StudyAreaAssetManifest,
) -> tuple[BuildingFeature, ...]
Load, clip, and enrich buildings for a prepared study-area manifest.
Source code in src/nyc_mesh/pipeline.py
242 243 244 245 246 247 248 249 250 | |
export_citygml_geojson ¶
export_citygml_geojson(
source: str | Path,
output_path: str | Path,
*,
bbox: BoundingBox | None = None,
) -> Path
Run the CityGML happy path and write GeoJSON.
Source code in src/nyc_mesh/pipeline.py
253 254 255 256 257 258 259 260 261 262 263 | |
export_citygml_geoparquet ¶
export_citygml_geoparquet(
source: str | Path,
output_path: str | Path,
*,
bbox: BoundingBox | None = None,
) -> Path
Run the CityGML happy path and write GeoParquet.
Source code in src/nyc_mesh/pipeline.py
266 267 268 269 270 271 272 273 274 275 276 277 278 | |
CLI¶
nyc_mesh.cli ¶
Public CLI entry points for nyc-mesh.
build_parser ¶
build_parser() -> argparse.ArgumentParser
Build the CLI parser for the current extraction and export workflows.
Source code in src/nyc_mesh/cli/_main.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
main ¶
main(argv: Sequence[str] | None = None) -> int
Run the installed nyc-mesh console script.
Source code in src/nyc_mesh/cli/_main.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |