प्रोजेक्शन दस्तावेज़ में बताया गया है कि Earth Engine, रीप्रोजेक्शन के दौरान डिफ़ॉल्ट रूप से, सबसे नज़दीकी नेबर रीसैंपलिंग करता है. resample() या reduceResolution() तरीके का इस्तेमाल करके, इस व्यवहार को बदला जा सकता है. खास तौर पर, जब इनमें से कोई तरीका किसी इनपुट इमेज पर लागू किया जाता है, तो इनपुट के किसी भी ज़रूरी रीप्रोजेक्शन को, बताए गए रीसैंपलिंग या एग्रीगेशन के तरीके का इस्तेमाल करके किया जाएगा.
रीसेंपल
resample() की वजह से, अगले रीप्रोजेक्शन में रीसैंपलिंग के लिए बताए गए तरीके ('bilinear' या 'bicubic') का इस्तेमाल किया जाता है. इनपुट का अनुरोध, आउटपुट प्रोजेक्शन में किया जाता है. इसलिए, इनपुट पर कोई भी कार्रवाई करने से पहले, इंप्लिसिट रीप्रोजेक्शन हो सकता है. इस वजह से, इनपुट इमेज पर सीधे resample() को कॉल करें. नीचे दिया गया आसान उदाहरण देखें:
कोड एडिटर (JavaScript)
// Load a Landsat image over San Francisco, California, UAS. var landsat = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20160323'); // Set display and visualization parameters. Map.setCenter(-122.37383, 37.6193, 15); var visParams = {bands: ['B4', 'B3', 'B2'], max: 0.3}; // Display the Landsat image using the default nearest neighbor resampling. // when reprojecting to Mercator for the Code Editor map. Map.addLayer(landsat, visParams, 'original image'); // Force the next reprojection on this image to use bicubic resampling. var resampled = landsat.resample('bicubic'); // Display the Landsat image using bicubic resampling. Map.addLayer(resampled, visParams, 'resampled');
import ee import geemap.core as geemap
Colab (Python)
# Load a Landsat image over San Francisco, California, UAS. landsat = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20160323') # Set display and visualization parameters. m = geemap.Map() m.set_center(-122.37383, 37.6193, 15) vis_params = {'bands': ['B4', 'B3', 'B2'], 'max': 0.3} # Display the Landsat image using the default nearest neighbor resampling. # when reprojecting to Mercator for the Code Editor map. m.add_layer(landsat, vis_params, 'original image') # Force the next reprojection on this image to use bicubic resampling. resampled = landsat.resample('bicubic') # Display the Landsat image using bicubic resampling. m.add_layer(resampled, vis_params, 'resampled')
ध्यान दें कि 'bicubic' रीसैंपलिंग की वजह से, आउटपुट पिक्सल ओरिजनल इमेज (इमेज 1) की तुलना में ज़्यादा स्मूद दिखते हैं.
इस कोड सैंपल के लिए, कार्रवाइयों के क्रम को डायग्राम 2 में दिखाया गया है. खास तौर पर, maps mercator प्रोजेक्शन के लिए इंप्लिसिट रीप्रोजेक्शन, इनपुट इमेज पर बताई गई रीसैंपलिंग के तरीके से होता है.

दूसरी इमेज. कोड एडिटर में इनपुट इमेज को दिखाने से पहले, उस पर resample() को कॉल करने पर होने वाले ऑपरेशन का फ़्लो चार्ट. घुमावदार लाइनें, रीप्रोजेक्शन के लिए जानकारी के फ़्लो को दिखाती हैं: खास तौर पर, आउटपुट प्रोजेक्शन, स्केल, और रीसैंपलिंग का तरीका.
रिज़ॉल्यूशन कम करें
मान लें कि रीप्रोजेक्शन के दौरान रीसैंपलिंग करने के बजाय, आपका लक्ष्य किसी दूसरे प्रोजेक्शन में पिक्सल को बड़े पिक्सल में इकट्ठा करना है. यह अलग-अलग स्केल पर इमेज डेटासेट की तुलना करते समय काम आता है. उदाहरण के लिए, Landsat पर आधारित प्रॉडक्ट से 30-मीटर पिक्सल की तुलना, MODIS पर आधारित प्रॉडक्ट से कोर्स पिक्सल (ज़्यादा स्केल) से की जाती है. reduceResolution() तरीके का इस्तेमाल करके, एग्रीगेशन की इस प्रोसेस को कंट्रोल किया जा सकता है. resample() की तरह ही, इनपुट पर reduceResolution() को कॉल करें, ताकि इमेज के अगले रीप्रोजेक्शन पर असर पड़े. नीचे दिए गए उदाहरण में, reduceResolution() का इस्तेमाल करके, 30 मीटर के रिज़ॉल्यूशन पर जंगल के फैलाव के डेटा की तुलना, 500 मीटर के रिज़ॉल्यूशन पर वनस्पति इंडेक्स से की गई है:
कोड एडिटर (JavaScript)
// Load a MODIS EVI image. var modis = ee.Image(ee.ImageCollection('MODIS/061/MOD13A1').first()) .select('EVI'); // Display the EVI image near La Honda, California. Map.setCenter(-122.3616, 37.5331, 12); Map.addLayer(modis, {min: 2000, max: 5000}, 'MODIS EVI'); // Get information about the MODIS projection. var modisProjection = modis.projection(); print('MODIS projection:', modisProjection); // Load and display forest cover data at 30 meters resolution. var forest = ee.Image('UMD/hansen/global_forest_change_2025_v1_13') .select('treecover2000'); Map.addLayer(forest, {max: 80}, 'forest cover 30 m'); // Get the forest cover data at MODIS scale and projection. var forestMean = forest // Force the next reprojection to aggregate instead of resampling. .reduceResolution({ reducer: ee.Reducer.mean(), maxPixels: 1024 }) // Request the data at the scale and projection of the MODIS image. .reproject({ crs: modisProjection }); // Display the aggregated, reprojected forest cover data. Map.addLayer(forestMean, {max: 80}, 'forest cover at MODIS scale');
import ee import geemap.core as geemap
Colab (Python)
# Load a MODIS EVI image. modis = ee.Image(ee.ImageCollection('MODIS/061/MOD13A1').first()).select('EVI') # Display the EVI image near La Honda, California. m.set_center(-122.3616, 37.5331, 12) m.add_layer(modis, {'min': 2000, 'max': 5000}, 'MODIS EVI') # Get information about the MODIS projection. modis_projection = modis.projection() display('MODIS projection:', modis_projection) # Load and display forest cover data at 30 meters resolution. forest = ee.Image('UMD/hansen/global_forest_change_2025_v1_13').select( 'treecover2000' ) m.add_layer(forest, {'max': 80}, 'forest cover 30 m') # Get the forest cover data at MODIS scale and projection. forest_mean = ( forest # Force the next reprojection to aggregate instead of resampling. .reduceResolution(reducer=ee.Reducer.mean(), maxPixels=1024) # Request the data at the scale and projection of the MODIS image. .reproject(crs=modis_projection) ) # Display the aggregated, reprojected forest cover data. m.add_layer(forest_mean, {'max': 80}, 'forest cover at MODIS scale')
इस उदाहरण में, ध्यान दें कि आउटपुट प्रोजेक्शन को साफ़ तौर पर reproject() के साथ सेट किया गया है. एमओडीआईएस साइनुसॉइडल प्रोजेक्शन में रीप्रोजेक्शन के दौरान, रीसैंपलिंग करने के बजाय, छोटे पिक्सल को तय किए गए रिड्यूसर (उदाहरण में ee.Reducer.mean()) के साथ एग्रीगेट किया जाता है. ऑपरेशन के इस क्रम को
चित्र 3 में दिखाया गया है. हालांकि, इस उदाहरण में reproject() का इस्तेमाल किया गया है, ताकि reduceResolution() के असर को विज़ुअलाइज़ करने में मदद मिल सके. ज़्यादातर स्क्रिप्ट को साफ़ तौर पर फिर से प्रोजेक्ट करने की ज़रूरत नहीं होती. फिर से प्रोजेक्ट करें सेक्शन में दी गई चेतावनी देखें.

तीसरी इमेज. reproject() से पहले, इनपुट इमेज पर reduceResolution() को कॉल करने पर होने वाली कार्रवाइयों का फ़्लो चार्ट. घुमावदार लाइनें, रीप्रोजेक्शन के लिए जानकारी के फ़्लो को दिखाती हैं. खास तौर पर, आउटपुट प्रोजेक्शन, स्केल, और पिक्सल एग्रीगेशन के लिए इस्तेमाल किए जाने वाले तरीके को दिखाती हैं.
ReduceResolution के लिए Pixel का वज़न
reduceResolution() एग्रीगेशन प्रोसेस के दौरान इस्तेमाल किए गए पिक्सल का वज़न, एग्रीगेट किए जा रहे छोटे पिक्सल और आउटपुट प्रोजेक्शन से तय किए गए बड़े पिक्सल के बीच ओवरलैप पर आधारित होता है. इसे इमेज 4 में दिखाया गया है.

चौथी इमेज. reduceResolution() के लिए इनपुट पिक्सल (काला) और आउटपुट पिक्सल (नीला).
डिफ़ॉल्ट ऐक्शन और सेटिंग के तौर पर, इनपुट पिक्सल के वेट को आउटपुट पिक्सल के उस हिस्से के तौर पर कैलकुलेट किया जाता है जिसे इनपुट पिक्सल कवर करता है. डायग्राम में, आउटपुट पिक्सल का क्षेत्रफल a है. इंटरसेक्शन एरिया b वाले इनपुट पिक्सल का वेट b/a के तौर पर कैलकुलेट किया जाता है. वहीं, इंटरसेक्शन एरिया c वाले इनपुट पिक्सल का वेट c/a के तौर पर कैलकुलेट किया जाता है. इसकी वजह से, मीन रिड्यूसर के अलावा किसी अन्य रिड्यूसर का इस्तेमाल करने पर, अनचाहे नतीजे मिल सकते हैं. उदाहरण के लिए, हर पिक्सल के हिसाब से जंगल वाले इलाके का हिसाब लगाने के लिए, मीन रिड्यूसर का इस्तेमाल करके, कवर किए गए पिक्सल के हिस्से का हिसाब लगाएं. इसके बाद, उसे इलाके से गुणा करें. छोटे पिक्सल में इलाकों का हिसाब लगाने के बाद, उन्हें सम रिड्यूसर के साथ जोड़ने के बजाय, यह तरीका अपनाएं:
कोड एडिटर (JavaScript)
// Compute forest area per MODIS pixel. var forestArea = forest.gt(0) // Force the next reprojection to aggregate instead of resampling. .reduceResolution({ reducer: ee.Reducer.mean(), maxPixels: 1024 }) // The reduce resolution returns the fraction of the MODIS pixel // that's covered by 30 meter forest pixels. Convert to area // after the reduceResolution() call. .multiply(ee.Image.pixelArea()) // Request the data at the scale and projection of the MODIS image. .reproject({ crs: modisProjection }); Map.addLayer(forestArea, {max: 500 * 500}, 'forested area at MODIS scale');
import ee import geemap.core as geemap
Colab (Python)
# Compute forest area per MODIS pixel. forest_area = ( forest.gt(0) # Force the next reprojection to aggregate instead of resampling. .reduceResolution(reducer=ee.Reducer.mean(), maxPixels=1024) # The reduce resolution returns the fraction of the MODIS pixel # that's covered by 30 meter forest pixels. Convert to area # after the reduceResolution() call. .multiply(ee.Image.pixelArea()) # Request the data at the scale and projection of the MODIS image. .reproject(crs=modis_projection) ) m.add_layer(forest_area, {'max': 500 * 500}, 'forested area at MODIS scale') m