-
Notifications
You must be signed in to change notification settings - Fork 49
/
overview.py
39 lines (29 loc) · 1.16 KB
/
overview.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 = ee.ImageCollection([constant1, constant2])
print('collectionFromConstructor: ', collectionFromConstructor.getInfo())
# Create a collection with fromImages().
collectionFromImages = ee.ImageCollection.fromImages(
[ee.Image(3), ee.Image(4)])
print('collectionFromImages: ', collectionFromImages.getInfo())
# Merge two collections.
mergedCollection = collectionFromConstructor.merge(collectionFromImages)
print('mergedCollection: ', mergedCollection.getInfo())
# # Create a toy FeatureCollection
# features = ee.FeatureCollection(
# [ee.Feature({}, {'foo': 1}), ee.Feature({}, {'foo': 2})])
# # Create an ImageCollection from the FeatureCollection
# # by mapping a function over the FeatureCollection.
# images = features.map(function(feature) {
# return ee.Image(ee.Number(feature.get('foo')))
# })
# # Print the resultant collection.
# print('Image collection: ', images)
# Display the map.
Map