The Vector Service provides access to vector products and the features contained therein from Descartes Labs.
Vector¶
The Vector API can be found as Python package descarteslabs.vector
.
-
class
Table
(table_parameters: Union[dict, str]) A class for creating and interacting with vector products.
-
add
(feature_collection: Union[dict, descarteslabs.vector.vector.FeatureCollection]) → descarteslabs.vector.vector.FeatureCollection Add a feature collection to this table.
Parameters: feature_collection (Union[dict, geojson.FeatureCollection, FeatureCollection]) – Collection of features to add to this table. Returns: feature_collection – Added features. Note that this will differ from the input in that the this will have feature IDs. Return type: FeatureCollection
-
static
create
(product_id, *args, **kwargs) → descarteslabs.vector.vector.Table Create a vector product.
Parameters: - product_id (str) – ID of the vector product.
- name (str) – Name of the vector product.
- description (str, optional) – Description of the vector product.
- tags (list of str, optional) – A list of tags to associate with the vector product.
- readers (list of str, optional) – A list of vector product readers. Can take the form “user:{namespace}”, “group:{group}”, “org:{org}”, or “email:{email}”.
- writers (list of str, optional) – A list of vector product writers. Can take the form “user:{namespace}”, “group:{group}”, “org:{org}”, or “email:{email}”.
- owners (list of str, optional) – A list of vector product owners. Can take the form “user:{namespace}”, “group:{group}”, “org:{org}”, or “email:{email}”.
Returns: table – Table instace representing new product
Return type: Table
-
delete
() Delete this vector product.
This function will disable all subsequent non-static method calls.
-
delete_feature
(feature_id: str) Delete a feature in a vector product.
Parameters: feature_id (str) – ID of the feature.
-
description
() Return the description of the table.
Returns: description – Table Description Return type: str
-
features
(aoi: Union[descarteslabs.core.common.geo.geocontext.GeoContext, dict, shapely.geometry.base.BaseGeometry, None] = None, filter: Optional[descarteslabs.core.common.property_filtering.filtering.Properties] = None) → descarteslabs.vector.vector.FeatureSearch Return a filterable FeatureSearch object.
Parameters: - aoi (Optional[Union[dl.geo.GeoContext, dict, shapely.geometry.base.BaseGeometry]]) – Optional AOI object on which to filter features.
- filter (Optional[Properties]) – Optional property filte.
Returns: fs – Filteratble object
Return type: FeatureSearch
-
static
get
(product_id: str) → descarteslabs.vector.vector.Table Get a Table instance associated with a product id. Raise an exception if this product_id doesn’t exit.
Parameters: product_id (str) – ID of product Returns: table – Table instance for the product ID. Return type: Table
-
get_feature
(feature_id: str) → dict Get a specific feature from this Table instance.
Parameters: - feature_id (str) – Feature ID for which we would like the feature
- Retruns –
- ------- –
- dict – A GeoJSON Feature.
-
static
list
(tags: Optional[List[str]] = None) → List[descarteslabs.vector.vector.Table] List available vector products.
Parameters: tags (list of str) – Optional list of tags a table must have to be returned. Returns: products – List of table instances. Return type: list of Table
-
name
() Return the name of the table.
Returns: name – Table name Return type: str
-
tid
() Return the ID of the table.
Returns: tid – Table ID Return type: str
-
update
(*args, **kwargs) Update this vector product.
Parameters: - name (str) – New name of the vector product.
- description (str, optional) – New Description of the vector product.
- tags (list of str, optional) – New list of tags to associate with the vector product.
- readers (list of str, optional) – New list of vector product readers. Can take the form “user:{namespace}”, “group:{group}”, “org:{org}”, or “email:{email}”.
- writers (list of str, optional) – New list of vector product writers. Can take the form “user:{namespace}”, “group:{group}”, “org:{org}”, or “email:{email}”.
- owners (list of str, optional) – New list of vector product owners. Can take the form “user:{namespace}”, “group:{group}”, “org:{org}”, or “email:{email}”.
-
update_feature
(feature_id: str, feature: dict) → dict Update a feature in a vector product.
Parameters: - feature_id (str) – ID of the feature.
- feature (dict) – The GeoJSON Feature to replace the feature with.
Returns: A GeoJSON feature.
Return type: dict
-
visualize
(name: str, map: ipyleaflet.leaflet.Map, property_filter: Optional[descarteslabs.core.common.property_filtering.filtering.Properties] = None, include_properties: Optional[List[str]] = None, vector_tile_layer_styles: Optional[dict] = None) → ipyleaflet.leaflet.TileLayer Visualize this Table as an ipyleaflet vector tile layer.
Parameters: - name (str) – Name to give to the ipyleaflet vector tile layer.
- map (ipyleaflet.leaflet.Map) – Map to which to add the layer
- property_filter (Properties, optional) – Property filter to apply to the vector tiles.
- include_properties (list of str, optional) – Properties to include in the vector tiles. These can be used for styling.
- vector_tile_layer_styles (dict, optional) – Vector tile styles to apply. See https://ipyleaflet.readthedocs.io/en/latest/layers/vector_tile.html for more details.
Returns: Vector tile layer that can be added to an ipyleaflet map.
Return type: ipyleaflet.VectorTileLayer
-
-
class
FeatureCollection
(feature_collection: Union[dict, geojson.feature.FeatureCollection], parent_table: descarteslabs.vector.vector.Table) A class for creating and interacting with collections of features.
-
features
() → List[descarteslabs.vector.vector.Feature] Return the feature list.
Returns: features – Contained Features Return type: list of Feature
-
features_list
() → List[dict] Return the feature list as GeoJSON features.
Returns: features – Contained GeoJSON features Return type: list of dict
-
filter
(filter_func: Callable[[descarteslabs.vector.vector.Feature], bool]) Create a new FeatureCollection by filtering this one.
Note this filtering is performed on data that have already been pulled from the server. Where possible filtering should be performed with a FeatureSearch instance.
Parameters: filter_func (Callable[[Feature], bool]) – Preciate for selecting features. Returns: filtered – New FeatureCollection instance derived from filtering this one. Return type: FeatureCollection
-
get_feature
(feature_id: str) Get a specific feature from this FeatureCollection instance.
This call requires that a feature collection was generated with feature-IDs. This occurs, e.g., when the FeatureCollection instance is generated with Table.query.
Parameters: feature_id (str) – Feature ID for which we would like the feature Returns: A GeoJSON Feature. Return type: dict
-
-
class
Feature
(parameters: dict, parent_table: descarteslabs.vector.vector.Table) -
delete
() Delete this feature.
-
geometry
() → dict Get geometry.
Returns: geometry – Feature geometry Return type: dict
-
properties
() → dict Get properties.
Returns: properties – Feature properties Return type: dict
-
set_properties
(properties: dict) Set properties for this Feature.
Parameters: properties (dict) – New properties for this feature
-
update
() Update this feature.
-
uuid
() → dict Get UUID.
Returns: uuid – Feature UUID Return type: uuid
-
-
class
FeatureSearch
(parent_table: str, aoi: Union[descarteslabs.core.common.geo.geocontext.GeoContext, dict, shapely.geometry.base.BaseGeometry, None] = None, filter: Optional[descarteslabs.core.common.property_filtering.filtering.Properties] = None) A class for searching and filtering through vector features
-
collect
() → descarteslabs.vector.vector.FeatureCollection Return a FeatureCollection with the selected items.
Returns: fc – Selected features as a FeatureCollection Return type: FeatureCollection
-
filter
(filter: descarteslabs.core.common.property_filtering.filtering.Properties) → descarteslabs.vector.vector.FeatureSearch Create a new FeatureSearch instance that downselects to features that are selected by the filter.
Parameters: filter (descarteslabs.common.Properties) – AOI used to filter features by intersection Returns: feature_search – New FeatureSearch instance that downselects to features in the AOI. Return type: FeatureSearch
-
intersects
(aoi: Union[descarteslabs.core.common.geo.geocontext.GeoContext, dict, shapely.geometry.base.BaseGeometry]) → descarteslabs.vector.vector.FeatureSearch Create a new FeatureSearch instance that downselects to features that intersect the given AOI.
Parameters: aoi (descarteslabs.geo.GeoContext) – AOI used to filter features by intersection Returns: feature_search – New FeatureSearch instance that downselects to features in the AOI. Return type: FeatureSearch
-