src.digitaltwin.get_data_using_geoapis ====================================== .. py:module:: src.digitaltwin.get_data_using_geoapis .. autoapi-nested-parse:: This script provides functions to retrieve vector data from multiple providers, including StatsNZ, LINZ, LRIS, and MFE, using the 'geoapis' library. To access data from each provider, you'll need to set an API key in the environment variables. Classes ------- .. autoapisummary:: src.digitaltwin.get_data_using_geoapis.MFE Functions --------- .. autoapisummary:: src.digitaltwin.get_data_using_geoapis.clean_fetched_vector_data src.digitaltwin.get_data_using_geoapis.fetch_vector_data_using_geoapis Module Contents --------------- .. py:class:: MFE Bases: :py:obj:`geoapis.vector.WfsQueryBase` A class to manage fetching Vector data from MFE. General details at: https://data.mfe.govt.nz/ API details at: https://help.koordinates.com/ Note that the 'GEOMETRY_NAMES' used when making WFS 'cql_filter' queries varies between layers. The MFE generally follows the LINZ LDS but uses 'Shape' in place of 'shape'. It still uses 'GEOMETRY'. .. py:attribute:: NETLOC_API :value: 'data.mfe.govt.nz' .. py:attribute:: GEOMETRY_NAMES :value: ['GEOMETRY', 'Shape'] .. py:function:: clean_fetched_vector_data(fetched_data: geopandas.GeoDataFrame) -> geopandas.GeoDataFrame Clean the fetched vector data by performing necessary transformations. :param fetched_data: A GeoDataFrame containing the fetched vector data. :type fetched_data: gpd.GeoDataFrame :returns: A GeoDataFrame containing the cleaned vector data. :rtype: gpd.GeoDataFrame .. py:function:: fetch_vector_data_using_geoapis(data_provider: str, layer_id: int, crs: int = 2193, verbose: bool = False, bounding_polygon: Optional[geopandas.GeoDataFrame] = None) -> geopandas.GeoDataFrame Fetch vector data using 'geoapis' based on the specified data provider, layer ID, and other parameters. :param data_provider: The data provider to use. Supported values: "StatsNZ", "LINZ", "LRIS", "MFE". :type data_provider: str :param layer_id: The ID of the layer to fetch. :type layer_id: int :param crs: The coordinate reference system (CRS) code to use. Default is 2193. :type crs: int = 2193 :param verbose: Whether to print messages. Default is False. :type verbose: bool = False :param bounding_polygon: Bounding polygon for data fetching. Default is all of New Zealand. :type bounding_polygon: Optional[gpd.GeoDataFrame] = None :returns: A GeoDataFrame containing the fetched vector data. :rtype: gpd.GeoDataFrame :raises ValueError: If an unsupported 'data_provider' value is provided.