시작하려면 이 예시를 App Engine 플랫폼의 Earth Engine 애플리케이션의 'Hello World'로 생각해 보세요. 앱은 Earth Engine 이미지(SRTM 고도)가 포함된 양방향 지도를 표시합니다. config.py 파일을 검사합니다. 이 파일은 프로젝트의 서비스 계정 사용자 인증 정보로 수정해야 합니다. 유일한 Earth Engine 관련 코드는 server.py에 있습니다 (2줄). Earth Engine은 앱 페이지에 표시할 이미지의 mapid를 가져온 다음 이 값을 페이지 렌더링에 사용되는 Jinja 템플릿에 전달합니다.
다음은 서버 인증을 사용하는 더 복잡한 예입니다. 지도에 여러 다각형을 추가하여 사용자가 다각형을 클릭하면 다각형에 관한 세부정보를 표시합니다. 차트 표시에는 Google Visualization API를 사용하고 페이지를 새로고침하지 않고도 서버에서 새 데이터를 가져오는 AJAX라는 기법을 사용합니다.
이 예에서는 서버 인증에 Node.js Cloud 함수를 사용합니다. 이 함수는 Earth Engine API 및 TurfJS를 사용하여 hexbin 시각화를 위한 GeoJSON을 만듭니다. 웹페이지는 정적이며 (Cloud Storage에 호스팅됨) 지도에 hexbin 시각화를 표시합니다. 이 데모는 다른 예시와 달리 App Engine을 사용하지 않습니다.
이 예에서는 클라이언트 승인 흐름도 사용합니다. ee.MapLayerOverlay를 사용하여 콜백 함수와 함께 지도에 Earth Engine 데이터를 추가하고 로드된 타일 수를 추적하는 방법을 보여줍니다. 이 데모의 모든 매핑 기능은 서버 인증 데모에서와 같이 서버에서 생성된 mapid로 실행할 수 있습니다.
이 예에서는 클라이언트 승인 흐름도 사용합니다. 이 예에서는 지도 위에 다각형을 그리고 Earth Engine에서 다각형을 사용하여 지역 축소를 실행하고 다각형 평균을 표시하는 기능을 보여줍니다. 이 데모의 모든 매핑 기능은 서버 인증 데모에서와 같이 서버에서 생성된 mapid로 실행할 수 있습니다.
비교적 복잡한 예입니다. 애플리케이션의 사용자 인증 정보를 사용하는 Earth Engine용 인증 흐름과 사용자의 개인 사용자 인증 정보를 사용하는 Google Drive용 인증 흐름 등 두 가지 인증 흐름을 사용하는 방법을 보여줍니다. 이를 통해 사용자는 레이어를 선택하고 다각형을 그리고 다각형으로 잘린 레이어를 Drive로 내보낼 수 있습니다.
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[[["\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."]]