Python API
get_features(output_feature_class, overture_type, bbox, connect_timeout=None, request_timeout=None)
Retrieve data from Overture Maps and save it as an ArcGIS Feature Class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_feature_class
|
Union[str, Path]
|
Path to the output feature class. |
required |
overture_type
|
str
|
Overture feature type to retrieve. |
required |
bbox
|
tuple[float, float, float, float]
|
Bounding box to filter the data. Format: (minx, miny, maxx, maxy). |
required |
connect_timeout
|
int
|
Optional timeout in seconds for establishing a connection to the AWS S3. |
None
|
request_timeout
|
int
|
Optional timeout in seconds for waiting for a response from the AWS S3. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created feature class. |
Source code in src/overture_to_arcgis/__main__.py
get_spatially_enabled_dataframe(overture_type, bbox, connect_timeout=None, request_timeout=None)
Retrieve data from Overture Maps as an ArcGIS spatially enabled Pandas DataFrame.
Note
To see available overture types, use arcgis_overture.utils.get_all_overture_types().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
overture_type
|
str
|
Overture feature type to retrieve. |
required |
bbox
|
tuple[float, float, float, float]
|
Bounding box to filter the data. Format: (minx, miny, maxx, maxy). |
required |
connect_timeout
|
int
|
Optional timeout in seconds for establishing a connection to the Overture Maps service. |
None
|
request_timeout
|
int
|
Optional timeout in seconds for waiting for a response from the Overture Maps service. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A spatially enabled pandas DataFrame containing the requested Overture Maps data. |
Source code in src/overture_to_arcgis/__main__.py
Module overture_to_arcgis.utils
add_alternate_category_field(features)
Add an 'alternate_category' field to the input features if it does not already exist, and calculate from the 'categories' field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[Layer, str, Path]
|
The input feature layer or feature class. |
required |
Source code in src/overture_to_arcgis/utils/_arcgis.py
add_boolean_access_restrictions_fields(features, access_field='access_restrictions')
Add boolean access restriction fields to the input features based on the access_restrictions field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[str, Path, Layer]
|
The input feature layer or feature class. |
required |
access_field
|
str
|
The name of the access restrictions field. |
'access_restrictions'
|
Source code in src/overture_to_arcgis/utils/_arcgis.py
add_h3_indices(features, resolution=9, h3_field=None)
Add an H3 index field to the input features based on their geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[str, Path, Layer]
|
The input feature layer or feature class. |
required |
resolution
|
int
|
The H3 resolution to use for indexing. |
9
|
h3_field
|
Optional[str]
|
The name of the H3 index field to add. |
None
|
Source code in src/overture_to_arcgis/utils/_arcgis.py
add_overture_taxonomy_fields(features, single_category_field=None)
Add 'category_single_category_field parameter.
Note
If a single category field is not provided, the function will attempt to read the value for the primary key from
string JSON in the categories field, if this field exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[str, Path, Layer]
|
The input feature layer or feature class. |
required |
single_category_field
|
Optional[str]
|
The field name containing a single category. |
None
|
Source code in src/overture_to_arcgis/utils/_arcgis.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 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 | |
add_primary_category_field(features)
Add a 'primary_category' field to the input features if it does not already exist, and calculate from the 'categories' field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[Layer, str, Path]
|
The input feature layer or feature class. |
required |
Source code in src/overture_to_arcgis/utils/_arcgis.py
add_primary_name(features)
Add a 'primary_name' field to the input features if it does not already exist, and calculate from
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[Layer, str, Path]
|
The input feature layer or feature class. |
required |
Source code in src/overture_to_arcgis/utils/_arcgis.py
add_trail_field(features)
Add a 'trail' boolean field to the input features if it does not already exist. These features are those with a class of 'track', 'path', 'footway', 'trail' or 'cycleway' field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[Layer, str, Path]
|
The input feature layer or feature class. |
required |
Source code in src/overture_to_arcgis/utils/_arcgis.py
add_website_field(features)
Add a 'website' field to the input features if it does not already exist, and calculate from the 'contact_info' field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[Layer, str, Path]
|
The input feature layer or feature class. |
required |
Source code in src/overture_to_arcgis/utils/_arcgis.py
get_all_overture_types(release=None, s3=None)
Returns a list of all available Overture dataset types for a given release.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
release
|
Optional[str]
|
Optional release version. If not provided, the most current release will be used. |
None
|
s3
|
Optional[S3FileSystem]
|
Optional pre-configured S3 filesystem. If not provided, an anonymous S3 filesystem will be created. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of available overture types for the release. |
Source code in src/overture_to_arcgis/utils/__main__.py
get_current_release()
Returns the most current Overture dataset release string.
Returns:
| Type | Description |
|---|---|
str
|
Most current release string. |
Source code in src/overture_to_arcgis/utils/__main__.py
get_geometry_column(table)
Get the name of the geometry column from the PyArrow Table or RecordBatch metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Union[Table, RecordBatch]
|
PyArrow Table or RecordBatch with GeoArrow metadata. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Name of the geometry column. |
Source code in src/overture_to_arcgis/utils/__main__.py
get_layers_for_unique_values(input_features, field_name, arcgis_map=None)
Create layers from unique values in a specified field of the input features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_features
|
Union[Layer, str, Path]
|
The input feature layer or feature class. |
required |
field_name
|
str
|
The field name to get unique values from. |
required |
arcgis_map
|
Optional[Map]
|
The ArcGIS map object to add the layers to. |
None
|
Returns:
| Type | Description |
|---|---|
list[Layer]
|
A list of ArcGIS layers created from the unique values. |
Source code in src/overture_to_arcgis/utils/_arcgis.py
get_logger(level='INFO', logger_name=None, logfile_path=None, log_format='%(asctime)s | %(name)s | %(levelname)s | %(message)s', propagate=True, add_stream_handler=True, add_arcpy_handler=False)
Get Python :class:Logger<logging.Logger> configured to provide stream, file or, if available, ArcPy output.
The way the method is set up, logging will be routed through ArcPy messaging using :class:ArcpyHandler if
ArcPy is available. If ArcPy is not available, messages will be sent to the console using a
:class:StreamHandler<logging.StreamHandler>. Next, if the logfile_path is provided, log messages will also
be written to the provided path to a logfile using a :class:FileHandler<logging.FileHandler>.
Valid log_level inputs include:
* DEBUG - Detailed information, typically of interest only when diagnosing problems.
* INFO - Confirmation that things are working as expected.
* WARNING or WARN - An indication that something unexpected happened, or indicative of some problem in the
near future (e.g. "disk space low"). The software is still working as expected.
* ERROR - Due to a more serious problem, the software has not been able to perform some function.
* CRITICAL - A serious error, indicating that the program itself may be unable to continue running.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
Optional[Union[str, int]]
|
Logging level to use. Default is |
'INFO'
|
logger_name
|
Optional[str]
|
Name of the logger. If |
None
|
log_format
|
Optional[str]
|
Format string for the logging messages. Default is |
'%(asctime)s | %(name)s | %(levelname)s | %(message)s'
|
propagate
|
bool
|
If |
True
|
logfile_path
|
Union[Path, str]
|
Where to save the logfile if file output is desired. |
None
|
add_stream_handler
|
bool
|
If |
True
|
add_arcpy_handler
|
bool
|
If |
False
|
configure_logging('DEBUG')
logging.debug('nauseatingly detailed debugging message')
logging.info('something actually useful to know')
logging.warning('The sky may be falling')
logging.error('The sky is falling.)
logging.critical('The sky appears to be falling because a giant meteor is colliding with the earth.')
Source code in src/overture_to_arcgis/utils/_logging.py
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 | |
get_record_batches(overture_type, bbox=None, connect_timeout=None, request_timeout=None)
Return a pyarrow RecordBatchReader for the desired bounding box and S3 path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
overture_type
|
str
|
Overture feature type to load. |
required |
bbox
|
Optional[Tuple[float, float, float, float]]
|
Optional bounding box for data fetch (xmin, ymin, xmax, ymax). |
None
|
connect_timeout
|
Optional[float]
|
Optional connection timeout in seconds. |
None
|
request_timeout
|
Optional[float]
|
Optional request timeout in seconds. |
None
|
Yields:
| Type | Description |
|---|---|
RecordBatch
|
pa.RecordBatch: Record batches with the requested data. |
Source code in src/overture_to_arcgis/utils/__main__.py
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 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
get_release_list(s3=None)
Returns a list of all available Overture dataset releases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s3
|
Optional[S3FileSystem]
|
Optional pre-configured S3 filesystem. If not provided, an anonymous S3 filesystem will be created. |
None
|
Source code in src/overture_to_arcgis/utils/__main__.py
get_temp_gdb()
Get a temporary File Geodatabase path.
Source code in src/overture_to_arcgis/utils/__main__.py
remove_rail_features(features)
Remove rail features from the input features based on the 'subtype' field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[str, Path, Layer]
|
The input feature layer or feature class. |
required |
Source code in src/overture_to_arcgis/utils/_arcgis.py
split_into_subclass_features(features)
Split features into subsegments based on the definition in the 'subclass_rules' field.
Example
- [{"value": "driveway", "between": null}] -> same geometry with 'subclass' field populated with 'driveway'
- [{"value": "driveway", "between": [0.772783061, 1.0]}] -> two features replacing the original one feature, the first subsegment from 0-77.2783061% with a null subclass and a second subsegment from 77.28% to 100% of geometry with 'subclass' field populated with 'driveway'
- [{"value": "driveway", "between": [0.0, 0.5]}, {"value": "alley", "between": [0.5, 1.0]}] -> two subsegments with 'subclass' field populated accordingly
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
Union[str, Path, Layer]
|
The input feature layer or feature class. |
required |
warning !!! This function modifies the input features in place by adding new features and deleting the original ones.
Source code in src/overture_to_arcgis/utils/_arcgis.py
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | |
table_to_features(table, output_features)
Convert a PyArrow Table or RecordBatch with GeoArrow metadata to an ArcGIS Feature Class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Union[Table, RecordBatch]
|
PyArrow Table or RecordBatch with GeoArrow metadata. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created feature class. |
Source code in src/overture_to_arcgis/utils/__main__.py
table_to_spatially_enabled_dataframe(table)
Convert a PyArrow Table or RecordBatch with GeoArrow metadata to an ArcGIS Spatially Enabled DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
Union[Table, RecordBatch]
|
PyArrow Table or RecordBatch with GeoArrow metadata. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
ArcGIS Spatially Enabled DataFrame. |
Source code in src/overture_to_arcgis/utils/__main__.py
validate_bounding_box(bbox)
Validate the bounding box coordinates.