Python के लिए Earth Engine का इस्तेमाल शुरू करना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस शुरुआती ट्यूटोरियल में, आपको Earth Engine के Python इंटरफ़ेस की मदद से, भौगोलिक डेटा को विज़ुअलाइज़ करने और उसका विश्लेषण करने के बारे में इंटरैक्टिव तरीके से जानकारी मिलेगी.
शुरू करने से पहले
Google Cloud प्रोजेक्ट रजिस्टर करें या बनाएं. इसके बाद, आपको यह तरीका अपनाना होगा. अगर आपके पास पहले से ही Earth Engine का ऐक्सेस पाने के लिए रजिस्टर किया गया कोई प्रोजेक्ट है, तो अगले सेक्शन पर जाएं.
- प्रोजेक्ट का मकसद चुनें: व्यावसायिक या गैर-व्यावसायिक.
- अगर इसका मकसद व्यावसायिक नहीं है, तो प्रोजेक्ट का टाइप चुनें.
- नया Google Cloud प्रोजेक्ट बनाएं या कोई मौजूदा प्रोजेक्ट चुनें.
- अगर इसका मकसद व्यावसायिक है, तो अपने प्रोजेक्ट के लिए बिलिंग की पुष्टि करें या उसे सेट अप करें.
- अपने प्रोजेक्ट की जानकारी की पुष्टि करें.
ध्यान दें: अगर आपको इस प्रोसेस में बनाए गए संसाधनों को सेव नहीं करना है, तो किसी मौजूदा प्रोजेक्ट को चुनने के बजाय, नया प्रोजेक्ट बनाएं. इन चरणों को पूरा करने के बाद, प्रोजेक्ट को मिटाया जा सकता है. इससे, प्रोजेक्ट के मालिकाना हक वाले सभी संसाधन हट जाएंगे.
Notebook का सेटअप
Jupyter नोटबुक की मदद से, Earth Engine का इस्तेमाल किया जा सकता है और नतीजों को इंटरैक्टिव तरीके से एक्सप्लोर किया जा सकता है. Google Colab notebook में मौजूद नोटबुक की मदद से, तेज़ी से शुरुआत की जा सकती है.
नई नोटबुक खोलें और यहां दिए गए कोड के हिस्सों को अलग-अलग सेल में कॉपी करें या पहले से भरे हुए
Earth Engine Python Quickstart notebook का इस्तेमाल करें.
- Earth Engine और geemap लाइब्रेरी इंपोर्ट करें.
import ee
import geemap.core as geemap
- Earth Engine सेवा की पुष्टि करें और उसे शुरू करें. पुष्टि करने के लिए, स्क्रीन पर दिखने वाले निर्देशों का पालन करें. PROJECT_ID की जगह, उस प्रोजेक्ट का नाम डालना न भूलें जिसे आपने इस क्विकस्टार्ट के लिए सेट अप किया है.
ee.Authenticate()
ee.Initialize(project='PROJECT_ID')
मैप में रेस्टर डेटा जोड़ना
- किसी तय अवधि के लिए, जलवायु से जुड़ा डेटा लोड करना और उसका मेटाडेटा दिखाना.
jan_2023_climate = (
ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY_AGGR')
.filterDate('2023-01', '2023-02')
.first()
)
jan_2023_climate
- मैप ऑब्जेक्ट को इंस्टैंशिएट करें और तापमान बैंड को लेयर के तौर पर जोड़ें. साथ ही, विज़ुअलाइज़ेशन की खास प्रॉपर्टी का इस्तेमाल करें. मैप दिखाएं.
m = geemap.Map(center=[30, 0], zoom=2)
vis_params = {
'bands': ['temperature_2m'],
'min': 229,
'max': 304,
'palette': 'inferno',
}
m.add_layer(jan_2023_climate, vis_params, 'Temperature (K)')
m
मैप में वेक्टर डेटा जोड़ना
- तीन शहरों के पॉइंट वाला वेक्टर डेटा ऑब्जेक्ट बनाएं.
cities = ee.FeatureCollection([
ee.Feature(ee.Geometry.Point(10.75, 59.91), {'city': 'Oslo'}),
ee.Feature(ee.Geometry.Point(-118.24, 34.05), {'city': 'Los Angeles'}),
ee.Feature(ee.Geometry.Point(103.83, 1.33), {'city': 'Singapore'}),
])
cities
- मैप पर शहर की जगहों की जानकारी जोड़ें और उसे फिर से दिखाएं.
m.add_layer(cities, name='Cities')
m
डेटा निकालना और चार्ट बनाना
- Altair चार्टिंग लाइब्रेरी इंपोर्ट करें.
%pip install -q --upgrade altair
import altair as alt
- तीन शहरों के लिए, जलवायु का डेटा, Pandas DataFrame के तौर पर निकालें.
city_climates = jan_2023_climate.reduceRegions(cities, ee.Reducer.first())
city_climates_dataframe = ee.data.computeFeatures(
{'expression': city_climates, 'fileFormat': 'PANDAS_DATAFRAME'}
)
city_climates_dataframe
- शहरों के तापमान को बार चार्ट के तौर पर प्लॉट करें.
alt.Chart(city_climates_dataframe).mark_bar(size=100).encode(
alt.X('city:N', sort='y', axis=alt.Axis(labelAngle=0), title='City'),
alt.Y('temperature_2m:Q', title='Temperature (K)'),
tooltip=[
alt.Tooltip('city:N', title='City'),
alt.Tooltip('temperature_2m:Q', title='Temperature (K)'),
],
).properties(title='January 2023 temperature for selected cities', width=500)
आगे क्या करना है
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThis quickstart provides an interactive introduction to visualizing and analyzing geospatial data using the Earth Engine Python interface within a Jupyter notebook environment like Google Colab.\u003c/p\u003e\n"],["\u003cp\u003eUsers will learn to add both raster and vector data to an interactive map, visualizing climate data and city locations as examples.\u003c/p\u003e\n"],["\u003cp\u003eThe guide demonstrates data extraction and charting by retrieving climate data for specific cities and creating a bar chart using the Altair library.\u003c/p\u003e\n"],["\u003cp\u003eBefore starting, users need a Google Cloud Project registered for Earth Engine access, and the quickstart provides instructions for setting one up.\u003c/p\u003e\n"],["\u003cp\u003eFurther learning resources on Earth Engine objects, processing environments, machine learning capabilities, and data export to BigQuery are linked at the end.\u003c/p\u003e\n"]]],[],null,["# Get started with Earth Engine for Python\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| [Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/generated/quickstart_python.ipynb) | [View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/generated/quickstart_python.ipynb) |\n\nThis quickstart will give you an interactive introduction to visualizing and\nanalyzing geospatial data with the Earth Engine Python interface.\n\nBefore you begin\n----------------\n\n\n[Register or create](https://console.cloud.google.com/earth-engine) a Google Cloud\nProject; you'll be prompted to complete the following steps. If you already have a project\nregistered for Earth Engine access, skip to the next section.\n\n- Select the project's purpose: commercial or noncommercial.\n- If the purpose is noncommercial, select a project type.\n- Create a new Google Cloud project or select an existing project.\n- If the purpose is commercial, verify or set up billing for your project.\n- Confirm your project information. \n\n **Note:** If you don't plan to keep the resources that you create\n in this procedure, create a project instead of selecting an existing project. After you finish\n these steps, you can\n [delete the project](https://cloud.google.com/resource-manager/docs/creating-managing-projects#shutting_down_projects),\n removing all resources owned by the project.\n\nNotebook setup\n--------------\n\nJupyter notebooks allow you to use Earth Engine and explore results interactively. The quickest way to get started is with a notebook in Google Colab notebook. You can either [**open a new notebook**](https://colab.new/) and copy the following code chunks into individual cells or use the prefilled [**Earth Engine Python Quickstart notebook**](https://colab.sandbox.google.com/github/google/earthengine-community/blob/master/guides/linked/generated/quickstart_python.ipynb).\n\n1. Import the Earth Engine and geemap libraries. \n\n ```python\n import ee\n import geemap.core as geemap\n ```\n\n\n2. Authenticate and initialize the Earth Engine service. Follow the resulting prompts to complete authentication. Be sure to replace PROJECT_ID with the name of the project you set up for this quickstart. \n\n ```python\n ee.Authenticate()\n ee.Initialize(project='PROJECT_ID')\n ```\n\nAdd raster data to a map\n------------------------\n\n\n1. Load climate data for a given period and display its metadata. \n\n ```python\n jan_2023_climate = (\n ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY_AGGR')\n .filterDate('2023-01', '2023-02')\n .first()\n )\n jan_2023_climate\n ```\n\n\n2. Instantiate a map object and add the temperature band as a layer with specific visualization properties. Display the map. \n\n ```python\n m = geemap.Map(center=[30, 0], zoom=2)\n\n vis_params = {\n 'bands': ['temperature_2m'],\n 'min': 229,\n 'max': 304,\n 'palette': 'inferno',\n }\n m.add_layer(jan_2023_climate, vis_params, 'Temperature (K)')\n m\n ```\n\nAdd vector data to a map\n------------------------\n\n1. Create a vector data object with points for three cities. \n\n ```python\n cities = ee.FeatureCollection([\n ee.Feature(ee.Geometry.Point(10.75, 59.91), {'city': 'Oslo'}),\n ee.Feature(ee.Geometry.Point(-118.24, 34.05), {'city': 'Los Angeles'}),\n ee.Feature(ee.Geometry.Point(103.83, 1.33), {'city': 'Singapore'}),\n ])\n cities\n ```\n\n\u003c!-- --\u003e\n\n2. Add the city locations to the map and redisplay it. \n\n ```python\n m.add_layer(cities, name='Cities')\n m\n ```\n\nExtract and chart data\n----------------------\n\n1. Import the Altair charting library. \n\n ```python\n %pip install -q --upgrade altair\n import altair as alt\n ```\n\n\n2. Extract the climate data for the three cities as a pandas DataFrame. \n\n ```python\n city_climates = jan_2023_climate.reduceRegions(cities, ee.Reducer.first())\n\n city_climates_dataframe = ee.data.computeFeatures(\n {'expression': city_climates, 'fileFormat': 'PANDAS_DATAFRAME'}\n )\n city_climates_dataframe\n ```\n\n\u003c!-- --\u003e\n\n3. Plot the temperature for the cities as a bar chart. \n\n ```python\n alt.Chart(city_climates_dataframe).mark_bar(size=100).encode(\n alt.X('city:N', sort='y', axis=alt.Axis(labelAngle=0), title='City'),\n alt.Y('temperature_2m:Q', title='Temperature (K)'),\n tooltip=[\n alt.Tooltip('city:N', title='City'),\n alt.Tooltip('temperature_2m:Q', title='Temperature (K)'),\n ],\n ).properties(title='January 2023 temperature for selected cities', width=500)\n ```\n\nWhat's next\n-----------\n\n- Learn about analyzing data with Earth Engine's [objects and methods](/earth-engine/guides/objects_methods_overview).\n- Learn about Earth Engine's [processing environments](/earth-engine/guides/processing_environments).\n- Learn about Earth Engine's [machine learning capabilities](/earth-engine/guides/machine-learning).\n- Learn how to [export your computation results to BigQuery](/earth-engine/guides/exporting_to_bigquery)."]]