Pengumuman: Semua project nonkomersial yang terdaftar untuk menggunakan Earth Engine sebelum
15 April 2025 harus
memverifikasi kelayakan nonkomersial untuk mempertahankan akses Earth Engine.
Map.onClick
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Mendaftarkan callback yang dipicu saat peta diklik.
Menampilkan ID yang dapat diteruskan ke unlisten() untuk membatalkan pendaftaran callback.
Penggunaan | Hasil |
---|
Map.onClick(callback) | String |
Argumen | Jenis | Detail |
---|
callback | Fungsi | Callback yang akan diaktifkan saat peta diklik. Callback meneruskan objek yang berisi koordinat titik yang diklik (dengan kunci lon dan lat) dan widget peta. |
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[[["\u003cp\u003eRegisters a callback function that is triggered when the map is clicked, providing the coordinates of the click.\u003c/p\u003e\n"],["\u003cp\u003eReturns a unique ID that can be used to unregister the callback function later using \u003ccode\u003eunlisten()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eonClick\u003c/code\u003e accepts a single argument: a callback function which receives an object containing longitude, latitude, and the map widget.\u003c/p\u003e\n"]]],["A callback function is registered to be executed upon a map click. The `Map.onClick(callback)` method accepts this function as an argument and returns a unique string ID. This ID is used to unregister the callback later. The callback receives an object containing the longitude (`lon`), latitude (`lat`), and the map widget upon execution when a map click occurs.\n"],null,["# Map.onClick\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when the map is clicked.\n\n\u003cbr /\u003e\n\nReturns an ID which can be passed to unlisten() to unregister the callback.\n\n| Usage | Returns |\n|-------------------------|---------|\n| `Map.onClick(callback)` | String |\n\n| Argument | Type | Details |\n|------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `callback` | Function | The callback to fire when the map is clicked. The callback is passed an object containing the coordinates of the clicked point (with keys lon and lat) and the map widget. |"]]