Utils
getSV
Retrieve the closest street view image(s) near a coordinate using the Mapillary API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
centroid
|
The coordinates (geometry.centroid of GeoDataFrame) |
required | |
epsg
|
int
|
EPSG code for projecting the coordinates. |
required |
key
|
str
|
Mapillary API access token. |
required |
multi
|
bool
|
Whether to return multiple SVIs (default is False). |
False
|
fov
|
int
|
Field of view in degrees for the perspective image. Defaults to 80. |
80
|
heading
|
int
|
Camera heading in degrees. If None, it will be computed based on the house orientation. |
None
|
pitch
|
int
|
Camera pitch angle. Defaults to 10. |
10
|
height
|
int
|
Height in pixels of the returned image. Defaults to 300. |
300
|
width
|
int
|
Width in pixels of the returned image. Defaults to 400. |
400
|
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: A list of images in base64 format |
Source code in urbanworm/utils.py
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 |
|
getOSMbuildings
Get building footprints within a bounding box from OpenStreetMap using the Overpass API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bbox
|
tuple or list
|
A bounding box in the form (min_lon, min_lat, max_lon, max_lat). |
required |
min_area
|
float or int
|
Minimum footprint area in square meters. Defaults to 0. |
0
|
max_area
|
float or int
|
Maximum footprint area in square meters. If None, no upper limit is applied. |
None
|
Returns:
Type | Description |
---|---|
GeoDataFrame | None
|
gpd.GeoDataFrame or None: A GeoDataFrame of building footprints if any are found; otherwise, None. |
Source code in urbanworm/utils.py
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 353 354 355 356 357 358 |
|
getGlobalMLBuilding
Fetch building footprints from the Global ML Building dataset within a given bounding box.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bbox
|
tuple or list
|
Bounding box defined as (min_lon, min_lat, max_lon, max_lat). |
required |
epsg
|
int
|
EPSG code for coordinate transformation. Required if min_area > 0 or max_area is specified. |
None
|
min_area
|
float or int
|
Minimum building footprint area in square meters. Defaults to 0.0. |
0.0
|
max_area
|
float or int
|
Maximum building footprint area in square meters. Defaults to None (no upper limit). |
None
|
Returns:
Type | Description |
---|---|
GeoDataFrame
|
gpd.GeoDataFrame: Filtered building footprints within the bounding box. |
Source code in urbanworm/utils.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|