How to use the geoviews.Points function in geoviews

To help you get started, we’ve selected a few geoviews examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyviz-topics / EarthSim / earthsim / annotators.py View on Github external
def __init__(self, polys=None, points=None, crs=None, **params):
        super(GeoAnnotator, self).__init__(**params)
        plot_opts = dict(height=self.height, width=self.width)
        self.tiles = WMTS(self.tile_url, extents=self.extent,
                          crs=ccrs.PlateCarree()).opts(plot=plot_opts)
        polys = [] if polys is None else polys
        points = [] if points is None else points
        crs = ccrs.GOOGLE_MERCATOR if crs is None else crs
        self._tools = [CheckpointTool(), RestoreTool(), ClearTool()]
        if not isinstance(polys, Path):
            polys = self.path_type(polys, crs=crs)
        self._init_polys(polys)
        if not isinstance(points, Points):
            points = Points(points, self.polys.kdims, crs=crs)
        self._init_points(points)
github pyviz-topics / EarthSim / earthsim / annotators.py View on Github external
Provides support for drawing polygons and points on top of a map.
    """

    tile_url = param.String(default='http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png',
                            doc="URL for the tile source", precedence=-1)

    extent = param.NumericTuple(default=(np.nan,)*4, doc="""
         Initial extent if no data is provided.""", precedence=-1)

    path_type = param.ClassSelector(default=Polygons, class_=Path, is_instance=False, doc="""
         The element type to draw into.""")

    polys = param.ClassSelector(class_=Path, precedence=-1, doc="""
         Polygon or Path element to annotate""")

    points = param.ClassSelector(class_=Points, precedence=-1, doc="""
         Point element to annotate""")

    num_points = param.Integer(default=None, doc="""
         Maximum number of points to allow drawing (unlimited by default).""")

    num_polys = param.Integer(default=None, doc="""
         Maximum number of polygons to allow drawing (unlimited by default).""")

    node_style = param.Dict(default={'fill_color': 'indianred', 'size': 6}, doc="""
         Styling to apply to the node vertices.""")

    feature_style = param.Dict(default={'fill_color': 'blue', 'size': 10}, doc="""
         Styling to apply to the feature vertices.""")

    height = param.Integer(default=500, doc="Height of the plot",
                           precedence=-1)
github pyviz-topics / EarthSim / earthsim / analysis.py View on Github external
def _pos_indicator(self, obj, x):
        """
        Returns an NdOverlay of Points indicating the current
        mouse position along the cross-sections.

        Note: Because the function returns an NdOverlay containing
        a variable number of elements batching must be enabled and
        the legend_limit must be set to 0.
        """
        points = []
        elements = obj or []
        for el in elements:
            if len(el)<1:
                continue
            p = Points(el[x], ['x', 'y'], crs=ccrs.GOOGLE_MERCATOR)
            points.append(p)
        if not points:
            return NdOverlay({0: Points([], ['x', 'y'])})
        return NdOverlay(enumerate(points))
github pyviz-topics / EarthSim / earthsim / annotators.py View on Github external
    @param.output(points=gv.Points)
    def point_output(self):
        return self.point_stream.element
github pyviz-topics / EarthSim / earthsim / annotators.py View on Github external
def __init__(self, polys=None, points=None, crs=None, **params):
        super(GeoAnnotator, self).__init__(**params)
        plot_opts = dict(height=self.height, width=self.width)
        self.tiles = WMTS(self.tile_url, extents=self.extent,
                          crs=ccrs.PlateCarree()).opts(plot=plot_opts)
        polys = [] if polys is None else polys
        points = [] if points is None else points
        crs = ccrs.GOOGLE_MERCATOR if crs is None else crs
        self._tools = [CheckpointTool(), RestoreTool(), ClearTool()]
        if not isinstance(polys, Path):
            polys = self.path_type(polys, crs=crs)
        self._init_polys(polys)
        if not isinstance(points, Points):
            points = Points(points, self.polys.kdims, crs=crs)
        self._init_points(points)
github pyviz-topics / EarthSim / earthsim / analysis.py View on Github external
Returns an NdOverlay of Points indicating the current
        mouse position along the cross-sections.

        Note: Because the function returns an NdOverlay containing
        a variable number of elements batching must be enabled and
        the legend_limit must be set to 0.
        """
        points = []
        elements = obj or []
        for el in elements:
            if len(el)<1:
                continue
            p = Points(el[x], ['x', 'y'], crs=ccrs.GOOGLE_MERCATOR)
            points.append(p)
        if not points:
            return NdOverlay({0: Points([], ['x', 'y'])})
        return NdOverlay(enumerate(points))