ee.FeatureCollection.style

आसान स्टाइल लैंग्वेज का इस्तेमाल करके, विज़ुअलाइज़ेशन के लिए वेक्टर कलेक्शन बनाएं.

इस्तेमालरिटर्न
FeatureCollection.style(color, pointSize, pointShape, width, fillColor, styleProperty, neighborhood, lineType)इमेज
आर्ग्यूमेंटटाइपविवरण
यह: collectionFeatureCollectionड्रॉ किया जाने वाला कलेक्शन.
colorस्ट्रिंग, डिफ़ॉल्ट: "black"डिफ़ॉल्ट रंग (सीएसएस 3.0 के रंग की वैल्यू, जैसे कि 'FF0000' या 'red') का इस्तेमाल किया जाता है. ओपैसिटी की सुविधा काम करती है (जैसे, 'FF000088' (50% पारदर्शी लाल रंग के लिए).
pointSizeपूर्णांक, डिफ़ॉल्ट: 3पॉइंट मार्कर का डिफ़ॉल्ट साइज़, पिक्सल में.
pointShapeस्ट्रिंग, डिफ़ॉल्ट: "circle"हर पॉइंट लोकेशन पर मार्कर का डिफ़ॉल्ट आकार. इनमें से कोई एक: `circle`, `square`, `diamond`, `cross`, `plus`, `pentagram`, `hexagram`, `triangle`, `triangle_up`, `triangle_down`, `triangle_left`, `triangle_right`, `pentagon`, `hexagon`, `star5`, `star6`. यह आर्ग्युमेंट, Matlab मार्कर के इन छोटे नामों के साथ भी काम करता है: `o`, `s`, `d`, `x`, `+`, `p`, `h`, `^`, `v`, `<`, `>`.
widthफ़्लोट, डिफ़ॉल्ट: 2पॉलीगॉन और पॉइंट शेप के लिए, लाइनों और आउटलाइन की डिफ़ॉल्ट लाइन की चौड़ाई.
fillColorस्ट्रिंग, डिफ़ॉल्ट: nullपॉलीगॉन और पॉइंट शेप में रंग भरने के लिए इस्तेमाल किया जाने वाला रंग. डिफ़ॉल्ट रूप से, यह 0.66 की अपारदर्शिता पर 'color' पर सेट होता है.
stylePropertyस्ट्रिंग, डिफ़ॉल्ट: nullहर सुविधा के लिए प्रॉपर्टी, जिसमें डिक्शनरी शामिल होनी चाहिए. डिक्शनरी में मौजूद वैल्यू, उस सुविधा के लिए डिफ़ॉल्ट वैल्यू को बदल देती हैं.
neighborhoodपूर्णांक, डिफ़ॉल्ट: 5अगर styleProperty का इस्तेमाल किया जाता है और किसी सुविधा का pointSize या चौड़ाई डिफ़ॉल्ट से ज़्यादा है, तो टाइलिंग से जुड़ी गड़बड़ियां हो सकती हैं. यह किसी भी सुविधा के लिए ज़रूरी ज़्यादा से ज़्यादा आस-पास के पिक्सल (pointSize + चौड़ाई) के बारे में बताता है.
lineTypeस्ट्रिंग, डिफ़ॉल्ट: "solid"यह पॉलीगॉन और पॉइंट शेप की लाइनों और आउटलाइन के लिए, लाइन की डिफ़ॉल्ट स्टाइल होती है. डिफ़ॉल्ट रूप से, इसकी वैल्यू 'solid' होती है. इनमें से एक: सॉलिड, डॉटेड, डैश.

उदाहरण

कोड एडिटर (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

// Paint FeatureCollection to an image using collection-wide style arguments.
var fcVis = fc.style({
  color: '1e90ff',
  width: 2,
  fillColor: 'ff475788',  // with alpha set for partial transparency
  lineType: 'dotted',
  pointSize: 10,
  pointShape: 'circle'
});

// Display the FeatureCollection visualization (ee.Image) on the map.
Map.setCenter(4.326, 50.919, 9);
Map.addLayer(fcVis, null, 'Collection-wide style');

// Paint FeatureCollection to an image using feature-specific style arguments.
// A dictionary of style properties per power plant fuel type.
var fuelStyles = ee.Dictionary({
  Wind: {color: 'blue', pointSize: 5, pointShape: 'circle'},
  Gas: {color: 'yellow', pointSize: 6, pointShape: 'square'},
  Oil: {color: 'green', pointSize: 3, pointShape: 'diamond'},
  Coal: {color: 'red', pointSize: 3, pointShape: 'cross'},
  Hydro: {color: 'brown', pointSize: 3, pointShape: 'star5'},
  Biomass: {color: 'orange', pointSize: 4, pointShape: 'triangle'},
  Nuclear: {color: 'purple', pointSize: 6, pointShape: 'hexagram'},
});

// Add feature-specific style properties to each feature based on fuel type.
fc = fc.map(function(feature) {
  return feature.set('style', fuelStyles.get(feature.get('fuel1')));
});

// Style the FeatureCollection according to each feature's "style" property.
var fcVisCustom = fc.style({
  styleProperty: 'style',
  neighborhood: 8  // maximum "pointSize" + "width" among features
});

// Display the FeatureCollection visualization (ee.Image) on the map.
Map.addLayer(fcVisCustom, null, 'Feature-specific style');

Python सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"'
)

# Paint FeatureCollection to an image using collection-wide style arguments.
fc_vis = fc.style(
    color='1e90ff',
    width=2,
    fillColor='ff475788',  # with alpha set for partial transparency
    lineType='dotted',
    pointSize=10,
    pointShape='circle',
)

# Display the FeatureCollection visualization (ee.Image) on the map.
m = geemap.Map()
m.set_center(4.326, 50.919, 9)
m.add_layer(fc_vis, None, 'Collection-wide style')

# Paint FeatureCollection to an image using feature-specific style arguments.
# A dictionary of style properties per power plant fuel type.
fuel_styles = ee.Dictionary({
    'Wind': {'color': 'blue', 'pointSize': 5, 'pointShape': 'circle'},
    'Gas': {'color': 'yellow', 'pointSize': 6, 'pointShape': 'square'},
    'Oil': {'color': 'green', 'pointSize': 3, 'pointShape': 'diamond'},
    'Coal': {'color': 'red', 'pointSize': 3, 'pointShape': 'cross'},
    'Hydro': {'color': 'brown', 'pointSize': 3, 'pointShape': 'star5'},
    'Biomass': {'color': 'orange', 'pointSize': 4, 'pointShape': 'triangle'},
    'Nuclear': {'color': 'purple', 'pointSize': 6, 'pointShape': 'hexagram'},
})

# Add feature-specific style properties to each feature based on fuel type.
fc = fc.map(
    lambda feature: feature.set('style', fuel_styles.get(feature.get('fuel1')))
)

# Style the FeatureCollection according to each feature's "style" property.
fc_vis_custom = fc.style(
    styleProperty='style',
    neighborhood=8,  # maximum "pointSize" + "width" among features
)

# Display the FeatureCollection visualization (ee.Image) on the map.
m.add_layer(fc_vis_custom, None, 'Feature-specific style')
m