Vectorlayer¶
- class sds_data_model.vector.VectorLayer(name, gpdf, schema, graph, metadata=None, category_lookups=None)¶
# TODO.
- Parameters
name (str) –
gpdf (geopandas.geodataframe.GeoDataFrame) –
schema (Dict[str, str]) –
graph (graphviz.graphs.Digraph) –
metadata (Optional[sds_data_model.metadata.Metadata]) –
category_lookups (Optional[Dict[str, Dict[int, str]]]) –
- Return type
None
- __init__(name, gpdf, schema, graph, metadata=None, category_lookups=None)¶
- Parameters
name (str) –
gpdf (geopandas.geodataframe.GeoDataFrame) –
schema (Dict[str, str]) –
graph (graphviz.graphs.Digraph) –
metadata (Optional[sds_data_model.metadata.Metadata]) –
category_lookups (Optional[Dict[str, Dict[int, str]]]) –
- Return type
None
Methods
__init__
(name, gpdf, schema, graph[, ...])from_files
(data_path[, data_kwargs, ...])Get a GeoDataframe with accompanying information on name, metadata and schema.
to_tiles
([bboxes])# TODO.
Attributes
category_lookups
metadata
name
gpdf
schema
graph
- classmethod from_files(data_path, data_kwargs=None, convert_to_categorical=None, metadata_path=None, metadata_kwargs=None, name=None, schema=None)¶
Get a GeoDataframe with accompanying information on name, metadata and schema.
Examples
>>> from vector import VectorLayer >>> aw = read_file("https://services.arcgis.com/JJzESW51TqeY9uat/arcgis/rest/services/Ancient_Woodland_England/FeatureServer/0/query?outFields=*&where=1%3D1&f=geojson").to_crs("epsg:27700") >>> aw.to_file("aw.gpkg", layer='aw', driver="GPKG") >>> aw_dict = { 'OBJECTID': 'int32', 'NAME': 'object', 'THEME': 'object', 'THEMNAME': 'object', 'THEMID': 'int64', 'STATUS': 'object', 'PERIMETER': 'float64', 'AREA': 'float64', 'X_COORD': 'int64', 'Y_COORD': 'int64', 'Shape__Area': 'float64', 'Shape__Length': 'float64' } >>> VectorLayer.from_files( data_path = "aw.gpkg", name = "Ancient Woodland - test dataset", schema = aw_dict)
- Parameters
data_path (str) – file path to dataset.
data_kwargs (Optional[Dict[str, Any]]) – # TODO.
convert_to_categorical (List[str]) – # TODO.
metadata_path (Optional[str]) – # TODO.
metadata_kwargs (Dict[str, Any]) – Key word arguments to be passed to the requests `get`_ method when reading xml metadata from a URL.
name (Optional[str]) – optional name to give VectorLayer output.
schema (Optional[Dict[str, Any]]) – optional dictionary of user-defined schema to pass, will get schema from dataset if none provided. User-defined dictionary should have the column as the “key”, and the data type as the “value”.
- Returns
VectorLayer class of dataset.
- Return type
sds_data_model.vector._VectorLayer
- to_tiles(bboxes=((0, 1200000, 100000, 1300000), (100000, 1200000, 200000, 1300000), (200000, 1200000, 300000, 1300000), (300000, 1200000, 400000, 1300000), (400000, 1200000, 500000, 1300000), (500000, 1200000, 600000, 1300000), (600000, 1200000, 700000, 1300000), (0, 1100000, 100000, 1200000), (100000, 1100000, 200000, 1200000), (200000, 1100000, 300000, 1200000), (300000, 1100000, 400000, 1200000), (400000, 1100000, 500000, 1200000), (500000, 1100000, 600000, 1200000), (600000, 1100000, 700000, 1200000), (0, 1000000, 100000, 1100000), (100000, 1000000, 200000, 1100000), (200000, 1000000, 300000, 1100000), (300000, 1000000, 400000, 1100000), (400000, 1000000, 500000, 1100000), (500000, 1000000, 600000, 1100000), (600000, 1000000, 700000, 1100000), (0, 900000, 100000, 1000000), (100000, 900000, 200000, 1000000), (200000, 900000, 300000, 1000000), (300000, 900000, 400000, 1000000), (400000, 900000, 500000, 1000000), (500000, 900000, 600000, 1000000), (600000, 900000, 700000, 1000000), (0, 800000, 100000, 900000), (100000, 800000, 200000, 900000), (200000, 800000, 300000, 900000), (300000, 800000, 400000, 900000), (400000, 800000, 500000, 900000), (500000, 800000, 600000, 900000), (600000, 800000, 700000, 900000), (0, 700000, 100000, 800000), (100000, 700000, 200000, 800000), (200000, 700000, 300000, 800000), (300000, 700000, 400000, 800000), (400000, 700000, 500000, 800000), (500000, 700000, 600000, 800000), (600000, 700000, 700000, 800000), (0, 600000, 100000, 700000), (100000, 600000, 200000, 700000), (200000, 600000, 300000, 700000), (300000, 600000, 400000, 700000), (400000, 600000, 500000, 700000), (500000, 600000, 600000, 700000), (600000, 600000, 700000, 700000), (0, 500000, 100000, 600000), (100000, 500000, 200000, 600000), (200000, 500000, 300000, 600000), (300000, 500000, 400000, 600000), (400000, 500000, 500000, 600000), (500000, 500000, 600000, 600000), (600000, 500000, 700000, 600000), (0, 400000, 100000, 500000), (100000, 400000, 200000, 500000), (200000, 400000, 300000, 500000), (300000, 400000, 400000, 500000), (400000, 400000, 500000, 500000), (500000, 400000, 600000, 500000), (600000, 400000, 700000, 500000), (0, 300000, 100000, 400000), (100000, 300000, 200000, 400000), (200000, 300000, 300000, 400000), (300000, 300000, 400000, 400000), (400000, 300000, 500000, 400000), (500000, 300000, 600000, 400000), (600000, 300000, 700000, 400000), (0, 200000, 100000, 300000), (100000, 200000, 200000, 300000), (200000, 200000, 300000, 300000), (300000, 200000, 400000, 300000), (400000, 200000, 500000, 300000), (500000, 200000, 600000, 300000), (600000, 200000, 700000, 300000), (0, 100000, 100000, 200000), (100000, 100000, 200000, 200000), (200000, 100000, 300000, 200000), (300000, 100000, 400000, 200000), (400000, 100000, 500000, 200000), (500000, 100000, 600000, 200000), (600000, 100000, 700000, 200000), (0, 0, 100000, 100000), (100000, 0, 200000, 100000), (200000, 0, 300000, 100000), (300000, 0, 400000, 100000), (400000, 0, 500000, 100000), (500000, 0, 600000, 100000), (600000, 0, 700000, 100000)))¶
# TODO.
- Parameters
bboxes (Tuple[BoundingBox, ...], optional) – # TODO. Defaults to BBOXES.
self (sds_data_model.vector._VectorLayer) –
- Returns
# TODO
- Return type