Usage
Developer's Notes to Developers¶
For local development, install the package in editable mode:
In [ ]:
Copied!
## Run in terminal, not jupyter notebook
# pip install -e .
## Run in terminal, not jupyter notebook
# pip install -e .
Some packages imported for from local development process and examples below:
In [ ]:
Copied!
import ee
import geemap as gm
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
import os
import ee
import geemap as gm
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
import os
Demo begins here¶
Authenticate with Google Drive to access data for point extractions only:
In [ ]:
Copied!
# Initialize Earth Engine
import ee
ee.Authenticate()
ee.Initialize(project="ee-forestplotvariables")
# Initialize Earth Engine
import ee
ee.Authenticate()
ee.Initialize(project="ee-forestplotvariables")
Single-point extraction tool:
In [ ]:
Copied!
# !pip install forestspot # uncomment if need to install the package
import forestspot.point_extraction as spe
post = spe.PointExtraction().vbox
post
# !pip install forestspot # uncomment if need to install the package
import forestspot.point_extraction as spe
post = spe.PointExtraction().vbox
post
Aggregated-point extraction tool:
In [ ]:
Copied!
import forestspot.aggregated_point_extraction as sape
point = sape.AggregatedPointExtraction().vbox
point
import forestspot.aggregated_point_extraction as sape
point = sape.AggregatedPointExtraction().vbox
point
Buffering Approaches¶
Buffer coordinate to single point
In [ ]:
Copied!
import forestspot.buffer_coordinates as bc
single = bc.BufferCoordinates().vbox
single
import forestspot.buffer_coordinates as bc
single = bc.BufferCoordinates().vbox
single
Buffer coordinate to multiple points (n)
In [ ]:
Copied!
import forestspot.buffer_and_sample as sbs
multiple = sbs.Buffer().vbox
multiple
import forestspot.buffer_and_sample as sbs
multiple = sbs.Buffer().vbox
multiple
Mapping demo with forestspot and geemap¶
In [ ]:
Copied!
import forestspot.interactive as interactive
map = interactive.Map()
# path = "../data/1000.0ft.csv"
# map.add_points(path)
path1 = "../data/selected_coordinates.csv"
map.add_points(path1)
map
import forestspot.interactive as interactive
map = interactive.Map()
# path = "../data/1000.0ft.csv"
# map.add_points(path)
path1 = "../data/selected_coordinates.csv"
map.add_points(path1)
map
In [ ]:
Copied!
import geemap as gm
import ipyleaflet
import geemap as gm
import ipyleaflet
Demonstration of buffering approach¶
In [ ]:
Copied!
m = gm.Map(center=(45, -100), zoom=4)
# path = "../data/3000.0.geojson"
# m.add_geojson(path)
path1 = "../data/selected_coordinates.csv"
coordinates = pd.read_csv(path1)
gdf = gpd.GeoDataFrame(
coordinates,
geometry=gpd.points_from_xy(coordinates.LON, coordinates.LAT),
crs="EPSG:4326", # Directly set CRS during creation
)
point_style = {
"radius": 4,
"color": "black",
"dashArray": "2",
"fillOpacity": 1,
"fillColor": "red",
"weight": 1,
} # 'color': 'white',
geo_data = ipyleaflet.GeoData(
geo_dataframe=gdf,
point_style=point_style,
)
m.add(geo_data)
path2 = "../data/3000.0ft.csv"
coordinates2 = pd.read_csv(path2)
gdf2 = gpd.GeoDataFrame(
coordinates2,
geometry=gpd.points_from_xy(coordinates2.LON, coordinates2.LAT),
crs="EPSG:4326", # Directly set CRS during creation
)
point_style = {
"radius": 2,
"color": "black",
"dashArray": "2",
"fillOpacity": 1,
"fillColor": "blue",
"weight": 1,
} # 'color': 'white',
geo_data2 = ipyleaflet.GeoData(
geo_dataframe=gdf2,
point_style=point_style,
)
m.add(geo_data2)
m
m = gm.Map(center=(45, -100), zoom=4)
# path = "../data/3000.0.geojson"
# m.add_geojson(path)
path1 = "../data/selected_coordinates.csv"
coordinates = pd.read_csv(path1)
gdf = gpd.GeoDataFrame(
coordinates,
geometry=gpd.points_from_xy(coordinates.LON, coordinates.LAT),
crs="EPSG:4326", # Directly set CRS during creation
)
point_style = {
"radius": 4,
"color": "black",
"dashArray": "2",
"fillOpacity": 1,
"fillColor": "red",
"weight": 1,
} # 'color': 'white',
geo_data = ipyleaflet.GeoData(
geo_dataframe=gdf,
point_style=point_style,
)
m.add(geo_data)
path2 = "../data/3000.0ft.csv"
coordinates2 = pd.read_csv(path2)
gdf2 = gpd.GeoDataFrame(
coordinates2,
geometry=gpd.points_from_xy(coordinates2.LON, coordinates2.LAT),
crs="EPSG:4326", # Directly set CRS during creation
)
point_style = {
"radius": 2,
"color": "black",
"dashArray": "2",
"fillOpacity": 1,
"fillColor": "blue",
"weight": 1,
} # 'color': 'white',
geo_data2 = ipyleaflet.GeoData(
geo_dataframe=gdf2,
point_style=point_style,
)
m.add(geo_data2)
m