[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThe Earth Engine demos on GitHub provide various examples of how to authenticate and use Earth Engine in web applications.\u003c/p\u003e\n"],["\u003cp\u003eExamples are categorized by authentication methods: service accounts and OAuth2.\u003c/p\u003e\n"],["\u003cp\u003eService account examples showcase server-side authentication, including a basic 'hello world' app and more complex visualizations.\u003c/p\u003e\n"],["\u003cp\u003eOAuth2 examples demonstrate client-side authentication, requiring users to be Earth Engine users and enabling functionalities like drawing polygons and exporting data.\u003c/p\u003e\n"],["\u003cp\u003eThe demos utilize technologies like App Engine, Cloud Functions, Google Visualization API, and TurfJS for building diverse applications.\u003c/p\u003e\n"]]],[],null,["# App Engine Example Apps\n\nThe following describes examples in the\n[Earth Engine demos\ndirectory on GitHub](https://github.com/google/earthengine-api/tree/master/demos). The title of each example is a link to the source on\nGitHub. The examples are organized by how they authenticate with Earth Engine.\nTo learn more about authentication options and how to deploy these applications,\nsee the [App Engine \\& Earth Engine Overview](/earth-engine/app_engine_intro).\n\nAuthentication with service accounts\n------------------------------------\n\n### [server-auth-python](https://github.com/google/earthengine-api/tree/master/demos/server-auth-python)\n\nTo get started, consider this example the 'hello world' of Earth Engine applications on\nthe App Engine platform. The app displays an interactive map with an Earth Engine Image\n(SRTM elevation). Inspect the `config.py` file, noting that it needs to be\nmodified with your project's service account credentials. The only Earth Engine specific\ncode is in `server.py` (two lines!). Note that Earth Engine gets a mapid\nfor the image to be displayed on the the app's page, then passes this value to the\n[Jinja](http://jinja.pocoo.org/) template used to render the page.\n\n*** ** * ** ***\n\n### [server-auth-nodejs](https://github.com/google/earthengine-api/tree/master/demos/server-auth-nodejs)\n\nSame as the example above, using Node.js instead. The `server.js` file loads\nservice account credentials from a `.private-key.json` file, and gets a mapid for\nthe image to be displayed on the app's page.\n\n*** ** * ** ***\n\n### [trendy-lights](https://github.com/google/earthengine-api/tree/master/demos/trendy-lights)\n\nThis is a more complex example of using server authentication. It adds several polygons\nto the map, displaying details about the polygons when a user clicks them. It uses the\nGoogle Visualization API for charting, and a technique called AJAX to retrieve new data\nfrom the server without needing to refresh the page.\n\n*** ** * ** ***\n\n### [cloud-functions](https://github.com/google/earthengine-api/tree/master/demos/cloud-functions)\n\nThis example uses a Node.js [Cloud\nFunction](https://cloud.google.com/functions/) for server authentication. With the Earth Engine API and\n[TurfJS](http://turfjs.org/), the function creates GeoJSON for a hexbin\nvisualization. The webpage is static (hosted in\n[Cloud Storage](https://cloud.google.com/storage/)), and displays the hexbin\nvisualization on a map. *Unlike other examples, this demo does not use App Engine.*\n\n*** ** * ** ***\n\nAuthentication with OAuth2\n--------------------------\n\n### [client-auth](https://github.com/google/earthengine-api/tree/master/demos/client-auth)\n\nThis example demonstrates the OAuth flow for authenticating from the client. Specifically,\na user will need to authenticate as themselves (meaning they are already an Earth Engine\nuser) to use the app. To make that work, JavaScript origins and authorized redirects\nneed to be set from the Developers Console.\n\n*** ** * ** ***\n\n### [map-layer](https://github.com/google/earthengine-api/tree/master/demos/map-layer)\n\nThis example also uses the client authorization flow. It demonstrates using\n`ee.MapLayerOverlay` to add Earth Engine data to the map with a callback\nfunction to keep track how many tiles have been loaded. (All of the mapping functionality\nin this demo can be done with mapids generated on the server, as is done in the\nserver-auth demo).\n\n*** ** * ** ***\n\n### [polygon-drawing](https://github.com/google/earthengine-api/tree/master/demos/polygon-drawing)\n\nThis example also uses the client authorization flow. The example demonstrates\nfunctionality to draw a polygon over the map, perform a reduce region with the polygon\nin Earth Engine, and display the polygon mean. (All of the mapping functionality in\nthis demo can be done with mapids generated on the server, as is done in the server-auth\ndemo).\n\n*** ** * ** ***\n\n### [export-to-drive](https://github.com/google/earthengine-api/tree/master/demos/export-to-drive)\n\nThis is a relatively complex example. It demonstrates the use of two authentication\nflows, one for Earth Engine using the application's credentials and one for Google Drive\nusing the user's personal credentials. It allows the user to select a layer, draw a\npolygon and export the layer clipped by the polygon to Drive."]]