ee.Image.clipToBoundsAndScale
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह फ़ंक्शन, किसी इमेज को Geometry की सीमाओं के हिसाब से काटता है. साथ ही, काटी गई इमेज को किसी खास साइज़ या स्केल में बदलता है.
चेतावनी: geometry
आर्ग्युमेंट के तौर पर बड़ा या जटिल कलेक्शन देने से, परफ़ॉर्मेंस खराब हो सकती है. कलेक्शन की ज्यामिति को एक साथ रखने से, परफ़ॉर्मेंस पर असर पड़ता है. इसलिए, सबसे छोटे कलेक्शन (या ज्यामिति) का इस्तेमाल करें, ताकि आपको मनमुताबिक नतीजे मिल सकें.
इस्तेमाल रिटर्न Image. clipToBoundsAndScale (geometry , width , height , maxDimension , scale )
इमेज
आर्ग्यूमेंट टाइप विवरण यह: input
इमेज वह इमेज जिसे काटना और उसका साइज़ बदलना है. geometry
ज्यामिति, डिफ़ॉल्ट: null इमेज को क्लिप करने के लिए ज्यामिति. इमेज को इस ज्यामिति के इमेज प्रोजेक्शन में बाउंडिंग बॉक्स के हिसाब से काटा जाएगा. width
पूर्णांक, डिफ़ॉल्ट: null इमेज को जिस चौड़ाई में स्केल करना है वह पिक्सल में. इसे "ऊंचाई" एट्रिब्यूट के साथ देना ज़रूरी है. यह "maxDimension" और "scale" के साथ इस्तेमाल नहीं किया जा सकता. height
पूर्णांक, डिफ़ॉल्ट: null इमेज को जिस ऊंचाई तक स्केल करना है वह पिक्सल में. इसे "चौड़ाई" एट्रिब्यूट के साथ दिया जाना चाहिए. यह "maxDimension" और "scale" के साथ इस्तेमाल नहीं किया जा सकता. maxDimension
पूर्णांक, डिफ़ॉल्ट: null इमेज को ज़्यादा से ज़्यादा जिस डाइमेंशन तक स्केल किया जा सकता है वह पिक्सल में. "width", "height", और "scale" के साथ इस्तेमाल नहीं किया जा सकता. scale
फ़्लोट, डिफ़ॉल्ट: null अगर स्केल तय किया गया है, तो प्रोजेक्शन को स्केल करने के लिए, तय की गई स्केल वैल्यू को इमेज के प्रोजेक्शन में एक मीटर के नॉमिनल साइज़ से भाग दिया जाता है. यह "width", "height", और "maxDimension" के साथ इस्तेमाल नहीं किया जा सकता.
उदाहरण
कोड एडिटर (JavaScript)
// A digital elevation model.
var dem = ee . Image ( 'NASA/NASADEM_HGT/001' );
var demVis = { bands : 'elevation' , min : 0 , max : 2000 };
print ( 'DEM' , dem );
Map . setCenter ( - 121.38 , 46.51 , 8 );
Map . addLayer ( dem , demVis , 'DEM' );
// Clip DEM by a single polygon geometry, specify width and height parameters.
var geom1 = ee . Geometry . BBox ( - 123.55 , 46.61 , - 122.57 , 46.98 );
var demClip1 = dem . clipToBoundsAndScale ({
geometry : geom1 ,
width : 20 , // pixels
height : 10 // pixels
});
print ( 'Clipped image retains metadata and band names' , demClip1 );
Map . addLayer ( demClip1 , demVis , 'Single geometry clip (width, height)' );
Map . addLayer ( geom1 , { color : 'red' }, 'Single geometry (width, height)' );
// Clip DEM by a single polygon geometry, specify maxDimension parameter.
var geom2 = ee . Geometry . BBox ( - 120.79 , 46.58 , - 120.16 , 46.81 );
var demClip2 = dem . clipToBoundsAndScale ({
geometry : geom2 ,
maxDimension : 5 , // pixels
});
Map . addLayer ( demClip2 , demVis , 'Single polygon clip (maxDimension)' );
Map . addLayer ( geom2 , { color : 'yellow' }, 'Single polygon (maxDimension)' );
// Clip DEM by a single polygon geometry, specify scale parameter.
var geom3 = ee . Geometry . BBox ( - 120.79 , 46.18 , - 120.16 , 46.41 );
var demClip3 = dem . clipToBoundsAndScale ({
geometry : geom3 ,
scale : 1e4 , // meters
});
Map . addLayer ( demClip3 , demVis , 'Single polygon clip (scale)' );
Map . addLayer ( geom3 , { color : 'blue' }, 'Single polygon (scale)' );
Python सेटअप करना
Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap
का इस्तेमाल करने के बारे में जानकारी पाने के लिए,
Python एनवायरमेंट पेज देखें.
import ee
import geemap.core as geemap
Colab (Python)
# A digital elevation model.
dem = ee . Image ( 'NASA/NASADEM_HGT/001' )
dem_vis = { 'bands' : 'elevation' , 'min' : 0 , 'max' : 2000 }
display ( 'DEM' , dem )
m = geemap . Map ()
m . set_center ( - 121.38 , 46.51 , 8 )
m . add_layer ( dem , dem_vis , 'DEM' )
# Clip DEM by a single polygon geometry, specify width and height parameters.
geom_1 = ee . Geometry . BBox ( - 123.55 , 46.61 , - 122.57 , 46.98 )
dem_clip_1 = dem . clipToBoundsAndScale ( geometry = geom_1 , width = 20 , height = 10 )
display ( 'Clipped image retains metadata and band names' , dem_clip_1 )
m . add_layer ( dem_clip_1 , dem_vis , 'Single geometry clip (width, height)' )
m . add_layer ( geom_1 , { 'color' : 'red' }, 'Single geometry (width, height)' )
# Clip DEM by a single polygon geometry, specify maxDimension parameter.
geom_2 = ee . Geometry . BBox ( - 120.79 , 46.58 , - 120.16 , 46.81 )
dem_clip_2 = dem . clipToBoundsAndScale ( geometry = geom_2 , maxDimension = 5 )
m . add_layer ( dem_clip_2 , dem_vis , 'Single polygon clip (maxDimension)' )
m . add_layer ( geom_2 , { 'color' : 'yellow' }, 'Single polygon (maxDimension)' )
# Clip DEM by a single polygon geometry, specify scale parameter.
geom_3 = ee . Geometry . BBox ( - 120.79 , 46.18 , - 120.16 , 46.41 )
dem_clip_3 = dem . clipToBoundsAndScale ( geometry = geom_3 , scale = 1e4 )
m . add_layer ( dem_clip_3 , dem_vis , 'Single polygon clip (scale)' )
m . add_layer ( geom_3 , { 'color' : 'blue' }, 'Single polygon (scale)' )
m
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[],[],null,[]]