WLTS
- class wlts.wlts.WLTS(url, lccs_url=None, access_token=None, language=None)
This class implement a client for WLTS.
Note
For more information about WLTS, please, refer to WLTS specification.
- __init__(url, lccs_url=None, access_token=None, language=None)
Create a WLTS client attached to the given host address (an URL).
- Parameters:
url (str) – URL for the WLTS server.
lccs_url (str, optional) – URL for the LCCS server.
access_token (str, optional) – Authentication token to be used with the WLTS server.
- property collections
Return a list of collections names.
- Returns:
A list with the names of available collections in the service.
- Return type:
list
- Raises:
ConnectionError – If the server is not reachable.
HTTPError – If the server response indicates an error.
ValueError – If the response body is not a json document.
- tj(latitude, longitude, **options)
Retrieve the trajectory for a given location and time interval.
- Keyword Arguments:
collections (optional) – A string with collections names separated by commas,
retrieved. (or any sequence of strings. If omitted, the values for all collections are)
longitude (float/int/list/ndarray) – Longitude(s) in EPSG:4326.
latitude (float/int/list/ndarray) – Latitude(s) in EPSG:4326.
start_date (
str, optional) – The begin of a time interval.end_date (
str, optional) – The end of a time interval.geometry (
str, optional) – A string that accepted True or False.language (
str, optional) – The language of classes.
- Returns:
Trajectory or Trajectories
- _list_collections()
Return the list of available collections.
- _trajectory(**params)
Retrieve the trajectories of collections associated with a given location in space.
Retrieve the land use and cover trajectory associated to the informed location considering the given date interval and the collections.
- Keyword Arguments:
collections (optional) – A string with collections names separated by commas,
retrieved. (or any sequence of strings. If omitted, the values for all collections are)
longitude (int/float) – A longitude value according to EPSG:4326.
latitude (int/float) – A latitude value according to EPSG:4326.
start_date (
str, optional) – The begin of a time interval.end_date (
str, optional) – The end of a time interval.geometry – A string that accepted True of False.
- _describe_collection(collection_id)
Describe a give collection.
- Parameters:
collection_id (str.) – The collection name.
- Returns:
Collection description.
- Return type:
dict
- __getitem__(key)
Get collection whose name is identified by the key.
- Returns:
A collection metadata object.
- Return type:
Collection
Example
Get a collection object named
deter_amazonia_legal:>>> from wlts import * >>> service = WLTS(WLTS_EXAMPLE_URL) >>> service['deter_amazonia_legal'] Collection...
- property url
Return the WLTS server instance URL.
- build_color_dict(collections) dict
Build colors from lccs.
- plot(dataframe, **parameters)
Plot the trajectory on a scatter or bar plot.
- Parameters:
dataframe (pandas.DataFrame) – The trajectory as dataframe representation.
- Keyword Arguments:
marker_size (int) – The marker size .
title (str) – The title. Ex: Land Use and Cover Trajectory.
title_y (str) – The title in the y-axis. Ex: Number of Points.
date (str) – Title of date. Ex: Year.
value (str) – The label of value. Ex: Collection.
width (int) – The width size.
height (int) – The height size.
font_size (int) – The font size.
type (str) – The graphic type: scatter or bar.
textfont_size (int) – The text font size.
textangle (int) – The text angle. Ex: 0.
textposition (str) – Specifies the location of the text. Like “inside
cliponaxis (bool) – Determines whether the text nodes are clipped abo
text_auto (bool) – Determines the display of text.
textposition – Specifies the location of the text.
opacity (float) – The text opacity.
marker_line_width (float) – The marker line width.
bar_title (bool) – Update the title with spaces and letter uppercase.
- Raises:
ImportError – If plotly could not be imported.
- static temporal_filter(df: DataFrame, target_classes: List[str], start_date: str | None = None, end_date: str | None = None, relation_op: str = 'contains') DataFrame
Filter a WLTS trajectory dataframe based on target classes and time range.
- Parameters:
df (pd.DataFrame) – WLTS trajectory with columns: [“class”, “collection”, “date”, “point_id”].
target_classes (List[str]) – Land use/cover classes of interest.
start_date (str, optional) – Start date (YYYY or YYYY-MM-DD).
end_date (str, optional) – End date (YYYY or YYYY-MM-DD).
relation_op (str, optional) – Relationship operator: “contains” or “equals”.
- Returns:
Filtered trajectory dataframe.
- Return type:
pd.DataFrame
- static temporal_relation(a: DataFrame, b: DataFrame, temp_fn: str = 'before') DataFrame
Allen Relations.