<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 creates a new property that is the sum of two existing properties.
def addField(feature):
  sum = ee.Number(feature.get('property1')).add(feature.get('property2'))
  return feature.set({'sum': sum})

# Create a FeatureCollection from a list of Features.
features = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point(-122.4536, 37.7403),
    {'property1': 100, 'property2': 100}),
    ee.Feature(ee.Geometry.Point(-118.2294, 34.039),
    {'property1': 200, 'property2': 300}),
])

# Map the function over the collection.
featureCollection = features.map(addField)

# Print the entire FeatureCollection.
print(featureCollection.getInfo())

# Print a selected property of one Feature.
print(featureCollection.first().get('sum').getInfo())



# Display the map.
Map

import ee 
import geemap

# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)

# This function creates a new property that is the sum of two existing properties.
def addField(feature):
  sum = ee.Number(feature.get('property1')).add(feature.get('property2'))
  return feature.set({'sum': sum})

# Create a FeatureCollection from a list of Features.
features = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point(-122.4536, 37.7403),
    {'property1': 100, 'property2': 100}),
    ee.Feature(ee.Geometry.Point(-118.2294, 34.039),
    {'property1': 200, 'property2': 300}),
])

# Map the function over the collection.
featureCollection = features.map(addField)

# Print the entire FeatureCollection.
print(featureCollection.getInfo())

# Print a selected property of one Feature.
print(featureCollection.first().get('sum').getInfo())



# Display the map.
Map
# Create a map centered at (lat, lon). # This function creates a new property that is the sum of two existing properties. # Create a FeatureCollection from a list of Features. # Map the function over the collection. # Print the entire FeatureCollection. # Print a selected property of one Feature. # Display the map.