How to use the ipyleaflet.GeoJSON function in ipyleaflet

To help you get started, we’ve selected a few ipyleaflet 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 deeplook / ipyrest / ipyrest / responseviews.py View on Github external
def render(self, resp: requests.models.Response) -> ipyleaflet.Map:
        "Return an ipyleaflet map with the GeoJSON object rendered on it, or None."

        obj = resp.json()
        if obj.get('type', None) != 'FeatureCollection':
            return None
        bbox = geojson_bbox(obj)
        mins, maxs = bbox
        center = list(reversed(bbox_center(*bbox)))
        z = zoom_for_bbox(*(mins + maxs))
        m = ipyleaflet.Map(center=center, zoom=z + 1)
        m.add_layer(layer=ipyleaflet.GeoJSON(data=obj))
        self.data = m
        return m
github gee-community / gee_tools / geetools / ui / ipymap.py View on Github external
:type inspect: dict
        :return: the name of the added layer
        :rtype: str
        """
        thename = name if name else 'Geometry {}'.format(self.addedGeometries)

        # Check if layer exists
        if thename in self.EELayers.keys():
            if not replace:
                print("Layer with name '{}' exists already, please choose another name".format(thename))
                return
            else:
                self.removeLayer(thename)

        params = getGeojsonTile(geometry, thename, inspect)
        layer = ipyleaflet.GeoJSON(data=params['geojson'],
                                   name=thename,
                                   popup=HTML(params['pop']))

        self._add_EELayer(thename, {'type': 'Geometry',
                                    'object': geometry,
                                    'visParams':None,
                                    'layer': layer})
        return thename
github fitoprincipe / ipygee / ipygee / map.py View on Github external
:type inspect: dict
        :return: the name of the added layer
        :rtype: str
        """
        thename = name if name else 'Geometry {}'.format(self.addedGeometries)

        # Check if layer exists
        if thename in self.EELayers.keys():
            if not replace:
                print("Layer with name '{}' exists already, please choose another name".format(thename))
                return
            else:
                self.removeLayer(thename)

        params = getGeojsonTile(geometry, thename, inspect)
        layer = ipyleaflet.GeoJSON(data=params['geojson'],
                                   name=thename,
                                   popup=HTML(params['pop']))

        self._add_EELayer(thename, {'type': 'Geometry',
                                    'object': geometry,
                                    'visParams':None,
                                    'layer': layer})
        return thename
github gee-community / gee_tools / geetools / ui / ipymap.py View on Github external
:type inspect: dict
        :return: the name of the added layer
        :rtype: str
        """
        thename = name if name else 'Feature {}'.format(self.addedGeometries)

        # Check if layer exists
        if thename in self.EELayers.keys():
            if not replace:
                print("Layer with name '{}' exists already, please choose another name".format(thename))
                return
            else:
                self.removeLayer(thename)

        params = getGeojsonTile(feature, thename, inspect)
        layer = ipyleaflet.GeoJSON(data=params['geojson'],
                                   name=thename,
                                   popup=HTML(params['pop']))

        self._add_EELayer(thename, {'type': 'Feature',
                                    'object': feature,
                                    'visParams': None,
                                    'layer': layer})
        return thename
github fitoprincipe / ipygee / ipygee / map.py View on Github external
:type inspect: dict
        :return: the name of the added layer
        :rtype: str
        """
        thename = name if name else 'Feature {}'.format(self.addedGeometries)

        # Check if layer exists
        if thename in self.EELayers.keys():
            if not replace:
                print("Layer with name '{}' exists already, please choose another name".format(thename))
                return
            else:
                self.removeLayer(thename)

        params = getGeojsonTile(feature, thename, inspect)
        layer = ipyleaflet.GeoJSON(data=params['geojson'],
                                   name=thename,
                                   popup=HTML(params['pop']))

        self._add_EELayer(thename, {'type': 'Feature',
                                    'object': feature,
                                    'visParams': None,
                                    'layer': layer})
        return thename