varchart=ui.Chart.feature.byFeature(cityClimates,'city','temperature_2m').setChartType('ColumnChart').setOptions({title:'January 2023 temperature for selected cities',hAxis:{title:'City'},vAxis:{title:'Temperature (K)'},legend:{position:'none'}});print(chart);
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThis quickstart provides an interactive introduction to visualizing and analyzing geospatial data using the Earth Engine Code Editor.\u003c/p\u003e\n"],["\u003cp\u003eBefore starting, users need a Google Cloud Project; instructions are provided for creating or selecting one.\u003c/p\u003e\n"],["\u003cp\u003eThe guide walks through adding both raster and vector data to a map within the Code Editor, using provided code snippets.\u003c/p\u003e\n"],["\u003cp\u003eIt demonstrates extracting data for specific locations and visualizing it using charts within the Code Editor.\u003c/p\u003e\n"],["\u003cp\u003eUsers are encouraged to explore further resources about Earth Engine features, data analysis, and advanced capabilities.\u003c/p\u003e\n"]]],[],null,["# Get started with Earth Engine in the Code Editor\n\nThis quickstart will give you an interactive introduction to visualizing and\nanalyzing geospatial data with the Earth Engine Code Editor.\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\nWelcome to the Code Editor\n--------------------------\n\nThe Earth Engine Code Editor is a web-based interactive development environment\nfor accessing Earth Engine and visualizing results directly in the browser. It\nprovides tools for managing scripts, assets, and export tasks, with analyses\nwritten in JavaScript using the Earth Engine JavaScript client library. The\ninterface includes a code editor, map display, and console for immediate\nfeedback and inspection.\nThe Earth Engine Code Editor at [code.earthengine.google.com](https://code.earthengine.google.com)\n\nGet started\n-----------\n\n**1.** Visit [**code.earthengine.google.com**](https://code.earthengine.google.com)\nto get started. On your first Code Editor visit, you may be greeted with a tour\nhighlighting the different features of the Code Editor.\n\n**2.** Navigate to the login widget in the upper right corner and ensure the\nproject you set up for this quickstart is selected. If it's not, select\n\"Change Cloud Project\" from the menu and follow the prompts to search for it\nand select it.\n\n**3.** In the following sections, copy each code block into the editor panel,\nclick \"Run\", and inspect the results in the map or console. Each step builds\nupon previous ones, so add code progressively without removing earlier blocks.\n\nAdd raster data to a map\n------------------------\n\n**1.** Load climate data for a given period and display its metadata. \n\n```javascript\nvar jan2023Climate = ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY_AGGR')\n .filterDate('2023-01-01', '2023-02-01')\n .first();\n\nprint('jan2023Climate', jan2023Climate);\n```\n\n\u003cbr /\u003e\n\n**2.** Add the temperature band as a layer to the map widget with specific\nvisualization properties. \n\n```javascript\nvar visParams = {\n bands: ['temperature_2m'],\n min: 229,\n max: 304,\n palette: ['#000004', '#410967', '#932567', '#f16e43', '#fcffa4']\n};\n\nMap.addLayer(jan2023Climate, visParams, 'Temperature (K)');\nMap.setCenter(0, 40, 2);\n```\n\n\u003cbr /\u003e\n\nAdd vector data to a map\n------------------------\n\n**1.** Create a vector data object with points for three cities. \n\n```javascript\nvar 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\nprint('cities', cities);\n```\n\n\u003cbr /\u003e\n\n**2.** Add the city locations to the map and rerun the script to display it. \n\n```javascript\nMap.addLayer(cities, null, 'Cities');\n```\n\n\u003cbr /\u003e\n\nExtract and chart data\n----------------------\n\n**1.** Extract the climate data for the three cities; results are added to the\ninput FeatureCollection. \n\n```javascript\nvar cityClimates = jan2023Climate.reduceRegions(cities, ee.Reducer.first());\n\nprint('cityClimates', cityClimates);\n```\n\n\u003cbr /\u003e\n\n**2.** Plot the temperature for the cities as a bar chart. \n\n```javascript\nvar chart = ui.Chart.feature.byFeature(cityClimates, 'city', 'temperature_2m')\n .setChartType('ColumnChart')\n .setOptions({\n title: 'January 2023 temperature for selected cities',\n hAxis: {title: 'City'},\n vAxis: {title: 'Temperature (K)'},\n legend: {position: 'none'}\n });\n\nprint(chart);\n```\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- Learn more about the [features of the Code Editor](/earth-engine/guides/playground).\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)."]]