Announcement : On
November 13, 2024 , all users will need to
use a Cloud project in order to access Earth Engine. After this date, continued individual access without a Cloud project will require
an exception .
Send feedback
Map.add
Stay organized with collections
Save and categorize content based on your preferences.
Adds an item to the map. Can also be used to add widgets like ui.Label as well as some non-widget objects like ui.Map.Layer.
Returns the map.
Usage Returns Map.add(item)
ui.Map
Argument Type Details item
Object The item to add.
Examples
Code Editor (JavaScript)
// The default map in the Code Editor is a built-in ui.Map object called "Map".
// Let's refer to it as "defaultMap" for clarity.
var defaultMap = Map ;
// ui.Map objects can be constructed. Here, a new map is declared.
var newMap = ui . Map ({
center : { lat : 0 , lon : 0 , zoom : 1 },
style : { position : 'bottom - right ', width : '400 px '}
});
// Add the newMap to the defaultMap;
defaultMap . add ( newMap );
// Other UI widgets can be added to ui.Map objects, for example labels:
defaultMap . add ( ui . Label ( 'Default Map ', { position : 'bottom - left '}));
newMap . add ( ui . Label ( 'New Map ', { position : 'bottom - left '}));
// ...selectors:
defaultMap . add ( ui . Select ([ 'This ', 'That ', 'Other ']));
// ...or buttons:
defaultMap . add ( ui . Button ( 'Click me '));
// You can also add ui.Map.Layer objects. Here, an ee.Geometry object
// is converted to a map layer and added to the default map.
var geom = ee . Geometry . Point ( - 122.0841 , 37.4223 );
var geomLayer = ui . Map . Layer ( geom , { color : 'orange '}, 'Googleplex ');
defaultMap . add ( geomLayer );
defaultMap . centerObject ( geom , 18 );
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2023-10-06 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."]]