View
The View module provides functionality for working with views.
- class VectorLayerView(api, uuid, layer_type, data={})[source]
Bases:
VectorLayer- Parameters:
api (GeoboxClient)
uuid (str)
layer_type (LayerType)
data (Dict | None)
- BASE_ENDPOINT = 'vectorLayerViews/'
- __init__(api, uuid, layer_type, data={})[source]
Initialize a VectorLayerView instance.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
uuid (str) – The UUID of the vector layer view.
layer_type (LayerType) – The type of the vector layer view.
data (Dict, optional) – The data of the vector layer view.
- Return type:
None
- __repr__()[source]
Return a string representation of the VectorLayerView instance.
- Returns:
A string representation of the VectorLayerView instance.
- Return type:
str
- property vector_layer: VectorLayer
Get the vector layer.
- Returns:
The vector layer.
- Return type:
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid='e21e085a-8d30-407d-a740-ca9be9122c42') >>> view.vector_layer
- classmethod get_views(api, **kwargs)[source]
Get vector layer views.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
- Keyword Arguments:
layer_id (int) – The id of the source vector layer.
include_settings (bool) – Whether to include the settings of the layer. default is False.
q (str) – query filter based on OGC CQL standard. e.g. “field1 LIKE ‘%GIS%’ AND created_at > ‘2021-01-01’”
search (str) – search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.
search_fields (str) – Comma separated list of fields for searching.
order_by (str) – comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: “A” denotes ascending order and “D” denotes descending order.
return_count (bool) – Whether to return the count of the layer views. default is False.
skip (int) – The number of views to skip. minimum is 0.
limit (int) – The maximum number of views to return. minimum is 1. default is 10.
user_id (int) – Specific user. privileges required.
shared (bool) – Whether to return shared views. default is False.
- Returns:
A list of VectorLayerView instances or the layer views count if return_count is True.
- Return type:
list[VectorLayerView] | int
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> views = VectorLayerView.get_views(client, layer_id=1, include_settings=True, search="test", search_fields="name", order_by="name A", return_count=False, skip=0, limit=10, shared=True) or >>> views = client.get_views(layer_id=1, include_settings=True, search="test", search_fields="name", order_by="name A", return_count=False, skip=0, limit=10, shared=True)
- classmethod get_views_by_ids(api, ids, user_id=None, include_settings=False)[source]
Get vector layer views by their IDs.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
ids (List[int]) – list of comma separated layer ids to be returned. e.g. 1, 2, 3
user_id (int, optional) – specific user. privileges required.
include_settings (bool, optional) – Whether to include the settings of the vector layer views. default is False.
- Returns:
A list of VectorLayerView instances.
- Return type:
List[VectorLayerView]
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> views = VectorLayerView.get_views_by_ids(client, ids=[1,2,3]) or >>> views = client.get_views_by_ids(ids=[1,2,3])
- classmethod get_view(api, uuid, user_id=None)[source]
Get a specific vector layer view by its UUID.
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
uuid (str) – The UUID of the vector layer view.
user_id (int, optional) – Specific user. privileges required.
- Returns:
A VectorLayerView instance.
- Return type:
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") or >>> view = client.get_view(uuid="12345678-1234-5678-1234-567812345678")
- classmethod get_view_by_name(api, name, user_id=None)[source]
Get a view by name
- Parameters:
api (GeoboxClient) – The GeoboxClient instance for making requests.
name (str) – the name of the view to get
user_id (int, optional) – specific user. privileges required.
- Returns:
returns the view if a view matches the given name, else None
- Return type:
VectorLayerView | None
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view_by_name(client, name='test') or >>> view = client.get_view_by_name(name='test')
- update(**kwargs)[source]
Update the vector layer view.
- Keyword Arguments:
name (str) – The name of the vector layer view.
display_name (str) – The display name of the vector layer view.
description (str) – The description of the vector layer view.
- Returns:
The updated vector layer view.
- Return type:
Dict
- Raises:
ValidationError – If the update data is invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.update(name="new_name") >>> view.update(display_name="new_display_name") >>> view.update(description="new_description")
- delete()[source]
Delete the vector layer view.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.delete()
Shares the view with specified users.
- Parameters:
users (List[User]) – The list of user IDs to share the view with.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> users = client.search_users(search='John') >>> view.share(users=users)
Unshares the view with specified users.
- Parameters:
users (List[User]) – The list of user IDs to unshare the view with.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> users = client.search_users(search='John') >>> view.unshare(users=users)
Retrieves the list of users the view is shared with.
- Parameters:
search (str, optional) – The search query.
skip (int, optional) – The number of users to skip.
limit (int, optional) – The maximum number of users to retrieve.
- Returns:
The list of shared users.
- Return type:
List[User]
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.get_shared_users(search='John', skip=0, limit=10)
- get_fields()[source]
Get all fields in the vector layer view.
- Returns:
A list of Field instances representing the vector layer view’s fields.
- Return type:
List[Field]
- Raises:
ApiRequestError – If the API request fails.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> fields = view.get_fields()
- get_field(field_id)[source]
Get a specific field by its ID or name.
- Parameters:
field_id (int) – The ID of the field to retrieve.
- Returns:
The requested field instance.
- Return type:
- Raises:
NotFoundError – If the field with the specified ID is not found.
ApiRequestError – If the API request fails.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> field = view.get_field(id=1)
- get_field_by_name(name)[source]
Get a specific field by its name.
- Parameters:
name (str, optional) – The name of the field to retrieve.
- Returns:
The requested field instance.
- Return type:
- Raises:
NotFoundError – If the field with the specified name is not found.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> field = view.get_field_by_name(name='test')
- calculate_field(target_field, expression, q=None, bbox=None, bbox_srid=None, feature_ids=None, run_async=True, user_id=None)[source]
Calculate values for a field based on an expression.
- Parameters:
target_field (str) – The field to calculate values for.
expression (str) – The expression to use for calculation.
q (Optional[str]) – query filter based on OGC CQL standard. e.g. “field1 LIKE ‘%GIS%’ AND created_at > ‘2021-01-01’”
bbox (Optional[List[float]]) – Bounding box to filter features.
bbox_srid (Optional[int]) – Spatial reference ID for the bounding box.
feature_ids (Optional[List[int]]) – List of specific feature IDs to include.
run_async (Optional[bool]) – Whether to run the calculation asynchronously.
user_id (Optional[int]) – ID of the user running the calculation.
- Returns:
The task instance of the calculation operation or the api response if the run_async=False.
- Return type:
Task | Dict
- Raises:
ValidationError – If the calculation parameters are invalid.
ApiRequestError – If the API request fails.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> task = view.calculate_field(target_field="target_field", ... expression="expression", ... q="name like 'my_layer'", ... bbox=[10, 20, 30, 40], ... bbox_srid=3857, ... feature_ids=[1, 2, 3], ... run_async=True)
- get_features(geojson=False, **kwargs)[source]
Get features from the layer with optional filtering and pagination.
- Parameters:
geojson (bool, optional) – If True, returns the raw API response (GeoJSON dict). If False, returns a list of Feature objects. default: False.
- Keyword Arguments:
quant_factor (int) – Quantization factor. This parameter is only used by topojson encoder and is ignored for other formats. Higher quantizaion value means higher geometry precision. default is 1000000.
skip (int) – Number of features to skip. default is 0.
limit (int) – Maximum number of features to return. default is 100.
user_id (int) – Specific user. privileges required.
search (str) – search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.
search_fields (str) – comma separated list of fields for searching.
skip_geometry (bool) – Whether to exclude geometry data. default is False.
return_count (bool) – Whether to return total count. default is False.
feature_ids (List[int]) – comma separated list of feature ids which should be filtered.
select_fields (str) – comma separated field names which should be included to the result. default is “[ALL]”.
skip_fields (str) – comma separated field names which should be excluded from the result.
out_srid (int) – srid (epsg code) of result features. e.g. 4326. default is 3857
order_by (str) – comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, length D. NOTE: “A” denotes ascending order and “D” denotes descending order.
q (str) – query filter based on OGC CQL standard. e.g. Name LIKE ‘%GIS%’ AND INTERSECTS(geometry, ‘SRID=3857;POLYGON((4901948 2885079, 7049893 2885079, 7049893 4833901, 4901948 4833901, 4901948 2885079))’).
bbox (str) – Bounding box to filter features by. e.g. [50.275, 35.1195, 51.4459, 36.0416].
bbox_srid (int) – srid (epsg code) of bbox. e.g. 4326. default is 3857.
- Returns:
A list of Feature instances or the geojson api response if geojson=True or the features count if return_count is True.
- Return type:
List[Feature] | Dict | int
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> layer = VectorLayerView(api=client, name="my_layer", layer_type=LayerType.Point) >>> features = layer.get_features(quant_factor=1000000, ... skip=0, ... limit=100, ... skip_geometry=False, ... return_count=False, ... select_fields="fclass, osm_id", ... out_srid=4326, ... bbox_srid=4326)
- get_feature(feature_id, out_srid=3857)[source]
Get a specific feature by its ID.
- Parameters:
feature_id (int) – The ID of the feature to retrieve.
out_srid (int, optional) – Output spatial reference ID
- Returns:
The requested feature instance.
- Return type:
- Raises:
NotFoundError – If the feature with the specified ID is not found.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> feature = view.get_feature(id=1)
- create_feature(geojson)[source]
Create a new feature in the layer.
- Parameters:
geojson (dict) – The feature data including properties and geometry.
- Returns:
The newly created feature instance.
- Return type:
- Raises:
ValidationError – If the feature data is invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> feature = view.create_feature(geojson=geojson)
- delete_features(q=None, bbox=None, bbox_srid=None, feature_ids=None, run_async=True, user_id=None)[source]
Delete features from the layer based on specified criteria.
- Parameters:
q (Optional[str]) – Query to filter features to delete.
bbox (Optional[List[float]]) – Bounding box to filter features.
bbox_srid (Optional[int]) – Spatial reference ID for the bounding box.
feature_ids (Optional[List[int]]) – List of specific feature IDs to delete.
run_async (Optional[bool]) – Whether to run the deletion asynchronously.
user_id (Optional[int]) – ID of the user performing the deletion.
- Returns:
The task instance of the deletion operation or the api response if run_async=False.
- Return type:
Task | Dict
- Raises:
ValidationError – If the deletion parameters are invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.delete_features(q="name like 'my_layer'", ... bbox=[10, 20, 30, 40], ... bbox_srid=3857, ... feature_ids=[1, 2, 3], ... run_async=True)
- import_features(file, input_geom_type=None, input_layer_name=None, input_dataset=None, user_id=None, input_srid=None, file_encoding='utf-8', replace_domain_codes_by_values=False, report_errors=True)[source]
Import features from a file into the layer.
- Parameters:
file (File) – file object to import.
input_geom_type (InputGeomType, optional) – Type of geometry in the input file.
input_layer_name (str, optional) – Name of the layer in the input file.
input_dataset (str, optional) – Name of the dataset in the input file.
user_id (int, optional) – Specific user.privileges requied.
input_srid (int, optional) – Spatial reference ID of the input data.
file_encoding (str, optional) – Character encoding of the input file.
replace_domain_codes_by_values (bool, optional) – Whether to replace domain codes with values.
report_errors (bool, optional) – Whether to report import errors.
- Returns:
The task instance of the import operation.
- Return type:
- Raises:
ValidationError – If the import parameters are invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> file = client.get_file(uuid="12345678-1234-5678-1234-567812345678") >>> task = view.import_features(file=file, ... input_geom_type=InputGeomType.POINT, ... input_layer="my_layer", ... input_dataset="my_dataset", ... input_srid=3857, ... file_encoding="utf-8", ... replace_domain_codes_by_values=False, ... report_errors=True)
- export_features(out_filename, out_format, replace_domain_codes_by_values=False, run_async=True, bbox=None, out_srid=None, zipped=True, feature_ids=None, bbox_srid=None, q=None, fields=None)[source]
Export features from the layer to a file.
- Parameters:
out_filename (str) – Name of the output file.
out_format (FileOutputFormat) – Format of the output file (e.g., ‘Shapefile’, ‘GPKG’, ‘GeoJSON’, ‘CSV’, ‘KML’, ‘DXF’).
replace_domain_codes_by_values (bool, optional) – Whether to replace domain codes with values.
run_async (bool, optional) – Whether to run the export asynchronously.
bbox (List[float], optional) – Bounding box to filter features.
out_srid (int, optional) – Spatial reference ID for the output.
zipped (bool, optional) – Whether to compress the output file.
feature_ids (List[int], optional) – List of specific feature IDs to export.
bbox_srid (int, optional) – Spatial reference ID for the bounding box.
q (str, optional) – Query to filter features.
fields (List[str], optional) – List of fields to include in the export.
- Returns:
The task instance of the export operation or the api response if run_async=False.
- Return type:
Task | Dict
- Raises:
ValidationError – If the export parameters are invalid.
ApiRequestError – If the API request fails.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> task = view.export_features(out_filename="output.shp", ... out_format="shp", ... replace_domain_codes_by_values=False, ... run_async=True, ... bbox=[10, 20, 30, 40], ... out_srid=3857, ... zipped=True, ... feature_ids=[1, 2, 3])
- property tile_pbf_url: str
Get a vector tile pbf url for the view.
- Returns:
the vector tile url.
- Return type:
str
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> url = view.tile_pbf_url
- get_tile_json()[source]
Get the vector tile JSON configuration for the layer.
- Returns:
The vector tile JSON configuration.
- Return type:
Dict
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> tile_json = view.get_tile_json()
- property settings: Dict
Get the layer’s settings.
- Returns:
The layer settings.
- Return type:
Dict
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> setting = view.settings
- update_settings(settings)[source]
Update the settings
settings (Dict): settings dictionary
- Returns:
updated settings
- Return type:
Dict
- Parameters:
settings (Dict)
Example
>>> from geobox import GeoboxClient >>> client = GeoboxClient() >>> view1 = client.get_view(uuid="12345678-1234-5678-1234-567812345678") >>> view2 = client.get_view(uuid="12345678-1234-5678-1234-567812345678") >>> view1.update_settings(view2.settings)
- set_settings(**kwargs)[source]
Set the settings of the Vector Layer.
- Keyword Arguments:
title_field (str) – The field to use as the title.
domain_display_type (str) – The type of domain display.
allow_export (bool) – Whether to allow export.
editable (bool) – Whether to allow editing.
edit_geometry (bool) – Whether to allow editing the geometry.
editable_attributes (str) – The attributes to allow editing.
allow_insert (bool) – Whether to allow inserting.
allow_delete (bool) – Whether to allow deleting.
min_zoom (int) – The minimum zoom level.
max_zoom (int) – The maximum zoom level.
max_features (int) – The maximum number of features.
filter_features (bool) – Whether to filter features.
fields (List[str]) – The fields to include in the layer.
use_cache (bool) – Whether to use caching.
cache_until_zoom (int) – The zoom level to cache until.
- Returns:
The updated settings.
- Return type:
Dict
- Raises:
ValidationError – If the settings data is invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.set_setting(title_field="name", ... domain_display_type="Value", ... allow_export=True, ... editable=True, ... edit_geometry=True, ... editable_attributes="[ALL]", ... allow_insert=True, ... allow_delete=True, ... min_zoom=0, ... max_zoom=24, ... max_features=65536, ... filter_features=True, ... fields=["id"], ... use_cache=True, ... cache_until_zoom=17)
- seed_cache(from_zoom=None, to_zoom=None, ignore_cache=False, workers=1, user_id=None)[source]
Seed the cache for the view.
- Parameters:
from_zoom (int, optional) – The zoom level to start caching from.
to_zoom (int, optional) – The zoom level to stop caching at.
ignore_cache (bool, optional) – Whether to ignore the cache. default is False.
workers (int, optional) – The number of workers to use. default is 1.
user_id (int, optional) – specified user. privileges required.
- Returns:
The task instance of the cache seeding operation.
- Return type:
List[Task]
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> task = view.cache_seed(from_zoom=0, to_zoom=10, ignore_cache=False, workers=1)
- clear_cache()[source]
Clear the view’s cache.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.clear_cache()
- property cache_size: int
Get the size of the view’s cache.
- Returns:
The size of the view’s cache.
- Return type:
int
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.cache_size
- update_stats()[source]
Update the view’s statistics.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.update_stats()
- prune_edited_areas()[source]
Prune edited areas. This method eliminates edited areas when there are too many of them. Cache builder uses this edited areas for partial cache generating.
- Returns:
None
- Return type:
None
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.prune_edited_areas()
- get_attachments(**kwargs)[source]
Get the resouces attachments
- Keyword Arguments:
element_id (str) – the id of the element with attachment.
search (str) – search term for keyword-based searching among all textual fields.
order_by (str) – comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D. NOTE: “A” denotes ascending order and “D” denotes descending order.
skip (int) – Number of items to skip. default is 0.
limit (int) – Number of items to return. default is 10.
return_count (bool) – Whether to return total count. default is False.
- Returns:
A list of attachments instances or the total number of attachments.
- Return type:
List[Attachment] | int
- Raises:
TypeError – if the resource type is not supported
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.get_attachments()
- create_attachment(name, loc_x, loc_y, file, feature=None, display_name=None, description=None)[source]
Create a new Attachment.
- Parameters:
name (str) – The name of the scene.
loc_x (int) – x parameter of the attachment location.
loc_y (int) – y parameter of the attachment location.
file (File) – the file object.
feature (Feature, optional) – the feature object.
display_name (str, optional) – The display name of the scene.
description (str, optional) – The description of the scene.
- Returns:
The newly created Attachment instance.
- Return type:
- Raises:
ValidationError – If the Attachment data is invalid.
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> file = client.get_files()[0] >>> view.create_attachment(name='test', loc_x=10, loc_y=10, file=file)
- generate_thumbnail()[source]
Generate thumbnail for the view
- Returns:
the api response
- Return type:
Dict
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> view = client.get_view(uuid="12345678-1234-5678-1234-567812345678") or >>> view = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> view.generate_thumbnail()
- save_as_vector_layer(out_layer_name, q=None, bbox=None, bbox_srid=None, fields=None, schema_only=False, run_async=True)[source]
Copy filtered/selected features of a vector layer view into a new vector layer.
- Parameters:
out_layer_name (str) – the output vector layer name
q (str, optional) – Query filter based on OGC CQL standard. e.g. “field1 LIKE ‘%GIS%’ AND created_at > ‘2021-01-01’”
bbox (str, optional) – Bounding box to filter features
bbox_srid (int, optional) – Spatial reference ID for the bounding box
fields (str, optional) – Comma separated list of fields
feature_ids (str, optional) – Comma seprated feature ids
schema_only (bool, optional) – Whether to save the layer schema only
run_async (bool, optional) – Whether to run the task asynchronously
- Returns:
a task instance if ‘run_async == True’, else the task result dictionary
- Return type:
Task | Dict
Example
>>> from geobox import GeoboxClient >>> from geobox.view import VectorLayerView >>> client = GeoboxClient() >>> layer = client.get_view(uuid="12345678-1234-5678-1234-567812345678") or >>> layer = VectorLayerView.get_view(client, uuid="12345678-1234-5678-1234-567812345678") >>> layer.save_as_vector_layer(out_layer_name='test')