In [1]:
Copied!
# %pip install -U leafmap
# %pip install -U leafmap
In [2]:
Copied!
from leafmap import leafmap
from leafmap import leafmap
Edit points¶
In [3]:
Copied!
m = leafmap.Map(center=[40, -100], zoom=4)
# Load any vector dataset that can be loaded by GeoPandas
geojson_url = "https://github.com/opengeos/datasets/releases/download/us/cities.geojson"
m.edit_points(geojson_url)
m
m = leafmap.Map(center=[40, -100], zoom=4)
# Load any vector dataset that can be loaded by GeoPandas
geojson_url = "https://github.com/opengeos/datasets/releases/download/us/cities.geojson"
m.edit_points(geojson_url)
m
Save the edits to a new file. Choose any of the supported formats by GeoPandas, such as GeoJSON, Shapefile, or GeoPackage.
In [4]:
Copied!
m.save_edits("cities.geojson")
m.save_edits("cities.geojson")
Edit lines¶
In [5]:
Copied!
m = leafmap.Map()
# Load any vector dataset that can be loaded by GeoPandas
geojson_url = (
"https://github.com/opengeos/datasets/releases/download/places/nyc_roads.geojson"
)
m.edit_lines(geojson_url)
m
m = leafmap.Map()
# Load any vector dataset that can be loaded by GeoPandas
geojson_url = (
"https://github.com/opengeos/datasets/releases/download/places/nyc_roads.geojson"
)
m.edit_lines(geojson_url)
m
In [6]:
Copied!
m.save_edits("nyc_roads.geojson")
m.save_edits("nyc_roads.geojson")
Edit polygons¶
In [7]:
Copied!
m = leafmap.Map()
# Load any vector dataset that can be loaded by GeoPandas
geojson_url = "https://github.com/opengeos/datasets/releases/download/places/nyc_buildings.geojson"
m.edit_polygons(geojson_url)
m
m = leafmap.Map()
# Load any vector dataset that can be loaded by GeoPandas
geojson_url = "https://github.com/opengeos/datasets/releases/download/places/nyc_buildings.geojson"
m.edit_polygons(geojson_url)
m
In [8]:
Copied!
m.save_edits("nyc_buildings.geojson")
m.save_edits("nyc_buildings.geojson")