Raster
In [51]:
Copied!
from ipyleaflet import Map, ImageOverlay
m = Map(center=(25, -115), zoom=4)
image = ImageOverlay(
url="https://i.imgur.com/06Q1fSz.png",
# url='../06Q1fSz.png',
bounds=((13, -130), (32, -100)),
)
m.add(image)
m
from ipyleaflet import Map, ImageOverlay
m = Map(center=(25, -115), zoom=4)
image = ImageOverlay(
url="https://i.imgur.com/06Q1fSz.png",
# url='../06Q1fSz.png',
bounds=((13, -130), (32, -100)),
)
m.add(image)
m
Out[51]:
Map(center=[25, -115], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_t…
In [52]:
Copied!
import geohaye
import geohaye
In [53]:
Copied!
m = geohaye.Map()
url = "https://i.gifer.com/4j.gif"
# url='../06Q1fSz.png',
bounds = ((13, 100), (45, 130))
m.add_image(url, bounds)
m.add_layers_control()
# m.scroll_wheel_zoom = True
m
m = geohaye.Map()
url = "https://i.gifer.com/4j.gif"
# url='../06Q1fSz.png',
bounds = ((13, 100), (45, 130))
m.add_image(url, bounds)
m.add_layers_control()
# m.scroll_wheel_zoom = True
m
Out[53]:
Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…
In [54]:
Copied!
from localtileserver import TileClient, get_leaflet_tile_layer, examples
from ipyleaflet import Map
# Create a TileClient from a raster file
# client = TileClient('srtm90.tif')
client = TileClient(
"https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif"
)
# client = TileClient('https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif')
# client = examples.get_san_francisco() # use example data
# Create ipyleaflet TileLayer from that server
t = get_leaflet_tile_layer(client)
# Create ipyleaflet map, add tile layer, and display
m = Map()
m.add(t)
m.center = client.center()
m.zoom = client.default_zoom
m
from localtileserver import TileClient, get_leaflet_tile_layer, examples
from ipyleaflet import Map
# Create a TileClient from a raster file
# client = TileClient('srtm90.tif')
client = TileClient(
"https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif"
)
# client = TileClient('https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif')
# client = examples.get_san_francisco() # use example data
# Create ipyleaflet TileLayer from that server
t = get_leaflet_tile_layer(client)
# Create ipyleaflet map, add tile layer, and display
m = Map()
m.add(t)
m.center = client.center()
m.zoom = client.default_zoom
m
Out[54]:
Map(center=[37.630466999999996, -119.03021849999999], controls=(ZoomControl(options=['position', 'zoom_in_text…
In [69]:
Copied!
import geohaye
import geohaye
In [70]:
Copied!
m = geohaye.Map(add_layer_control=False)
data = "https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif"
m.add_raster(data, cmap="terrain", name="DEM")
m
m = geohaye.Map(add_layer_control=False)
data = "https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif"
m.add_raster(data, cmap="terrain", name="DEM")
m
c:\Users\Zako3\anaconda3\envs\geospatial24\Lib\site-packages\localtileserver\widgets.py:90: UserWarning: The `cmap` keyword argument is deprecated. Please use `colormap` instead. warnings.warn(
Out[70]:
Map(center=[37.630466999999996, -119.03021849999999], controls=(ZoomControl(options=['position', 'zoom_in_text…
In [71]:
Copied!
m.layers[0].interact(opacity=(0.0, 1.0, 0.1))
m.layers[0].interact(opacity=(0.0, 1.0, 0.1))
Out[71]:
Box(children=(FloatSlider(value=1.0, description='opacity', max=1.0),))
In [72]:
Copied!
m.layers
m.layers
Out[72]:
(TileLayer(attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', base=True, max_zoom=19, min_zoom=1, name='OpenStreetMap.Mapnik', options=['attribution', 'bounds', 'detect_retina', 'max_native_zoom', 'max_zoom', 'min_native_zoom', 'min_zoom', 'no_wrap', 'tile_size', 'tms', 'zoom_offset'], url='https://tile.openstreetmap.org/{z}/{x}/{y}.png'), BoundTileLayer(attribution="Raster file served by <a href='https://github.com/banesullivan/localtileserver' target='_blank'>localtileserver</a>.", bounds=((36.634011, -120.755927), (38.626923, -117.30451)), max_native_zoom=30, max_zoom=30, name='DEM', options=['attribution', 'bounds', 'detect_retina', 'max_native_zoom', 'max_zoom', 'min_native_zoom', 'min_zoom', 'no_wrap', 'tile_size', 'tms', 'zoom_offset'], show_loading=True, url='http://localhost:56689/api/tiles/{z}/{x}/{y}.png?&filename=%2Fvsicurl%3Furl%3Dhttps%253A%252F%252Fgithub.com%252Fopengeos%252Fdatasets%252Freleases%252Fdownload%252Fraster%252Fsrtm90.tif%26use_head%3Dno%26list_dir%3Dno&colormap=terrain'))
In [73]:
Copied!
client.center()
client.center()
Out[73]:
(37.630466999999996, -119.03021849999999)
In [74]:
Copied!
client.default_zoom
client.default_zoom
Out[74]:
7
In [76]:
Copied!
m.layers
m.layers
Out[76]:
(TileLayer(attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', base=True, max_zoom=19, min_zoom=1, name='OpenStreetMap.Mapnik', options=['attribution', 'bounds', 'detect_retina', 'max_native_zoom', 'max_zoom', 'min_native_zoom', 'min_zoom', 'no_wrap', 'tile_size', 'tms', 'zoom_offset'], url='https://tile.openstreetmap.org/{z}/{x}/{y}.png'), BoundTileLayer(attribution="Raster file served by <a href='https://github.com/banesullivan/localtileserver' target='_blank'>localtileserver</a>.", bounds=((36.634011, -120.755927), (38.626923, -117.30451)), max_native_zoom=30, max_zoom=30, name='DEM', options=['attribution', 'bounds', 'detect_retina', 'max_native_zoom', 'max_zoom', 'min_native_zoom', 'min_zoom', 'no_wrap', 'tile_size', 'tms', 'zoom_offset'], show_loading=True, url='http://localhost:56689/api/tiles/{z}/{x}/{y}.png?&filename=%2Fvsicurl%3Furl%3Dhttps%253A%252F%252Fgithub.com%252Fopengeos%252Fdatasets%252Freleases%252Fdownload%252Fraster%252Fsrtm90.tif%26use_head%3Dno%26list_dir%3Dno&colormap=terrain'))
In [77]:
Copied!
m
m
Out[77]:
Map(bottom=12882.0, center=[37.630466999999996, -119.03021849999999], controls=(ZoomControl(options=['position…