Anúncio: todos os projetos não comerciais registrados para usar o Earth Engine antes de
15 de abril de 2025 precisam
verificar a qualificação não comercial para manter o acesso ao Earth Engine.
ui.Map.setOptions
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Modifica o mapa básico do Google Maps. Permite: 1) definir o MapType atual. 2) Fornecer estilos personalizados para o mapa de base (MapTypeStyles). 3) Definir a lista de mapTypesIds disponíveis para o mapa básico.
Se for chamado sem parâmetros, redefine o tipo de mapa para o padrão do Google Maps.
Retorna este ui.Map.
Uso | Retorna |
---|
Map.setOptions(mapTypeId, styles, types) | ui.Map |
Argumento | Tipo | Detalhes |
---|
isso: ui.map | ui.Map | A instância ui.Map. |
mapTypeId | String, opcional | Um mapTypeId para definir o mapa base. Pode ser "ROADMAP", "SATELLITE", "HYBRID" ou "TERRAIN" para selecionar um dos tipos de mapa padrão da API Google Maps ou uma das chaves especificadas no dicionário opt_styles. Se for deixado como nulo e apenas um estilo for especificado em "opt_styles", esse estilo será usado. |
styles | Objeto, opcional | Um dicionário de objetos MapTypeStyle personalizados com uma chave de nome que vai aparecer nos controles de tipo de mapa. Consulte: https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyle |
types | List<String>, opcional | Uma lista de mapTypeIds a serem disponibilizados. Se for omitido, mas "opt_styles" for especificado, vai anexar todas as chaves de estilo aos tipos de mapa padrão da API Google Maps. |
Exemplos
Editor de código (JavaScript)
// Set the map to terrain with a string.
Map.setOptions('TERRAIN');
// Use a dictionary to add some typo protection.
var mapTypes = {
HYBRID: 'HYBRID',
ROADMAP: 'ROADMAP',
SATELLITE: 'SATELLITE',
TERRAIN: 'TERRAIN'
};
Map.setOptions({mapTypeId: mapTypes.HYBRID});
Map.setOptions({mapTypeId: mapTypes.ROADMAP});
Map.setOptions({mapTypeId: mapTypes.SATELLITE});
Map.setOptions({mapTypeId: mapTypes.TERRAIN});
// Add a basemap that inverts the lightness to make a darker background.
Map.setOptions({
styles:
{'Inverted': [{featureType: 'all', stylers: [{invert_lightness: true}]}]}
});
// Use types keyword to control map type visibility, e.g. show only 'Inverted'.
Map.setOptions({
styles:
{'Inverted': [{featureType: 'all', stylers: [{invert_lightness: true}]}]},
types: ['Inverted']
});
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-25 UTC.
[null,null,["Última atualização 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 \u003ccode\u003emapTypeId\u003c/code\u003e, \u003ccode\u003estyles\u003c/code\u003e, and \u003ccode\u003etypes\u003c/code\u003e as parameters to customize the basemap's appearance and functionality.\u003c/p\u003e\n"],["\u003cp\u003eResets the map to the default Google Maps style if called without any parameters.\u003c/p\u003e\n"],["\u003cp\u003eAllows the use of standard Google Maps API map types ("ROADMAP", "SATELLITE", "HYBRID", "TERRAIN") or custom styles defined using MapTypeStyle objects.\u003c/p\u003e\n"],["\u003cp\u003eOffers flexibility in controlling the visibility of map types through the \u003ccode\u003etypes\u003c/code\u003e parameter.\u003c/p\u003e\n"]]],["This tool modifies the Google Maps basemap by setting the `mapTypeId` (e.g., \"ROADMAP\", \"SATELLITE\"). It allows custom styles (`MapTypeStyles`) via a dictionary, with user-defined names. Users can control available map types using a list of `mapTypeIds`. If no parameters are specified it defaults to the original Google Maps basemap. Example usage is shown, to set different Map Types, add a style (like Inverted) or control the displayed Map Types.\n"],null,["# ui.Map.setOptions\n\n\u003cbr /\u003e\n\nModifies the Google Maps basemap. Allows for: 1) Setting the current MapType. 2) Providing custom styles for the basemap (MapTypeStyles). 3) Setting the list of available mapTypesIds for the basemap.\n\n\u003cbr /\u003e\n\nIf called with no parameters, resets the map type to the Google Maps default.\n\nReturns this ui.Map.\n\n| Usage | Returns |\n|----------------------------------------------------------|---------|\n| Map.setOptions`(`*mapTypeId* `, `*styles* `, `*types*`)` | ui.Map |\n\n| Argument | Type | Details |\n|----------------|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `ui.map` | ui.Map | The ui.Map instance. |\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// Set the map to terrain with a string.\nMap.setOptions('TERRAIN');\n\n// Use a dictionary to add some typo protection.\nvar mapTypes = {\n HYBRID: 'HYBRID',\n ROADMAP: 'ROADMAP',\n SATELLITE: 'SATELLITE',\n TERRAIN: 'TERRAIN'\n};\n\nMap.setOptions({mapTypeId: mapTypes.HYBRID});\nMap.setOptions({mapTypeId: mapTypes.ROADMAP});\nMap.setOptions({mapTypeId: mapTypes.SATELLITE});\nMap.setOptions({mapTypeId: mapTypes.TERRAIN});\n\n// Add a basemap that inverts the lightness to make a darker background.\nMap.setOptions({\n styles:\n {'Inverted': [{featureType: 'all', stylers: [{invert_lightness: true}]}]}\n});\n\n// Use types keyword to control map type visibility, e.g. show only 'Inverted'.\nMap.setOptions({\n styles:\n {'Inverted': [{featureType: 'all', stylers: [{invert_lightness: true}]}]},\n types: ['Inverted']\n});\n```"]]