Beispiel #1
0
    def get_facets(self):
        """Attempts to get Global PAM facets.

        Returns:
            list of dict: A list of facets for the gridset.
        """
        return RestService.get(self, '{}/gridset'.format(self.end_point))
Beispiel #2
0
    def get(self, gridset_id, interface=None):
        """Attempts to get a gridset.

        Args:
            gridset_id (int): The identifier of the gridset to retrieve.
            interface (str): The format interface the gridset should be returned as.

        Returns:
            xml string: Returned if the interface is 'xml'
            dict: A JSON dictionary of gridset metadata.
        """
        return RestService.get(self,
                               '{}/{}'.format(self.end_point, gridset_id),
                               interface=interface)
Beispiel #3
0
    def get(self, scenario_id, interface=None):
        """Attempts to get a scenario.

        Args:
            scenario_id (int): The identifier of the scenario to retrieve.
            interface (str): The format to return the scenario in.

        Returns:
            str: XML metadata for the scenario.
            dict: JSON dictionary of scenario metadata.
        """
        return RestService.get(self,
                               '{}/{}'.format(self.end_point, scenario_id),
                               interface=interface)
Beispiel #4
0
    def get_tree(self, gridset_id, interface=None):
        """Attempts to get a tree for the specified gridset.

        Args:
            gridset_id (int): The identifier of the gridset to retrieve tree.
            interface (str): The format interface to return the gridset tree.


        Returns:
            str: A tree formatted as newick or nexus, specified by the interface
                parameter.
        """
        return RestService.get(self,
                               '{}/{}/tree'.format(self.end_point, gridset_id),
                               interface=interface)
Beispiel #5
0
    def get(self, occurrence_id, interface=None):
        """Attempts to retrieve the occurrence set specified by the ID.

        Args:
            occurrence_id (int): The ID number of the occurrence set to
                retrieve.
            interface (:obj:`str`, optional): If provided, request the response
                in this interface.

        Returns:
            dict: A JSON dictionary of occurrence set metadata.
        """
        return RestService.get(
            self, '{}{}'.format(self.end_point, occurrence_id),
            interface=interface)
Beispiel #6
0
    def get(self, sdmproject_id, interface=None):
        """Attempts to get a projection.

        Args:
            sdmproject_id (int): The identifier of the projection to retrieve.
            interface (str): The format to return the projection as.

        Returns:
            str: XML projection metadata.
            dict: A JSON dictionary of projection metadata.
            bytes: Binary projection data as a GeoTIFF.
        """
        return RestService.get(self,
                               '{}/{}'.format(self.end_point, sdmproject_id),
                               interface=interface)
Beispiel #7
0
    def get(self, tree_id, interface=None):
        """Attempts to retrieve the tree specified by the ID.

        Args:
            tree_id (int): The ID number of the tree to retrieve.
            interface (:obj:`str`, optional): If provided, request the response in this
                interface.

        Returns:
            str: XML metadata about the tree.
            dict: JSON dictionary metadata about the tree.
        """
        return RestService.get(self,
                               '{}{}'.format(self.end_point, tree_id),
                               interface=interface)
Beispiel #8
0
    def get(self, layer_id, interface=None):
        """Attempts to get a layer.

        Args:
            layer_id (int): The identifier of the layer to be retrieved.
            interface (:obj:`str`, optional): The format in which to return the
                layer.  Valid formats are eml, json and either gtiff or
                shapefile.

        Returns:
            dict: Layer metadata in JSON format.
        """
        return RestService.get(self,
                               '{}/{}'.format(self.end_point, layer_id),
                               interface=interface)
Beispiel #9
0
    def get(self, env_layer_id, interface=None):
        """Attempts to get an environmental layer.

        Args:
            env_layer_id (int): The identifier of the environmental layer to be
                retrieved.
            interface (:obj:`str`, optional): The format in which to return the
                environmental layer.  Valid formats are eml, gtiff and json.

        Returns:
            dict - Returned if JSON interface is selected.
            bytes - Returned if GTIFF interface is selected.
            xml string - Returned if the EML interface is selected.
        """
        return RestService.get(self,
                               '{}/{}'.format(self.end_point, env_layer_id),
                               interface=interface)
Beispiel #10
0
    def get(self, shapegrid_id, interface=None):
        """Attempts to get a shapegrid.

        Args:
            shapegrid_id (int): The database identifier of the shapegrid to
                attempt to retrieve.
            interface (:obj:`str`, optional): The requested interface, or
                format, for the shapegrid to be returned as.  Valid options
                are: EML, JSON (default), GeoJSON, and SHAPEFILE.

        Returns:
            dict: If the interface is set to JSON or GEO_JSON, returns a
                dictionary
            bytes: If the interface is set to SHAPEFILE, the zipped shapefile
                is returned.
        """
        return RestService.get(self,
                               '{}/{}'.format(self.end_point, shapegrid_id),
                               interface=interface)
Beispiel #11
0
    def get(self,
            map_name,
            bbox=None,
            bgcolor=None,
            color=None,
            coverage=None,
            crs=None,
            exceptions=None,
            height=None,
            layer=None,
            layers=None,
            request=None,
            format=None,
            service=None,
            sld=None,
            sld_body=None,
            srs=None,
            styles=None,
            time=None,
            transparent=None,
            version=None,
            width=None):
        """Attempts to get a map or coverage matching the provided parameters.

        Args:
            map_name (str): The name of the map file that contains the data to
                be retrieved.  This can be found in the map.mapName value of
                the related Lifemapper object's JSON interface.
            bbox (str): The bounding box of the region to be returned in the
                format: minx,miny,maxx,maxy.
            bgcolor (str): Hexadecimal RGB color for the background of the map
                response (if WMS).
            color: The color to use for the data in the response image (if
                WMS).
            coverage (str): The data coverage to retrieve, this should be the
                same value as the Lifemapper spatial object's map.layerName
                attribute.
            crs (str): The coordinate reference system for the map or data
                response.
            exceptions (str): The format in which exceptions are to be reported
                (default is XML).
            height (int): The height, in pixels, of the response WMS map.
            layer (str): The layer in a map file to be retrieved.  This can be
                found in a Lifemapper spatial object's map.layerName attribute.
            layers (str): A comma-separated list of layers to retrieve from a
                map file.  These layers will be stacked and returned as a
                single image.
            request (str): The request operation name to perform.
            format (str): The desired response format MIME-Type.
            service (str): The OGC service to use (WCS | WMS).
            sld (str): A URL referencing a StyledLayerDescriptor XML file which
                controls or enhances map layers and styling.
            sld_body (str): A URL-encoded StyledLayerDescriptor XML document
                which controls or enhances map layers and styling.
            srs (str): The spatial reference system for the map output.  'crs'
                for version 1.3.0.
            styles (str): A list of styles for the response.
            time (str): A time or time range for map requests.
            transparent (str): Boolean indicating if the background of the map
                should be transparent (TRUE | FALSE).
            version (str): Teh version of the service to use.
            width (int): The width, in pixels, of the response WMS map.

        Returns:
            bytes - Image or data from OGC W*S end-point.
        """
        return RestService.get(self,
                               self.end_point,
                               map_name=map_name,
                               bbox=bbox,
                               bgcolor=bgcolor,
                               color=color,
                               coverage=coverage,
                               crs=crs,
                               exceptions=exceptions,
                               height=height,
                               layer=layer,
                               layers=layers,
                               request=request,
                               format=format,
                               service=service,
                               sld=sld,
                               sld_body=sld_body,
                               srs=srs,
                               styles=styles,
                               time=time,
                               transparent=transparent,
                               version=version,
                               width=width)