Resimler, geometriler ve özellikler gibi özellik koleksiyonları da doğrudan Map.addLayer()
ile haritaya eklenebilir. Varsayılan görselleştirmede vektörler siyah çizgilerle ve yarı opak siyah dolguyla gösterilir. Vektörleri renkli olarak oluşturmak için color
parametresini belirtin. Aşağıda, "RESOLVE" ekolojik bölgeleri (Dinerstein et al. 2017) varsayılan görselleştirme olarak ve kırmızı renkte gösterilmektedir:
Kod Düzenleyici (JavaScript)
// Load a FeatureCollection from a table dataset: 'RESOLVE' ecoregions. var ecoregions = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017'); // Display as default and with a custom color. Map.addLayer(ecoregions, {}, 'default display'); Map.addLayer(ecoregions, {color: 'FF0000'}, 'colored');
import ee import geemap.core as geemap
Colab (Python)
# Load a FeatureCollection from a table dataset: 'RESOLVE' ecoregions. ecoregions = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017') # Display as default and with a custom color. m = geemap.Map() m.set_center(-76.2486, 44.8988, 8) m.add_layer(ecoregions, {}, 'default display') m.add_layer(ecoregions, {'color': 'FF0000'}, 'colored') m
Diğer görüntüleme seçenekleri için featureCollection.draw()
simgesini kullanın. Daha açık belirtmek gerekirse, pointRadius
ve strokeWidth
parametreleri, oluşturulan FeatureCollection
'de sırasıyla noktaların ve çizgilerin boyutunu kontrol eder:
Kod Düzenleyici (JavaScript)
Map.addLayer(ecoregions.draw({color: '006600', strokeWidth: 5}), {}, 'drawn');
import ee import geemap.core as geemap
Colab (Python)
m.add_layer(ecoregions.draw(color='006600', strokeWidth=5), {}, 'drawn')
draw()
işlevinin çıkışı, belirtilen color
parametresine göre ayarlanmış kırmızı, yeşil ve mavi bantların bulunduğu bir resimdir.
Bir FeatureCollection
değerinin nasıl gösterileceği üzerinde daha fazla kontrol sahibi olmak için FeatureCollection
değerini bağımsız değişken olarak kullanarak image.paint()
işlevini kullanın. Üç bantlı, 8 bit görüntü çıkışı veren draw()
'ün aksine image.paint()
, içine belirtilen sayısal değerin "boyandığı" bir görüntü çıkışı verir. Alternatif olarak, boyanacak sayıları içeren bir mülkün adını da FeatureCollection
içinde belirtebilirsiniz. width
parametresi de aynı şekilde çalışır: sabit bir değer veya çizgi genişliği için bir sayı içeren bir mülkün adı olabilir. Örneğin:
Kod Düzenleyici (JavaScript)
// Create an empty image into which to paint the features, cast to byte. var empty = ee.Image().byte(); // Paint all the polygon edges with the same number and width, display. var outline = empty.paint({ featureCollection: ecoregions, color: 1, width: 3 }); Map.addLayer(outline, {palette: 'FF0000'}, 'edges');
import ee import geemap.core as geemap
Colab (Python)
# Create an empty image into which to paint the features, cast to byte. empty = ee.Image().byte() # Paint all the polygon edges with the same number and width, display. outline = empty.paint(featureCollection=ecoregions, color=1, width=3) m.add_layer(outline, {'palette': 'FF0000'}, 'edges')
Özellikleri boyadığınız boş resmin, boyamadan önce oluşturulması gerektiğini unutmayın. Bunun nedeni, sabit bir resmin sabit gibi davranmasıdır: İlk değere sabitlenir. Özellik kenarlarını, özelliklerin bir mülkünden ayarlanan değerlerle renklendirmek için renk parametresini, sayısal değerlere sahip mülkün adına ayarlayın:
Kod Düzenleyici (JavaScript)
// Paint the edges with different colors, display. var outlines = empty.paint({ featureCollection: ecoregions, color: 'BIOME_NUM', width: 4 }); var palette = ['FF0000', '00FF00', '0000FF']; Map.addLayer(outlines, {palette: palette, max: 14}, 'different color edges');
import ee import geemap.core as geemap
Colab (Python)
# Paint the edges with different colors, display. outlines = empty.paint(featureCollection=ecoregions, color='BIOME_NUM', width=4) palette = ['FF0000', '00FF00', '0000FF'] m.add_layer(outlines, {'palette': palette, 'max': 14}, 'different color edges')
Sınırların çizildiği renk ve genişlik, özelliklerle ayarlanabilir. Örneğin:
Kod Düzenleyici (JavaScript)
// Paint the edges with different colors and widths. var outlines = empty.paint({ featureCollection: ecoregions, color: 'BIOME_NUM', width: 'NNH' }); Map.addLayer(outlines, {palette: palette, max: 14}, 'different color, width edges');
import ee import geemap.core as geemap
Colab (Python)
# Paint the edges with different colors and widths. outlines = empty.paint( featureCollection=ecoregions, color='BIOME_NUM', width='NNH' ) m.add_layer( outlines, {'palette': palette, 'max': 14}, 'different color, width edges' )
width
parametresi sağlanmazsa özelliklerin içi boyanır:
Kod Düzenleyici (JavaScript)
// Paint the interior of the polygons with different colors. var fills = empty.paint({ featureCollection: ecoregions, color: 'BIOME_NUM', }); Map.addLayer(fills, {palette: palette, max: 14}, 'colored fills');
import ee import geemap.core as geemap
Colab (Python)
# Paint the interior of the polygons with different colors. fills = empty.paint(featureCollection=ecoregions, color='BIOME_NUM') m.add_layer(fills, {'palette': palette, 'max': 14}, 'colored fills')
Özelliklerin hem iç kısmını hem de kenarlarını oluşturmak için boş resmi iki kez boyayın:
Kod Düzenleyici (JavaScript)
// Paint both the fill and the edges. var filledOutlines = empty.paint(ecoregions, 'BIOME_NUM').paint(ecoregions, 0, 2); Map.addLayer(filledOutlines, {palette: ['000000'].concat(palette), max: 14}, 'edges and fills');
import ee import geemap.core as geemap
Colab (Python)
# Paint both the fill and the edges. filled_outlines = empty.paint(ecoregions, 'BIOME_NUM').paint(ecoregions, 0, 2) m.add_layer( filled_outlines, {'palette': ['000000'] + palette, 'max': 14}, 'edges and fills', )