Uncomment the following line to install geemap if needed.
In [1]:
Copied!
# !pip install geemap
# !pip install geemap
In [2]:
Copied!
import geemap
import geemap
In [3]:
Copied!
# geemap.update_package()
# geemap.update_package()
In [4]:
Copied!
Map = geemap.Map(center=[0, 0], zoom=2)
in_geojson = 'https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/cable-geo.geojson'
Map.add_geojson(in_geojson, layer_name="Cable lines")
Map
Map = geemap.Map(center=[0, 0], zoom=2)
in_geojson = 'https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/cable-geo.geojson'
Map.add_geojson(in_geojson, layer_name="Cable lines")
Map
Out[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [5]:
Copied!
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/countries.geojson"
Map.add_geojson(
url, layer_name="Countries", fill_colors=['red', 'yellow', 'green', 'orange']
)
Map
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/countries.geojson"
Map.add_geojson(
url, layer_name="Countries", fill_colors=['red', 'yellow', 'green', 'orange']
)
Map
Out[5]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [6]:
Copied!
import random
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/countries.geojson"
def random_color(feature):
return {
'color': 'black',
'fillColor': random.choice(['red', 'yellow', 'green', 'orange']),
}
Map.add_geojson(url, layer_name="Countries", style_callback=random_color)
Map
import random
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/countries.geojson"
def random_color(feature):
return {
'color': 'black',
'fillColor': random.choice(['red', 'yellow', 'green', 'orange']),
}
Map.add_geojson(url, layer_name="Countries", style_callback=random_color)
Map
Out[6]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [7]:
Copied!
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/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}
Map.add_geojson(url, layer_name="Countries", style=style, hover_style=hover_style)
Map
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/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}
Map.add_geojson(url, layer_name="Countries", style=style, hover_style=hover_style)
Map
Out[7]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [8]:
Copied!
Map = geemap.Map(center=[0, 0], zoom=2)
in_shp = '../data/countries.shp'
Map.add_shapefile(in_shp, layer_name="Countries")
Map
Map = geemap.Map(center=[0, 0], zoom=2)
in_shp = '../data/countries.shp'
Map.add_shapefile(in_shp, layer_name="Countries")
Map
Out[8]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [9]:
Copied!
Map = geemap.Map()
in_kml = '../data/us-states.kml'
Map.add_kml(in_kml, layer_name="US States KML")
Map
Map = geemap.Map()
in_kml = '../data/us-states.kml'
Map.add_kml(in_kml, layer_name="US States KML")
Map
Out[9]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [10]:
Copied!
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/countries.geojson"
Map.add_vector(
url, layer_name="Countries", fill_colors=['red', 'yellow', 'green', 'orange']
)
Map
Map = geemap.Map(center=[0, 0], zoom=2)
url = "https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/countries.geojson"
Map.add_vector(
url, layer_name="Countries", fill_colors=['red', 'yellow', 'green', 'orange']
)
Map
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [10], in <cell line: 3>() 1 Map = geemap.Map(center=[0, 0], zoom=2) 2 url = "https://raw.githubusercontent.com/giswqs/geemap/master/examples/data/countries.geojson" ----> 3 Map.add_vector( 4 url, layer_name="Countries", fill_colors=['red', 'yellow', 'green', 'orange'] 5 ) 6 Map AttributeError: 'Map' object has no attribute 'add_vector'
For folium¶
In [11]:
Copied!
import geemap.foliumap as geemap
import geemap.foliumap as geemap
In [12]:
Copied!
Map = geemap.Map()
Map = geemap.Map()
In [13]:
Copied!
in_shp = '../data/countries.shp'
in_geojson = '../data/us-states.json'
in_kml = '../data/us-states.kml'
in_shp = '../data/countries.shp'
in_geojson = '../data/us-states.json'
in_kml = '../data/us-states.kml'
In [14]:
Copied!
Map.add_shapefile(in_shp, layer_name="Shapefile")
Map.add_shapefile(in_shp, layer_name="Shapefile")
In [15]:
Copied!
Map.add_geojson(in_geojson, layer_name="GeoJSON")
Map.add_geojson(in_geojson, layer_name="GeoJSON")
In [16]:
Copied!
Map.add_kml(in_kml, layer_name="KML")
Map.add_kml(in_kml, layer_name="KML")
In [17]:
Copied!
Map
Map
Out[17]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Last update:
2022-03-14