def __init__(self): self.url_wms = 'http://wms.geosampa.prefeitura.sp.gov.br/geoserver/geoportal/wms' self.wms = WebMapService(self.url_wms, version='1.3.0') self.coords_wgs84 = [-23.545567989349365, -46.6351979970932] self.center = self.coords_wgs84 self.mapa_base = WMSLayer( url = self.url_wms, layers = 'MapaBase_Politico', format = 'image/png', transparent = True, attribution = 'GeoSampa' ) self.lotes = WMSLayer( url = 'http://wms.geosampa.prefeitura.sp.gov.br/geoserver/geoportal/wms', layers = 'lote_cidadao', format = 'image/png', transparent = True, attribution = 'GeoSampa' ) self.transformer = Transformer.from_crs(31983, 4326) self.marker = Marker(location=self.center, draggable=True) self.shape = ''
def draw_interactive_map(): """ Draws interactive map to be able to draw/define a region of interest """ wms_drillholes = WMSLayer( url='http://geo.loop-gis.org/geoserver/loop/wms?', layers='loop:collar_4326', format='image/png', transparent=True, attribution='Drilhole collar from GSWA', name='drillhole collars' ) wms_geol = WMSLayer( url='http://geo.loop-gis.org/geoserver/loop/wms?', layers='loop:2_5m_interpgeop15_4326', format='image/png', transparent=True, opacity=0.4, attribution='Geology data from GSWA', name='geology' ) m =Map(basemap=basemaps.OpenTopoMap, center=(-29,116.5), zoom=8,scroll_wheel_zoom=True) m.add_layer(wms_geol) m.add_layer(wms_drillholes) m.add_control(LayersControl()) dc = DrawControl(rectangle={'shapeOptions': {'color': '#0000FF'}}) m.add_control(dc) m
def bdc_plot_datasets(datasets, zoom=4, layout=Layout(width='600px', height='600px')): """Plot Dataset tiles """ bbox = get_bounds(datasets, datasets[0].crs) bbox_pol = shapely.wkt.loads(bbox.wkt) project = partial(pyproj.transform, pyproj.Proj(datasets[0].crs.crs_str), pyproj.Proj(init='epsg:4674')) bbox_pol_wgs84 = transform(project, bbox_pol) bbox = bbox_pol_wgs84.bounds center = ((bbox[1] + bbox[3]) / 2, (bbox[0] + bbox[2]) / 2) m = Map(basemap=basemaps.Esri.WorldImagery, center=center, zoom=zoom, layout=layout) grid = WMSLayer( url='http://brazildatacube.dpi.inpe.br/bdc/geoserver/grids/ows', layers='BDC_GRID', styles='tiles', format='image/png', transparent=True, tile_size=512) m.add_layer(grid) if len(datasets): project = partial(pyproj.transform, pyproj.Proj(datasets[0].crs.crs_str), pyproj.Proj(init='epsg:4674')) plotted = [] for ds in datasets: idt = "{},{};{},{}".format(ds.metadata.lon[0], ds.metadata.lat[0], ds.metadata.lon[1], ds.metadata.lat[1]) if idt not in plotted: plotted.append(idt) # apply projection ds_pol = transform(project, shapely.wkt.loads(ds.extent.wkt)) x, y = ds_pol.exterior.xy points = [(y1, x1) for x1, y1 in zip(x, y)] polygon = Polygon(locations=points, color="#0033CC", fill_color="#388b8b", weight=2, fill_opacity=.6) m.add_layer(polygon) return m
name="Esri National Geographic", ), "Esri Shaded Relief": TileLayer( url="https://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}", attribution="Esri", name="Esri Shaded Relief", ), "Esri Physical Map": TileLayer( url="https://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}", attribution="Esri", name="Esri Physical Map", ), "FWS NWI Wetlands": WMSLayer( url="https://www.fws.gov/wetlands/arcgis/services/Wetlands/MapServer/WMSServer?", layers="1", name="FWS NWI Wetlands", attribution="FWS", format="image/png", transparent=True, ), "FWS NWI Wetlands Raster": WMSLayer( url="https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer?", layers="0", name="FWS NWI Wetlands Raster", attribution="FWS", format="image/png", transparent=True, ), "Google Maps": TileLayer( url="https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}", attribution="Google", name="Google Maps",
attribution='Esri', name='Esri Shaded Relief', ), 'Esri Physical Map': TileLayer( url= 'https://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}', attribution='Esri', name='Esri Physical Map', ), 'FWS NWI Wetlands': WMSLayer( url= 'https://www.fws.gov/wetlands/arcgis/services/Wetlands/MapServer/WMSServer?', layers='1', name='FWS NWI Wetlands', attribution='FWS', format='image/png', transparent=True, ), 'FWS NWI Wetlands Raster': WMSLayer( url= 'https://www.fws.gov/wetlands/arcgis/services/Wetlands_Raster/ImageServer/WMSServer?', layers='0', name='FWS NWI Wetlands Raster', attribution='FWS', format='image/png', transparent=True, ), 'Google Maps':