Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
Map.onChangeCenter
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Registra una devolución de llamada que se activa cuando cambia el centro del mapa. Se activa durante el desplazamiento o cuando el centro del mapa se cambia de forma programática.
Devuelve un ID que se puede pasar a unlisten() para cancelar el registro de la devolución de llamada.
Uso | Muestra |
---|
Map.onChangeCenter(callback) | String |
Argumento | Tipo | Detalles |
---|
callback | Función | Es la devolución de llamada que se activará cuando cambie el centro del mapa. La devolución de llamada recibe dos parámetros: un objeto que contiene las coordenadas del nuevo centro (con las claves lon y lat) y el widget del mapa en sí. |
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 2025-07-26 (UTC)"],[[["\u003cp\u003eThe \u003ccode\u003eonChangeCenter\u003c/code\u003e function registers a callback that is triggered when the map's center is changed, either through panning or programmatically.\u003c/p\u003e\n"],["\u003cp\u003eThis function returns a unique ID that can be used with \u003ccode\u003eunlisten()\u003c/code\u003e to remove the registered callback.\u003c/p\u003e\n"],["\u003cp\u003eThe provided callback function receives the new center coordinates (longitude and latitude) and the map widget as arguments.\u003c/p\u003e\n"]]],["Registers a callback function triggered when the map's center changes, either through panning or programmatic modification. The `onChangeCenter` method takes a callback as an argument, providing it with the new center's coordinates (lon and lat) and the map widget. It returns a unique string ID, used to unregister the callback later. The provided callback function is executed each time the map center shifts.\n"],null,["# Map.onChangeCenter\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when the map center changes. This is fired during pan or when the map's center is changed programmatically.\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.onChangeCenter(callback)` | String |\n\n| Argument | Type | Details |\n|------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `callback` | Function | The callback to fire when the map center changes. The callback is passed two parameters: an object containing the coordinates of the new center (with keys lon and lat) and the map widget itself. |"]]