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.setOptions
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Modifica el mapa base de Google Maps. Permite lo siguiente:
1) Configurar el MapType actual 2) Proporcionar diseños personalizados para el mapa base (MapTypeStyles) 3) Establece la lista de mapTypesIds disponibles para el mapa base.
Si se llama sin parámetros, restablece el tipo de mapa al valor predeterminado de Google.
Devuelve el mapa.
Uso | Muestra |
---|
Map.setOptions(mapTypeId, styles, types) | ui.Map |
Argumento | Tipo | Detalles |
---|
mapTypeId | Cadena, opcional | Es un mapTypeId para establecer el mapa base. Puede ser "ROADMAP", "SATELLITE", "HYBRID" o "TERRAIN" para seleccionar uno de los tipos de mapa estándar de la API de Google Maps, o bien una de las claves especificadas en el diccionario opt_styles. Si se deja como nulo y solo se especifica 1 estilo en opt_styles, se usará ese estilo. |
styles | Objeto, opcional | Es un diccionario de objetos MapTypeStyle personalizados con una clave que incluye un nombre que aparecerá en los controles de tipo de mapa. Consulta: https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyle |
types | List<String>, opcional | Es una lista de mapTypeIds que se pueden usar. Si se omite, pero se especifica opt_styles, se agregan todas las claves de diseño a los tipos de mapa estándar de la API de Google Maps. |
Ejemplos
Editor de código (JavaScript)
// Types
Map.setOptions('HYBRID');
Map.setOptions('ROADMAP');
Map.setOptions('SATELLITE');
Map.setOptions('TERRAIN');
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-25 (UTC)
[null,null,["Última actualización: 2025-07-25 (UTC)"],[[["\u003cp\u003eModifies the Google Maps basemap by setting the map type, providing custom styles, and controlling available map types.\u003c/p\u003e\n"],["\u003cp\u003eAccepts parameters to change the basemap's appearance or resets to the default Google Maps style when called without parameters.\u003c/p\u003e\n"],["\u003cp\u003eOffers flexibility in styling through custom MapTypeStyle objects and allows for selection from standard Google Maps API map types or custom styles.\u003c/p\u003e\n"],["\u003cp\u003eUses the \u003ccode\u003esetOptions()\u003c/code\u003e method with arguments for mapTypeId, styles, and types to implement the modifications.\u003c/p\u003e\n"],["\u003cp\u003eReturns the ui.Map object after applying the specified options.\u003c/p\u003e\n"]]],["This function, `Map.setOptions()`, modifies the Google Maps basemap. It can set the `mapTypeId` to \"ROADMAP,\" \"SATELLITE,\" \"HYBRID,\" or \"TERRAIN,\" or to a custom style from the `styles` dictionary. Custom styles (`styles`) are defined as `MapTypeStyle` objects. The available `mapTypeIds` displayed in the basemap can be defined in `types`. If called without arguments, the function reverts to the default Google map type. It returns the modified `ui.Map` object.\n"],null,["# Map.setOptions\n\n\u003cbr /\u003e\n\nModifies the Google Maps basemap. Allows for:\n\n\u003cbr /\u003e\n\n1) Setting the current MapType. 2) Providing custom styles for the basemap (MapTypeStyles). 3) Setting the list of available mapTypesIds for the basemap.\n\nIf called with no parameters, resets the map type to the google default.\n\nReturns the map.\n\n| Usage | Returns |\n|----------------------------------------------------------|---------|\n| `Map.setOptions(`*mapTypeId* `, `*styles* `, `*types*`)` | ui.Map |\n\n| Argument | Type | Details |\n|-------------|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `mapTypeId` | String, optional | A mapTypeId to set the basemap to. Can be one of \"ROADMAP\", \"SATELLITE\", \"HYBRID\" or \"TERRAIN\" to select one of the standard Google Maps API map types, or one of the keys specified in the opt_styles dictionary. If left as null and only 1 style is specified in opt_styles, that style will be used. |\n| `styles` | Object, optional | A dictionary of custom MapTypeStyle objects keyed with a name that will appear in the map's Map Type Controls. See: https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyle |\n| `types` | List\\\u003cString\\\u003e, optional | A list of mapTypeIds to make available. If omitted, but opt_styles is specified, appends all of the style keys to the standard Google Maps API map types. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Types\nMap.setOptions('HYBRID');\nMap.setOptions('ROADMAP');\nMap.setOptions('SATELLITE');\nMap.setOptions('TERRAIN');\n```"]]