Beispiel #1
0
except ImportError:
    print('Installing geemap ...')
    subprocess.check_call(["python", '-m', 'pip', 'install', 'geemap'])

# %%
import ee
import geemap

# %%
"""
## Create an interactive map 
The default basemap is `Google Maps`. [Additional basemaps](https://github.com/giswqs/geemap/blob/master/geemap/basemaps.py) can be added using the `Map.add_basemap()` function. 
"""

# %%
Map = geemap.Map(center=[40, -100], zoom=4)
Map

# %%
"""
## Add Earth Engine Python script 
"""

# %%
# Add Earth Engine dataset
# Compute the Principal Components of a Landsat 8 image.

# Load a landsat 8 image, select the bands of interest.
image = ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00') \
  .select(['B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B10', 'B11'])
except Exception as e:
    ee.Authenticate()
    ee.Initialize()

# get data
dataset = ee.Image('USGS/SRTMGL1_003');
elevation = dataset.select('elevation');
table = ee.FeatureCollection("users/pratik_unterwegs/hula_valley");

# clip data
elevation_clip = elevation.clip(table.geometry());

# visualisation
sld_ramp =   '<RasterSymbolizer>' +     '<ColorMap type="ramp" extended="false" >' +       '<ColorMapEntry color="#0D0887" quantity="0" label="0"/>' +       '<ColorMapEntry color="#CC4678" quantity="200" label="300" />' +       '<ColorMapEntry color="#F0F921" quantity="400" label="500" />' +     '</ColorMap>' +   '</RasterSymbolizer>';

# print layers
vis = {'bands': ['elevation']}
Map = geemap.Map(center=[36.0005,-78.9], zoom=12)
Map.addLayer(elevation_clip.sldStyle(sld_ramp), {}, 'elevation')
Map.addLayer(table)
Map.addLayerControl()

Map

# export image to drive
downConfig = {'scale': 30, "maxPixels": 1.0E13, 'driveFolder': 'srtm_30'}  # scale means resolution.
name = "srtm_30"
# print(name)
task = ee.batch.Export.image(elevation_clip, name, downConfig)
task.start()
Beispiel #3
0
Dpair['20170411'] = get_pair('20170411', '20170420')
Dpair['20170902'] = get_pair('20170902', '20170911')
Dpair['20170918'] = get_pair('20170918', '20170911')
Dpair['20171105'] = get_pair('20171105', '20171114')
Dpair['20181108'] = get_pair('20181108', '20181117')
Dpair['20181210'] = get_pair('20181210', '20181203')
Dpair['20190228'] = get_pair('20190228', '20190221')
Dpair['20191127'] = get_pair('20191127', '20191206')
Dpair['20200114'] = get_pair('20200114', '20200107')
Dpair['20200302'] = get_pair('20200302', '20200224')
Dpair['20200403'] = get_pair('20200403', '20200412')
Dpair['20200419'] = get_pair('20200419', '20200412')

#########
# MAP All the images and their corresponding mNDWI
m = geemap.Map(location=[-30, -64], zoom_start=8)
for i, k in enumerate(Dpair.keys()):
    IMAGE = get_image(Dpair[k])
    IMAGE = addmNDWI(IMAGE)
    si = str(i) + ". "
    m.addLayer(IMAGE, {
        "bands": ['B4', 'B3', 'B2'],
        "min": 0,
        "max": 2000
    },
               si + k,
               shown=False)
    m.addLayer(IMAGE, {
        "bands": ['mNDWI'],
        "min": -1,
        "max": 1
Beispiel #4
0
try:
    import geemap
except ImportError:
    print('geemap package is not installed. Installing ...')
    subprocess.check_call(["python", '-m', 'pip', 'install', 'geemap'])

# Import libraries
import os
import ee
import geemap
import ipywidgets as widgets
from bqplot import pyplot as plt
from ipyleaflet import WidgetControl

# Create an interactive map
Map = geemap.Map(center=[40, -100], zoom=4, add_google_map=False)
Map.add_basemap('HYBRID')
Map.add_basemap('ROADMAP')

# Add Earth Engine data
fc = ee.FeatureCollection('TIGER/2018/Counties')
Map.addLayer(fc, {}, 'US Counties')

states = ee.FeatureCollection('TIGER/2018/States')
# Map.addLayer(states, {}, 'US States')

Map

# Designe interactive widgets

style = {'description_width': 'initial'}
Beispiel #5
0
    BUCKET_NAME, OBJECT_TO_RETRIEVE)
if status == False:
    print(
        'UNABLE TO RETRIEVE OBJECT...could not retrieve date from Object Storage'
    )
    send_mail.write_to_file('ERROR-OBJ_STORE_RETRV', filename_or_error)
    raise Exception(filename_or_error)
else:
    print(status, filename_or_error)

df1 = pd.read_csv(filename_or_error)
location = list(df1['location'])
mail = list(df1['mail id'])
farm_name = list(df1['farm_name'])
threshold = list(df1['threshold'])
Map = geemap.Map()

r1 = {
    "January": {
        "NDVI": {
            "min": 0.61,
            "max": 0.75
        },
        "EVI": {
            "min": 1.233,
            "max": 1.550
        }
    },
    "February": {
        "NDVI": {
            "min": 0.71,
import ee
import geemap

try:
    ee.Initialize()
except Exception as e:
    ee.Authenticate()
    ee.Initialize()

# Create an interactive map
Map = geemap.Map(center=(40, -100), zoom=4)
Map

# Add Earth Engine dataset
image = ee.Image('USGS/SRTMGL1_003')

# Set visualization parameters.
vis_params = {
    'min': 0,
    'max': 4000,
    'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']
}

# Print the elevation of Mount Everest.
xy = ee.Geometry.Point([86.9250, 27.9881])
elev = image.sample(xy, 30).first().get('elevation').getInfo()
print('Mount Everest elevation (m):', elev)

# Add Earth Engine layers to Map
Map.addLayer(image, vis_params, 'STRM DEM', True, 0.5)
Map.addLayer(xy, {'color': 'red'}, 'Mount Everest')
# map get temp over iamges
l5_temp = l5_filtered_clouds.map(get_temp)
l5_temp_mean = l5_temp.select('temp').mean()

# In[45]:

# var rgb_viz = {min: 20, max: 35, bands:['B6'],
#   palette: ["#0D0887FF", "#4C02A1FF", "#7E03A8FF", "#A92395FF", "#CC4678FF",
#             "#E56B5DFF","#F89441FF", "#FDC328FF", "#F0F921FF"]
# };
sld_ramp = '<RasterSymbolizer>' + '<ColorMap type="ramp" extended="false" >' + '<ColorMapEntry color="#0000FF" quantity="20" label="0"/>' + '<ColorMapEntry color="#FFFF00" quantity="30" label="300" />' + '<ColorMapEntry color="#FF0000" quantity="40.5" label="500" />' + '</ColorMap>' + '</RasterSymbolizer>'

# print layers
# vis = {'bands': ['temp']}
Map = geemap.Map(center=[-24.1005, 31.9], zoom=10)
Map.addLayer(l5_temp_mean.sldStyle(sld_ramp), {}, 'temp')
# # Map.addLayer(table2)
Map.addLayerControl()

Map

# In[46]:

# export image to drive
geemap.ee_export_image_to_drive(l5_temp_mean,
                                description='kruger_landsat5_temp',
                                folder='kruger_landsat5',
                                region=table.geometry(),
                                scale=30)
Beispiel #8
0
import numpy as np
import pandas as pd
import geemap

from datetime import datetime, date
from ipywidgets import interact, HTML, interact_manual, interactive, HBox, VBox, fixed, widgets

import ee
import matplotlib.pyplot as plt

ee.Initialize()
aoi_ee = ee.FeatureCollection(
    'users/dafguerrerom/FAO/PYSMM/all_sipalaga_phu_points')

Map = geemap.Map(center=[-2.12, 113.83], zoom=6)
Map.layout.height = '250px'
Map.layout.width = '250px'
Map.clear_controls()
Map.add_basemap('Google Satellite')


# Widgets
def create_wpoints(data):
    options = data.index.unique(level=0).values.tolist()
    options.sort()

    w_points = widgets.Dropdown(
        options=options,
        value=options[0],
        description='ID:',
        disabled=False,