Skip to content

image image image

Edit Vector Data Interactively

Uncomment the following line to install leafmap if needed.

1
# %pip install -U leafmap
1
from leafmap import leafmap

Edit points

1
2
3
4
5
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.

1
m.save_edits("cities.geojson")

Edit lines

1
2
3
4
5
6
7
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
1
m.save_edits("nyc_roads.geojson")

Edit polygons

1
2
3
4
5
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
1
m.save_edits("nyc_buildings.geojson")

image