vortexasdk.endpoints.geographies
Try me out in your browser:
Geographies
Geographies(self)
Geographies endpoint.
load_all
Geographies.load_all(self) -> vortexasdk.endpoints.geographies_result.GeographyResult
Load all geographies.
search
Geographies.search(self, term: Union[str, List[str]] = None, exact_term_match: bool = False, filter_layer: str = None) -> vortexasdk.endpoints.geographies_result.GeographyResult
Find all geographies matching given search terms.
Arguments
-
term: The geography name (or names) we're filtering on
-
exact_term_match: Search on only exact term matches, or allow similar matches. e.g. When searching for "China" with
exact_term_match=False
, then the SDK will yield geographies named ['China', 'South China', 'China Energy Services Ningbo'...] etc. Whenexact_term_match=True
, the SDK will only yield the geography namedChina
. -
filter_layer: Must be one of:
terminal
,port
,country
,country_zone
,shipping_region
,shipping_region_v2
,wider_shipping_region
,region
,alternative_region
,trading_block
,trading_region
,trading_subregion
,state_or_province
,sts_zone
,waypoint
,storage
,storage_terminal
,basin
,root
, or not provided.
Returns
List of geographies matching term
Examples
Find all geographies with portsmouth
in the name.
>>> from vortexasdk import Geographies
>>> [x.name for x in Geographies().search(term="portsmouth").to_list()]
['Portsmouth [GB]', 'Portsmouth, NH [US]']
Search multiple geography terms
>>> df = Geographies().search(term=["Liverpool", "Southampton"]).to_df()
returns
id | name | layer | |
---|---|---|---|
0 | b63d8f625669fd... | Liverpool [GB] | ['port'] |
1 | 0cb7d4566de0f2... | Southampton [GB] | ['port'] |
2 | 8b4273e3181f2d... | Liverpool Docks | ['terminal'] |
3 | 98c50b0d2ee2b1... | Liverpool Bulk Liquids | ['terminal'] |
reference
Geographies.reference(self, id: str) -> Dict
Perform a geography lookup.
Arguments
- id: Geography ID to lookup
Returns
Geography matching the ID
Further Documentation:
VortexaAPI Geography Reference
vortexasdk.endpoints.geographies_result
GeographyResult
GeographyResult(__pydantic_self__, **data: Any) -> None
Container class that holds the result obtained from calling the Geography
endpoint.
to_list
GeographyResult.to_list(self) -> List[vortexasdk.api.geography.Geography]
Represent geographies as a list.
to_df
GeographyResult.to_df(self, columns=['id', 'name', 'layer']) -> pandas.core.frame.DataFrame
Represent geographies as a pd.DataFrame
.
Arguments
- columns: The geography features we want in the dataframe. Enter
columns='all'
to include all features. Defaults tocolumns = ['id', 'name', 'layer']
.
Returns
pd.DataFrame
of geographies.