Key Features¶
You can try out geotask by using the cloud-computing platforms below without having to install anything on your computer:
Install geotask¶
In [1]:
Copied!
# !pip install geotask geopandas
# !pip install geotask geopandas
Use ipyleaflet plotting backend¶
In [2]:
Copied!
import os
import geotask
import os
import geotask
Create an interactive map¶
In [3]:
Copied!
m = geotask.Map(center=(40, -100), zoom=4)
m
m = geotask.Map(center=(40, -100), zoom=4)
m
Out[3]:
Customize map height¶
In [4]:
Copied!
m = geotask.Map(height="400px", width="800px")
m
m = geotask.Map(height="400px", width="800px")
m
Out[4]:
Change basemaps¶
In [5]:
Copied!
m = geotask.Map()
m.add_basemap("OpenTopoMap")
m
m = geotask.Map()
m.add_basemap("OpenTopoMap")
m
Out[5]:
Add XYZ tile layer¶
In [6]:
Copied!
m = geotask.Map()
m.add_tile_layer(
url="https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}",
name="Google Satellite",
attribution="Google",
)
m
m = geotask.Map()
m.add_tile_layer(
url="https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}",
name="Google Satellite",
attribution="Google",
)
m
Out[6]:
Add Raster layer¶
In [7]:
Copied!
m = geotask.Map()
m.add_raster(
data = 'https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif',
name = 'DEM'
)
m
m = geotask.Map()
m.add_raster(
data = 'https://github.com/opengeos/datasets/releases/download/raster/srtm90.tif',
name = 'DEM'
)
m
Out[7]:
Add GeoJSON¶
In [8]:
Copied!
m = geotask.Map(center=[0, 0], zoom=2)
in_geojson = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cable_geo.geojson"
m.add_geojson(in_geojson, layer_name="Cable lines")
m
m = geotask.Map(center=[0, 0], zoom=2)
in_geojson = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cable_geo.geojson"
m.add_geojson(in_geojson, layer_name="Cable lines")
m
Out[8]:
In [9]:
Copied!
# Add a GeoJSON with random filled color to the map.
m = geotask.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson"
style = {"fillOpacity": 0.5}
m.add_geojson(
url,
layer_name="Countries",
style=style,
fill_colors=["red", "yellow", "green", "orange"],
)
m
# Add a GeoJSON with random filled color to the map.
m = geotask.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson"
style = {"fillOpacity": 0.5}
m.add_geojson(
url,
layer_name="Countries",
style=style,
fill_colors=["red", "yellow", "green", "orange"],
)
m
Out[9]:
In [10]:
Copied!
# Use custom style and hover_style functions.
m = geotask.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson"
style = {
"stroke": True,
"color": "#0000ff",
"weight": 2,
"opacity": 1,
"fill": True,
"fillColor": "#0000ff",
"fillOpacity": 0.1,
}
hover_style = {"fillOpacity": 0.7}
m.add_geojson(url, layer_name="Countries", style=style, hover_style=hover_style)
m
# Use custom style and hover_style functions.
m = geotask.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson"
style = {
"stroke": True,
"color": "#0000ff",
"weight": 2,
"opacity": 1,
"fill": True,
"fillColor": "#0000ff",
"fillOpacity": 0.1,
}
hover_style = {"fillOpacity": 0.7}
m.add_geojson(url, layer_name="Countries", style=style, hover_style=hover_style)
m
Out[10]:
Add shapefile¶
In [11]:
Copied!
m = geotask.Map(center=[0, 0], zoom=2)
in_shp = "https://github.com/opengeos/leafmap/raw/master/examples/data/countries.zip"
m.add_shp(in_shp, layer_name="Countries")
m
m = geotask.Map(center=[0, 0], zoom=2)
in_shp = "https://github.com/opengeos/leafmap/raw/master/examples/data/countries.zip"
m.add_shp(in_shp, layer_name="Countries")
m
Out[11]:
Add GeoDataFrame¶
In [12]:
Copied!
import geopandas as gpd
from geotask import utils
csv = "https://raw.githubusercontent.com/opengeos/data/main/world/world_cities.csv"
df = utils.csv_to_df(csv)
m = geotask.Map()
m.add_points(df)
m
import geopandas as gpd
from geotask import utils
csv = "https://raw.githubusercontent.com/opengeos/data/main/world/world_cities.csv"
df = utils.csv_to_df(csv)
m = geotask.Map()
m.add_points(df)
m
Out[12]:
Save map to HTML¶
In [13]:
Copied!
m = geotask.Map()
m.add_basemap("Esri.NatGeoWorldMap")
m
m = geotask.Map()
m.add_basemap("Esri.NatGeoWorldMap")
m
Out[13]: