vortexasdk.endpoints.geographies

Geographies Endpoint.

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) -> 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. When exact_term_match=True, the SDK will only yield the geography named China.

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(self, _records: List) -> 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=None) -> 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 to columns = ['id', 'name', 'layer'].

Returns

pd.DataFrame of geographies.