repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
liuxb555/earthengine-py-examples | Join/intersect.py | <filename>Join/intersect.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
def intersect(state):
nPowerPlants = ee.List(state.get('power_plants')).size()
# Return the state feature with a new property: power plant count.
return state.set('n_power_plan... |
liuxb555/earthengine-py-examples | Datasets/Terrain/hydrosheds_dem.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('WWF/HydroSHEDS/03CONDEM')
elevation = dataset.select('b1')
elevationVis = {
'min': -50.0,
'max': 3000.0,
'gamma': 2.0,
}
Map.setCenter(-121.652, 38.022, 8)
Map.addLayer(elevation, elev... |
liuxb555/earthengine-py-examples | Datasets/Water/glcf_global_inland_water.py | <gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.ImageCollection('GLCF/GLS_WATER')
water = dataset.select('water').mosaic()
waterVis = {
'min': 1.0,
'max': 4.0,
'palette': ['FAFAFA', '00C5FF', 'DF73FF', '828282', 'CCCCCC'],... |
liuxb555/earthengine-py-examples | FeatureCollection/metadata_aggregation.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
def cal_area(feature):
num = ee.Number.parse(feature.get('areasqkm'))
return feature.set('areasqkm', num)
# Load watersheds from a data table.
sheds = ee.FeatureCollection('USGS/WBD/2017/HUC06') \
.f... |
liuxb555/earthengine-py-examples | Algorithms/resampling.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat image over San Francisco, California, UAS.
landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20160323')
# Set display and visualization parameters.
Map.setCenter(-122.37383, 37.6193, 15)... |
liuxb555/earthengine-py-examples | Image/expressions.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 8 image.
image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318')
# Compute the EVI using an expression.
evi = image.expression(
'2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE +... |
liuxb555/earthengine-py-examples | ImageCollection/filtering_by_calendar_range.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
roi = ee.Geometry.Point([-99.2182, 46.7824])
# find images acquired during June and July
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA') \
.filterBoun... |
liuxb555/earthengine-py-examples | FeatureCollection/column_statistics_multiple.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
fromFT = ee.FeatureCollection("users/wqs/Pipestem/Pipestem_HUC10")
geom = fromFT.geometry()
Map.centerObject(fromFT)
Map.addLayer(ee.Image().paint(geom, 0, 2), {}, 'Watersheds')
stats = fromFT.reduceColumns(*... |
liuxb555/earthengine-py-examples | Image/conditional_operations.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 8 image.
image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318')
# Create NDVI and NDWI spectral indices.
ndvi = image.normalizedDifference(['B5', 'B4'])
ndwi = image.normalizedDiffer... |
liuxb555/earthengine-py-examples | AssetManagement/export_table.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
fromFT = ee.FeatureCollection('ft:1CLldB-ULPyULBT2mxoRNv7enckVF0gCQoD2oH7XP')
polys = fromFT.geometry()
centroid = polys.centroid()
lng, lat = centroid.getInfo()['coordinates']
# print("lng = {}, lat = {}".for... |
liuxb555/earthengine-py-examples | Gena/map_get_center.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# add some data to the Map
dem = ee.Image("AHN/AHN2_05M_RUW")
Map.addLayer(dem, {'min': -5, 'max': 50, 'palette': ['000000', 'ffffff'] }, 'DEM', True)
# zoom in somewh... |
liuxb555/earthengine-py-examples | ImageCollection/sort_by_cloud_and_date.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# This function masks the input with a threshold on the simple cloud score.
def cloudMask(img):
cloudscore = ee.Algorithms.Landsat.simpleCloudScore(img).select('cloud')
return img.updateMask(cloudscor... |
liuxb555/earthengine-py-examples | NAIP/ndwi_timeseries.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
def subsetNAIP(img_col, startTime, endTime, fc):
img = img_col.filterDate(startTime, endTime).filterBounds(fc).mosaic().clip(fc)
return img
def calNDWI(image, threshold):
"""A function to compute... |
liuxb555/earthengine-py-examples | Datasets/Terrain/us_physiography.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('CSP/ERGo/1_0/US/physiography')
physiography = dataset.select('constant')
physiographyVis = {
'min': 1100.0,
'max': 4220.0,
}
Map.setCenter(-105.4248, 40.5242, 8)
Map.addLayer(physiograph... |
liuxb555/earthengine-py-examples | Gena/map_center_object.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# get a single feature
countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
country = countries.filter(ee.Filter.eq('country_na', 'Ukraine'))
Map.addLayer(country... |
liuxb555/earthengine-py-examples | Algorithms/landsat_path_row_limit.py | <filename>Algorithms/landsat_path_row_limit.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
point = ee.Geometry.Point(-98.7011, 47.2624)
collection = ee.ImageCollection('LANDSAT/LC8_L1T_TOA') \
.filterBounds(point) \
.filterDate('2016-01-01', '2018-1... |
liuxb555/earthengine-py-examples | GetStarted/09_a_complete_example.py | <filename>GetStarted/09_a_complete_example.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# This function gets NDVI from a Landsat 8 image.
def addNDVI(image):
return image.addBands(image.normalizedDifference(['B5', 'B4']))
# This function masks cl... |
liuxb555/earthengine-py-examples | Visualization/us_counties.py | <filename>Visualization/us_counties.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.FeatureCollection('TIGER/2018/Counties')
visParams = {
'palette': ['purple', 'blue', 'green', 'yellow', 'orange', 'red'],
'min': 0,
'max': 50,
'opacit... |
liuxb555/earthengine-py-examples | Image/symbology.py | <filename>Image/symbology.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
cover = ee.Image('MODIS/051/MCD12Q1/2012_01_01').select('Land_Cover_Type_1')
igbpPalette = [
'aec3d4',
'152106', '225129', '369b47', '30eb5b', '387242',
'6a2325', 'c3aa... |
liuxb555/earthengine-py-examples | Visualization/landsat_symbology.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
geometry = ee.Geometry.Point([-122.30287513732901, 37.441115780341605])
landsat = ee.ImageCollection("LANDSAT/LC08/C01/T1") \
.filterDate('2016-01-01', '2017-01-01') \
.filterBounds(geometry)
composi... |
liuxb555/earthengine-py-examples | Datasets/Terrain/alos_global_dsm.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('JAXA/ALOS/AW3D30_V1_1')
elevation = dataset.select('AVE')
elevationVis = {
'min': 0.0,
'max': 4000.0,
'palette': ['0000ff', '00ffff', 'ffff00', 'ff0000', 'ffffff'],
}
Map.setCenter(136... |
liuxb555/earthengine-py-examples | Datasets/Vectors/global_power_plant_database.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Visualization for WRI/GPPD/power_plants
# https:#code.earthengine.google.com/9efbd726e4a8ba9b8b56ba94f1267678
table = ee.FeatureCollection("WRI/GPPD/power_plants")
# Get a color from a fuel
fuelColor = ee.... |
liuxb555/earthengine-py-examples | Image/convolutions.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load and display an image.
image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318')
Map.setCenter(-121.9785, 37.8694, 11)
Map.addLayer(image, {'bands': ['B5', 'B4', 'B3'], 'max': 0.5}, 'input image')
... |
liuxb555/earthengine-py-examples | Reducer/min_max_reducer.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load and filter the Sentinel-2 image collection.
collection = ee.ImageCollection('COPERNICUS/S2') \
.filterDate('2016-01-01', '2016-12-31') \
.filterBounds(ee.Geometry.Point([-81.31, 29.90]))
# Reduc... |
liuxb555/earthengine-py-examples | Datasets/Vectors/us_census_roads.py | <reponame>liuxb555/earthengine-py-examples<filename>Datasets/Vectors/us_census_roads.py<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
fc = ee.FeatureCollection('TIGER/2016/Roads')
Map.setCenter(-73.9596, 40.7688, 12)
Map.addLayer(fc, {}, '... |
liuxb555/earthengine-py-examples | ImageCollection/filtering_by_metadata.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
region = ee.Geometry.Polygon(
[[[121.89674377441406, 11.91539248304918],
[121.98291778564453, 11.93218823174339],
[121.95236206054688, 12.020516709145957],
[121.86378679003906, 12.00674877... |
liuxb555/earthengine-py-examples | Image/extract_value_to_points.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Input imagery is a cloud-free Landsat 8 composite.
l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1')
image = ee.Algorithms.Landsat.simpleComposite(**{
'collection': l8.filterDate('2018-01-01', '2018-12-31'),... |
liuxb555/earthengine-py-examples | FeatureCollection/count_features.py | #!/usr/bin/env python
"""Count features example.
Count Panoramio photos near SF that mention bridges.
"""
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
Map.setCenter(-122.39, 37.7857, 12)
photos_near_sf = ee.FeatureCollection('GOOGLE/EE/DEMOS/sf-photo-l... |
liuxb555/earthengine-py-examples | Image/download.py |
#!/usr/bin/env python
"""Download example."""
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Get a download URL for an image.
image1 = ee.Image('srtm90_v4')
path = image1.getDownloadUrl({
'scale': 30,
'crs': 'EPSG:4326',
'region': '[[-120, 35... |
liuxb555/earthengine-py-examples | Algorithms/landsat_surface_reflectance.py | <reponame>liuxb555/earthengine-py-examples<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# You can access pre-computed surface reflectance images directly from the SR collections. For example, to load a Landsat 7 surface reflectance image, ... |
liuxb555/earthengine-py-examples | Image/gradients.py | <gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 8 image and select the panchromatic band.
image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318').select('B8')
# Compute the image gradient in the X and Y directions.
xyG... |
liuxb555/earthengine-py-examples | Datasets/Vectors/resolve_ecoregions.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
def set_color(f):
c = ee.String(f.get('COLOR')).slice(1)
return f \
.set('R', ee.Number.parse(c.slice(0, 2), 16)) \
.set('G', ee.Number.parse(c.slice(2, 4), 16)) \
.set('B', ee.... |
liuxb555/earthengine-py-examples | Gena/hillshade_and_water.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
from ee_plugin.contrib import palettes
dem = ee.Image("JAXA/ALOS/AW3D30_V1_1").select('MED')
dem = dem.updateMask(dem.gt(0))
palette = palettes.cb['Pastel1'][7]
#palett... |
liuxb555/earthengine-py-examples | FeatureCollection/add_area_column.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
fromFT = ee.FeatureCollection("users/wqs/Pipestem/Pipestem_HUC10")
# This function computes the feature's geometry area and adds it as a property.
def addArea(feature):
return feature.set({'areaHa': feature.... |
liuxb555/earthengine-py-examples | FeatureCollection/select_by_attributes.py |
#!/usr/bin/env python
"""Select by attributes
"""
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Select North Dakota and South Dakota
fc = ee.FeatureCollection('TIGER/2018/States') \
.filter(ee.Filter.Or(
ee.Filter.eq('STUSPS', 'ND'),
... |
liuxb555/earthengine-py-examples | ImageCollection/convert_imagecollection_to_image.py | <gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
images = ee.ImageCollection('MODIS/MCD43A4') \
.filterDate('2017-01-01', '2017-01-31') \
.select(['Nadir_Reflectance_Band1'])
# unmask to ensure we have the same number of values every... |
liuxb555/earthengine-py-examples | Datasets/Terrain/srtm_topo_diversity.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('CSP/ERGo/1_0/Global/SRTM_topoDiversity')
srtmTopographicDiversity = dataset.select('constant')
srtmTopographicDiversityVis = {
'min': 0.0,
'max': 1.0,
}
Map.setCenter(-111.313, 39.724, 6... |
liuxb555/earthengine-py-examples | Image/rename_bands.py | <reponame>liuxb555/earthengine-py-examples<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
image = ee.Image('LANDSAT/LC8_L1T/LC80260412017023LGN00')
b5 = image.select('B5')
Map.centerObject(image, 10)
Map.addLayer(image, {}, 'Band 5')
sele... |
liuxb555/earthengine-py-examples | Visualization/nwi_wetlands_symbology.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# NWI legend: https://www.fws.gov/wetlands/Data/Mapper-Wetlands-Legend.html
def nwi_add_color(fc):
emergent = ee.FeatureCollection(
fc.filter(ee.Filter.eq('WETLAND_TY', 'Freshwater Emergent Wetland'... |
liuxb555/earthengine-py-examples | Image/relational_operators.py | <gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a 2012 nightlights image.
nl2012 = ee.Image('NOAA/DMSP-OLS/NIGHTTIME_LIGHTS/F182012')
lights = nl2012.select('stable_lights')
# Define arbitrary thresholds on the 6-bit stable lights ba... |
liuxb555/earthengine-py-examples | FeatureCollection/select_columns.py | <gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
fc = ee.FeatureCollection('TIGER/2018/States')
print(fc.first().getInfo())
new_fc = fc.select(['STUSPS', 'NAME', 'ALAND'], ['abbr', 'name', 'area'])
print(new_fc.first().getInfo())
property... |
liuxb555/earthengine-py-examples | Array/array_sorting.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Define an arbitrary region of interest as a point.
roi = ee.Geometry.Point(-122.26032, 37.87187)
# Use these bands.
bandNames = ee.List(['B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B10', 'B11'])
# Load a Landsat 8... |
liuxb555/earthengine-py-examples | FeatureCollection/map_function.py | <filename>FeatureCollection/map_function.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
def addArea(feature):
return feature.set({'areaHa': feature.geometry().area().divide(100 * 100)})
# Load watersheds from a data table.
sheds = ee.FeatureCollecti... |
liuxb555/earthengine-py-examples | Reducer/mean_std_image.py | <reponame>liuxb555/earthengine-py-examples<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 8 image.
image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318')
# Combine the mean and standard deviation reducers.
reducers = ... |
liuxb555/earthengine-py-examples | Visualization/image_clipping.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318')
centroid = image.geometry().centroid().coordinates()
lon = centroid.get(0).getInfo()
lat = centroid.get(1).getInfo()
# Create an NDWI image, defi... |
liuxb555/earthengine-py-examples | Reducer/stats_of_an_image_region.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load input imagery: Landsat 7 5-year composite.
image = ee.Image('LANDSAT/LE7_TOA_5YEAR/2008_2012')
# print(image.getInfo())
# Load an input region: Sierra Nevada.
region = ee.Feature(ee.FeatureCollection('E... |
liuxb555/earthengine-py-examples | Image/set_image_properties.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
def addDate(image):
# parse date stored in 'system:index'
date = ee.Date(image.get('system:index'))
# format date, see http:#www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html... |
liuxb555/earthengine-py-examples | FeatureCollection/set_properties.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Make a feature and set some properties.
feature = ee.Feature(ee.Geometry.Point([-122.22599, 37.17605])) \
.set('genus', 'Sequoia').set('species', 'sempervirens')
... |
liuxb555/earthengine-py-examples | Array/array_transformations.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
import math
# This function masks the input with a threshold on the simple cloud score.
def cloudMask(img):
cloudscore = ee.Algorithms.Landsat.simpleCloudScore(img).select('cloud')
return img.updateMask(clo... |
liuxb555/earthengine-py-examples | Image/select_bands.py | <filename>Image/select_bands.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load an image.
image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318')
band345 = image.select(['B[3-5]'])
bandNames = band345.bandNames()
print(bandNames.getInfo())
# ... |
liuxb555/earthengine-py-examples | Image/clamp.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# ee.Image.clamp() example.
# Clamp the values of all bands in an image to lie within the specified range.
# Values below the low value of that range are set to low v... |
liuxb555/earthengine-py-examples | FeatureCollection/minimum_bounding_geometry.py | <reponame>liuxb555/earthengine-py-examples<filename>FeatureCollection/minimum_bounding_geometry.py<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
HUC10 = ee.FeatureCollection("USGS/WBD/2017/HUC10")
HUC08 = ee.FeatureCollection('USGS/WBD/201... |
liuxb555/earthengine-py-examples | Image/zero_crossing.py | <gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Mark pixels where the elevation crosses 1000m value and compare
# that to pixels that are exactly equal to 1000m.
elev = ee.Image('CGIAR/SRTM90_V4')
# A zero-crossing is defined as any pixe... |
liuxb555/earthengine-py-examples | Datasets/us_cropland.py |
# Metadata: https://developers.google.com/earth-engine/datasets/catalog/USDA_NASS_CDL
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.ImageCollection('USDA/NASS/CDL') \
.filter(ee.Filter.date('2017-01-01', '2018-12-31')) \
... |
liuxb555/earthengine-py-examples | AssetManagement/exporting_data.py | <reponame>liuxb555/earthengine-py-examples<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
image = ee.Image('USDA/NAIP/DOQQ/m_4609915_sw_14_1_20100629')
# downConfig = {'scale':30, "maxPixels": 1.0E13, 'driveFolder':'test', 'CRS': 'EPGS:319... |
liuxb555/earthengine-py-examples | Algorithms/landsat_simple_composite.py | <filename>Algorithms/landsat_simple_composite.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a raw Landsat 5 ImageCollection for a single year.
collection = ee.ImageCollection('LANDSAT/LT05/C01/T1') \
.filterDate('2010-01-01', '2010-12-31')
#... |
liuxb555/earthengine-py-examples | Datasets/Terrain/alos_topo_diversity.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('CSP/ERGo/1_0/Global/ALOS_topoDiversity')
alosTopographicDiversity = dataset.select('constant')
alosTopographicDiversityVis = {
'min': 0.0,
'max': 1.0,
}
Map.setCenter(-111.313, 39.724, 6... |
liuxb555/earthengine-py-examples | Image/hough_transform.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# An example finding linear features using the HoughTransform.
# Load an image and compute NDVI.
image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_033032_20170719')
ndvi = image.normalizedDifference(['B5', 'B4'])... |
liuxb555/earthengine-py-examples | Datasets/usda_naip.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
roi = ee.FeatureCollection('TIGER/2018/States') \
.filter(ee.Filter.eq('STUSPS', 'ND'));
dataset = ee.ImageCollection('USDA/NAIP/DOQQ') \
.filter(... |
liuxb555/earthengine-py-examples | Image/pixel_lon_lat.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Draws 60 lat/long lines per degree using the pixelLonLat() function.
# Create an image in which the value of each pixel is its
# coordinates in minutes.
img = ee.Image.pixelLonLat().multiply(60.0)
# Get the... |
liuxb555/earthengine-py-examples | ImageCollection/map_function.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# This function adds a band representing the image timestamp.
def addTime(image):
return image.addBands(image.metadata('system:time_start'))
def conditional(image)... |
liuxb555/earthengine-py-examples | Array/quality_mosaic.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Array-based quality mosaic.
# Returns a mosaic built by sorting each stack of pixels by the first band
# in descending order, and taking the highest quality pixel.
# function qualityMosaic(bands) {
def quali... |
liuxb555/earthengine-py-examples | Array/decorrelation_stretch.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Decorrelation Stretch
def dcs(image, region, scale):
# function dcs(image, region, scale) {
bandNames = image.bandNames()
# The axes are numbered, so to make the following code more
# readable, give t... |
liuxb555/earthengine-py-examples | FeatureCollection/idw_interpolation.py | <filename>FeatureCollection/idw_interpolation.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
def sampling(sample):
lat = sample.get('latitude')
lon = sample.get('longitude')
ch4 = sample.get('ch4')
return ee.Feature(ee.Geometry.Point([lon... |
liuxb555/earthengine-py-examples | Image/object_based.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Make an area of interest geometry centered on San Francisco.
point = ee.Geometry.Point(-122.1899, 37.5010)
aoi = point.buffer(10000)
# Import a Landsat 8 image, subset the thermal band, and clip to the
# are... |
liuxb555/earthengine-py-examples | FeatureCollection/random_samples.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Define an arbitrary region in which to compute random points.
region = ee.Geometry.Rectangle(-119.224, 34.669, -99.536, 50.064)
# Create 1000 random points in the region.
randomPoints = ee.FeatureCollection.... |
liuxb555/earthengine-py-examples | Image/pixel_area.py | <filename>Image/pixel_area.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Displays the decreasing area covered by a single pixel at
# higher latitudes using the Image.pixelArea() function.
# Create an image in which the value of each pixel is its area... |
liuxb555/earthengine-py-examples | qgis_to_geemap.py | <reponame>liuxb555/earthengine-py-examples
"""This script is used to convert Earth Engine QGIS examples to geemap.
"""
import os
import geemap
from pathlib import Path
def conversion(in_file, out_file):
in_file = os.path.abspath(in_file)
out_file = os.path.abspath(out_file)
out_dir = os.path.dirname(out_... |
liuxb555/earthengine-py-examples | Image/image_metadata.py | <filename>Image/image_metadata.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
image = ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00')
bandNames = image.bandNames()
print('Band names: ', bandNames.getInfo()) # ee.List
b1proj = image.select('B1').projec... |
liuxb555/earthengine-py-examples | MachineLearning/cart_classifier.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Input imagery is a cloud-free Landsat 8 composite.
l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1')
image = ee.Algorithms.Landsat.simpleComposite(**{
'collection': ... |
liuxb555/earthengine-py-examples | Algorithms/CloudMasking/landsat8_toa_reflectance_qa_band.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# This example demonstrates the use of the Landsat 8 QA band to mask clouds.
# Function to mask clouds using the quality band of Landsat 8.
# maskL8 = function(image)... |
liuxb555/earthengine-py-examples | Image/image_displacement.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
import math
# Load the two images to be registered.
image1 = ee.Image('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL/s01_20150502T082736Z')
image2 = ee.Image('SKYSAT/GEN-A/PUBLIC/ORTHO/MULTISPECTRAL/s01_20150305T0810... |
liuxb555/earthengine-py-examples | Datasets/Vectors/us_census_tracts.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.FeatureCollection('TIGER/2010/Tracts_DP1')
visParams = {
'min': 0,
'max': 4000,
'opacity': 0.8,
}
# Turn the strings into numbers
dataset = dataset.map(lambda f: f.set('shape_area', ee.Numbe... |
liuxb555/earthengine-py-examples | Datasets/Water/jrc_monthly_recurrence.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.ImageCollection('JRC/GSW1_1/MonthlyRecurrence').first()
monthlyRecurrence = dataset.select('monthly_recurrence')
monthlyRecurrenceVis = {
'min': 0.0,
'max': 100.0,
'palette': ['ffffff', 'ffbb... |
liuxb555/earthengine-py-examples | FeatureCollection/merge_feature_collections.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
SD = ee.FeatureCollection('TIGER/2018/States') \
.filter(ee.Filter.eq('STUSPS', 'SD'))
ND = ee.FeatureCollection('TIGER/2018/States') \
.filter(ee.Filter.eq('STUSPS', 'ND'))
states = SD.merge(ND)
Map... |
liuxb555/earthengine-py-examples | HowEarthEngineWorks/DeferredExecution.py | import ee
image = ee.Image('CGIAR/SRTM90_V4')
operation = image.add(10)
# print(operation.getInfo())
print(operation)
# Display the map.
Map
|
liuxb555/earthengine-py-examples | ImageCollection/overview.py | <filename>ImageCollection/overview.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Create arbitrary constant images.
constant1 = ee.Image(1)
constant2 = ee.Image(2)
# Create a collection by giving a list to the constructor.
collectionFromConstructor = ... |
liuxb555/earthengine-py-examples | Visualization/color_by_attribute.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
fc = ee.FeatureCollection('TIGER/2018/States')
print(fc.first().getInfo())
# Use this empty image for paint().
empty = ee.Image().byte()
palette = ['green', 'yellow', 'orange', 'red']
states = empty.paint(... |
liuxb555/earthengine-py-examples | Datasets/Terrain/us_ned_physio_diversity.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('CSP/ERGo/1_0/US/physioDiversity')
physiographicDiversity = dataset.select('b1')
physiographicDiversityVis = {
'min': 0.0,
'max': 1.0,
}
Map.set... |
liuxb555/earthengine-py-examples | Image/edge_detection.py | <reponame>liuxb555/earthengine-py-examples<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 8 image, select the panchromatic band.
image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318').select('B8')
# Perform Canny edge... |
liuxb555/earthengine-py-examples | Gena/basic_image.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
image = ee.Image.pixelLonLat() \
.add([180, 90]).divide([360, 180])
# image = image.multiply(50).sin()
Map.setCenter(0, 28, 2.5)
Map.addLayer(image, {}, 'coords',... |
liuxb555/earthengine-py-examples | GetStarted/01_hello_world.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# traditional python string
print('Hello world!')
# Earth Eninge object
print(ee.String('Hello World from Earth Engine!').getInfo())
print(ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318').getInfo())
# Disp... |
liuxb555/earthengine-py-examples | Datasets/Vectors/world_database_on_protected_areas.py | <filename>Datasets/Vectors/world_database_on_protected_areas.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.FeatureCollection('WCMC/WDPA/current/polygons')
visParams = {
'palette': ['2ed033', '5aff05', '67b9ff', '5844ff', '0a7618', '2c05ff... |
liuxb555/earthengine-py-examples | Array/spectral_unmixing.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Array-based spectral unmixing.
# Create a mosaic of Landsat 5 images from June through September, 2007.
allBandMosaic = ee.ImageCollection('LANDSAT/LT05/C01/T1') \
.filterDate('2007-06-01', '2007-09-30') \... |
liuxb555/earthengine-py-examples | Reducer/median_reducer.py | <filename>Reducer/median_reducer.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load an image collection, filtered so it's not too much data.
collection = ee.ImageCollection('LANDSAT/LT05/C01/T1') \
.filterDate('2008-01-01', '2008-12-31') \
.filter... |
liuxb555/earthengine-py-examples | Image/spectral_unmixing.py | <reponame>liuxb555/earthengine-py-examples<filename>Image/spectral_unmixing.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 5 image and select the bands we want to unmix.
bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7']
image = ee.Image... |
liuxb555/earthengine-py-examples | Image/image_overview.py | <gh_stars>10-100
import ee
image1 = ee.Image(1)
print(image1)
print(image1.getInfo())
image2 = ee.Image(2)
image3 = ee.Image.cat([image1, image2])
print(image3.getInfo())
multiband = ee.Image([1, 2, 3])
print(multiband)
renamed = multiband.select(['constant','constant_1','constant_2'],['band1','band2','band3'])
pri... |
liuxb555/earthengine-py-examples | FeatureCollection/select_by_strings.py | <reponame>liuxb555/earthengine-py-examples<filename>FeatureCollection/select_by_strings.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
#!/usr/bin/env python
"""Select by strings
"""
# Select states with "A" in its name
fc = ee.FeatureCollection('TIGER/... |
liuxb555/earthengine-py-examples | Datasets/Vectors/usgs_watershed_boundary.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.FeatureCollection('USGS/WBD/2017/HUC02')
styleParams = {
'fillColor': '000070',
'color': '0000be',
'width': 3.0,
}
regions = dataset.style(**styleParams)
Map.setCenter(-96.8, 40.43, 4)
Map.a... |
liuxb555/earthengine-py-examples | Datasets/Water/jrc_metadata.py | <filename>Datasets/Water/jrc_metadata.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('JRC/GSW1_1/Metadata')
detectionsObservations = dataset.select(['detections', 'valid_obs', 'total_obs'])
visParams = {
'min': 100.0,
'max': 900.0,... |
liuxb555/earthengine-py-examples | FeatureCollection/creating_feature.py | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Create an ee.Geometry.
polygon = ee.Geometry.Polygon([
[[-35, -10], [35, -10], [35, 10], [-35, 10], [-35, -10]]
])
# Create a Feature from the Geometry.
polyFeature = ee.Feature(polygon, {'foo': 42, 'bar':... |
liuxb555/earthengine-py-examples | Datasets/Terrain/us_ned.py | <filename>Datasets/Terrain/us_ned.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.Image('USGS/NED')
elevation = dataset.select('elevation')
elevationVis = {
'min': 0.0,
'max': 4000.0,
'gamma': 1.6,
}
Map.setCenter(-100.55, 40.71, 5)
Map... |
liuxb555/earthengine-py-examples | Datasets/Terrain/canada_dem.py | <filename>Datasets/Terrain/canada_dem.py
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.ImageCollection('NRCan/CDEM')
elevation = dataset.select('elevation').mosaic()
elevationVis = {
'min': -50.0,
'max': 1500.0,
'palette': ['0905ff', 'ff... |
liuxb555/earthengine-py-examples | NAIP/from_name.py | <reponame>liuxb555/earthengine-py-examples<gh_stars>10-100
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
image = ee.Image('USDA/NAIP/DOQQ/m_3712213_sw_10_1_20140613')
Map.setCenter(-122.466123, 37.769833, 17)
Map.addLayer(image, {'bands': ['N', 'R','G']}, '... |
liuxb555/earthengine-py-examples | Image/convert_bands_to_image_collection.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318')
print("Number of bands:", image.bandNames().size().getInfo())
imageCollection = ee.ImageCollection(image.bandNames().map(lambda b: image.select([b])... |
liuxb555/earthengine-py-examples | ImageCollection/linear_fit.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Compute the trend of nighttime lights from DMSP.
# Add a band containing image date as years since 1990.
def createTimeBand(img):
year = img.date().difference(ee.... |
liuxb555/earthengine-py-examples | Datasets/Vectors/us_epa_ecoregions.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
dataset = ee.FeatureCollection('EPA/Ecoregions/2013/L3')
visParams = {
'palette': ['0a3b04', '1a9924', '15d812'],
'min': 23.0,
'max': 3.57e+11,
'opacity': 0.8,
}
image = ee.Image().float().paint(datase... |
liuxb555/earthengine-py-examples | Visualization/ndwi_symbology.py |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# This function gets NDVI from Landsat 5 imagery.
def getNDWI(image):
return image.normalizedDifference(['B3', 'B5'])
image1 = ee.Image('LANDSAT/LT05/C01/T1_TOA/LT05_044034_19900604')
# Compute NDVI fr... |
liuxb555/earthengine-py-examples | Algorithms/sentinel-1_filtering.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load the Sentinel-1 ImageCollection.
sentinel1 = ee.ImageCollection('COPERNICUS/S1_GRD') \
.filterBounds(ee.Geometry.Point(-122.37383, 37.6193))
# Filter by met... |
liuxb555/earthengine-py-examples | GetStarted/06_reducing.py | <reponame>liuxb555/earthengine-py-examples
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 8 collection.
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1') \
.filterBounds(ee.Geometry.Point(-122.262, 37.8719)) \
.filterDate('2014-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.