-
Notifications
You must be signed in to change notification settings - Fork 3
Basic Usage
geoapis is designed to be used as a library. See Package Install for installation instructions.
This saves all LiDAR datasets within the polygon in the specified location on your computer. Each datasets tile in the polygon is saved in a folder with the datasets name.
import geoapis.lidar
lidar_fetcher = geoapis.lidar.OpenTopography(polygon, r"local/path/to/folder/to/save/files", verbose=True)
lidar_fetcher.run()
This returns unlimited vector layers from either the LINZ, LRIS or Stats NZ data services. Call run for each layer you would like to be returned. The vector is returned as a geopandas.GeoDataFrame.
import geoapis.vector
vector_fetcher = geoapis.vector.Linz("LINZ_API_KEY", bounding_polygon=polygon, verbose=True)
vector_layer_1 = vector_fetcher.run(layer_id_1)
vector_layer_2 = vector_fetcher.run(layer_id_2)
This class will locally download all LiDAR tiles from datasets within the specified polygon at a specified local directory.
class OpenTopography:
""" A class to manage fetching LiDAR data from Open Topography
API details for querying datasets within a search rectangle at:
https://portal.opentopography.org/apidocs/#/Public/getOtCatalog
Information for making a `bulk download` of a dataset using the AWS S3 protocol can be found by clicking on bulk
download under any dataset.
"""
def __init__(self, catchment_polygon: geopandas.geodataframe.GeoDataFrame,
cache_path: typing.Union[str, pathlib.Path], redownload_files: bool = False,
download_limit_gbytes: typing.Union[int, float] = 100, verbose: bool = False)
...
def run(self):
""" Query for LiDAR data within a catchment and download any that hasn't already been downloaded """
These classes share the same interface and will locally download all vectors from the specified LINZ Data Service layer within the specified polygon at a specified local directory.
class Linz/Lris/StatsNz:
""" An class to manage fetching Vector data using WFS.
API details at: https://www.ogc.org/standards/wfs or
https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/wfs-spatial-filtering
The specified vector layer is queried each time run is called, and any layer features passing though the
optionally defined bounding_polygon are returned. If no bounding_polygon is specified all layer features
are returned.
Flexibility exists in the inputs. Only the key is required. If no bounding_polygon is specified all features
in a layer will be downloaded. If no crs is specified, the bounding_polygon will be used if the bounding_polygon
is specified. If no CRS or bounding_polygon is specified the CRS of the downloaded features will be used. """
def __init__(self, key: str, crs: int = None, bounding_polygon: geopandas.geodataframe.GeoDataFrame = None,
verbose: bool = False):
""" Load in vector information from LINZ. Specify the layer to import during run.
"""
...
def run(self, layer: int, geometry_name: str = "") -> geopandas.GeoDataFrame:
""" Query for a specified layer and return a geopandas.GeoDataFrame of the vector features. If a
polygon_boundary is specified, only return vectors passing through this polygon. """