How to Upload Search for Code in Editor

The Earth Engine (EE) Code Editor at code.earthengine.google.com is a web-based IDE for the Earth Engine JavaScript API. Code Editor features are designed to brand developing complex geospatial workflows fast and easy. The Code Editor has the post-obit elements (illustrated in Figure one):

  • JavaScript code editor
  • Map brandish for visualizing geospatial datasets
  • API reference documentation (Docs tab)
  • Git-based Script Manager (Scripts tab)
  • Console output (Console tab)
  • Chore Manager (Tasks tab) to handle long-running queries
  • Interactive map query (Inspector tab)
  • Search of the information archive or saved scripts
  • Geometry cartoon tools
Code Editor
Figure 1. Diagram of components of the Earth Engine Lawmaking Editor at code.earthengine.google.com

The Code Editor has a variety of features to help you lot take advantage of the Globe Engine API. View example scripts or save your ain scripts on the Scripts tab. Query objects placed on the map with the Inspector tab. Display and chart numeric results using the Google Visualization API. Share a unique URL to your script with collaborators and friends with the Get Link button. Scripts yous develop in the Code Editor are sent to Google for processing and the generated map tiles and/or messages are sent back for brandish in the Map and/or Panel tab. All you demand to run the Code Editor is a web browser (use Google Chrome for best results) and an internet connexion. The following sections depict elements of the Earth Engine Lawmaking Editor in more particular.

JavaScript editor

The JavaScript editor will:

  • Format and highlight code every bit you lot blazon
  • Underline lawmaking with issues, offering fixes and other hints for correct syntax
  • Autocomplete pairs of quotes, brackets and parentheses
  • Offer code completion hints for Earth Engine functions

Higher up the code editor are buttons for running the script, saving the script, resetting the output map and console, and getting a link to the script. When the Become Link button is pressed, a unique link will appear in the browser'due south address bar. This link represents the lawmaking in the editor at the fourth dimension the push button was pressed.

API reference (Docs tab)

On the left side of the Code Editor is the Docs tab, which contains the complete JavaScript API documentation. The documentation tin be searched and browsed from the Docs tab.

Script Manager (Scripts tab)

The Scripts tab is side by side to the API Docs in the left panel of the Code Editor. The Script Manager stores private, shared and example scripts in Git repositories hosted by Google. The repositories are arranged by access level, with your individual scripts stored in a repository you own in the Owner folder: users/username/default. You lot (and only you) have access to the repositories in the Owner folder unless you share them with someone else. The repositories in the Writer binder are repositories for which write access has been granted to you by their owner. You tin add new scripts to, modify existing scripts in, or change access to (you may not remove their owner) the repositories in the Writer folder. The repositories in the Reader binder are repositories for which read access has been granted to you by their owner. The Examples folder is a special repository managed by Google which contains code samples. The Annal binder contains legacy repositories to which you lot have admission just have not all the same been migrated past their owner from an older version of the Script Manager. Search through your scripts using the filter bar at the peak of the Scripts tab.

scripts
Figure 2. The Script Director.

Click the push to create a new repository in the Owner binder or to create folders and files within a repository. You tin rename scripts with the icon and delete them with the icon. You tin move scripts and organize them into folders using drag and driblet (Figure 2). If you elevate a script to another repository, it gets copied.

All scripts and repositories maintain total version history. Click on the icon next to a script or repository to compare or revert it to an older version. To delete a repository, click the icon. To configure access to a repository, click the icon next to the repository proper name. Note that if y'all share a repository, the person with whom you're sharing will need to accept the repository by clicking the link shown in the settings dialog. Previously accepted repositories tin be subconscious by clicking the icon following the repo proper noun in the Script Director.

Repositories can be accessed using Git, and so y'all can manage and edit your scripts exterior the Code Editor, or sync them with an external organisation like GitHub. (Larn more about Git from this tutorial). Click on the icon next to the repository name for instructions on cloning the repository. Annotation that yous tin browse the repositories to which you have access by going to earthengine.googlesource.com. For some Git operations, you may need to create authentication credentials by going to the Generate Password link at the top of the earthengine.googlesource.com page.

Script modules

It's skillful do to write modular, reusable code that can be shared betwixt scripts without extensive copying and pasting. To enable modular evolution, Earth Engine provides the ability to share code between scripts. For example, suppose you write a function that performs a useful fix of operations. Rather than re-create the lawmaking of the office into a new script, information technology's easier for the new script to load the function straight. To make a function or object available to other scripts, y'all add together information technology to a special object called exports. To utilise the code in some other script, use the require part to load the exports from another script. For example, suppose you define the following module in a file named FooModule.js which is in a folder named Modules:

Code Editor (JavaScript)

/**  * The Foo module is a demonstration of script modules.  * It contains a foo role that returns a greeting string.  * Information technology likewise contains a bar object representing the current appointment.  * @module Modules/FooModule  */  /**  * Returns a greeting string.  * @param {ee.Cord} arg The proper noun to which the greeting should be addressed  * @return {ee.String} The consummate greeting.  */ exports.foo = function(arg) {   return 'Hello, ' + arg + '!  And a expert twenty-four hour period to you!'; };  /**  * An ee.Date object containing the time at which the object was created.  */ exports.bar = ee.Date(Date.now());

Annotation the use of the exports keyword in the form of exports.objectToExport. You can brand use of this module in another script past using the require part. For example:

Lawmaking Editor (JavaScript)

var Foo = crave('users/username/default:Modules/FooModule.js');  print(Foo.doc);  print(Foo.foo('world'));  impress('Time now:', Foo.bar);

The require part expects a string that describes the absolute path to the location of the module. Specifically, the argument of require() is of the form 'pathToRepository:pathToModuleScript'. You lot can only load modules from repositories that y'all ain and/or take read access to. If you desire others to be able to use your module, the repository must be shared with the other users you lot want to have access. You lot may wish to document your module to help others understand how to use it; we recommend using JSDoc mode with the @module tag.

You tin use the URL parameter ?scriptPath={repo}:{script} to share a reference to a file in your repo, e.m. https://lawmaking.earthengine.google.com/?scriptPath=users/username/utils:utils. Upon visiting the URL, the referenced file and its repo volition be added to either the Reader or Author directory on the Scripts tab, depending on your permission level for the shared repo.

Asset Manager (Assets tab)

The Asset Manager is in the Assets tab in the left panel. Use the Asset Manager (Figure 3) to upload and manage your own image avails in Earth Engine. See the Asset Manager page for details.

assets
Figure three. The Asset Managing director.

Code Editor scripts tin can be shared via an encoded URL. The following sections describe diverse ways to generate a script URL, available options, and methods for managing script URLs.

The "Get Link" push at the top of the Code Editor (Figure 4) provides an interface for generating script URLs and setting script beliefs options. Note the distinctions between snapshot and saved script URLs described below.

link
Figure 4. The "Get Link" button.

Code in the Editor can be shared via an encoded snapshot URL that gets created upon clicking the "Get Link" button at the top of the Code Editor. When the URL is visited by someone with an Earth Engine account, the browser will navigate to the Code Editor and replicate the environment as it was when the link was created, including code, imports, map layers, and map position. Clicking the "Get Link" button will automatically re-create the script link to the clipboard. Additionally, a dialog box will appear providing options to control the execution of the shared script, forth with buttons to copy and visit the generated link. The control options include preventing the script from automatically running, and hiding the code pane when someone opens the shared link. The draggable dialog box can be dismissed via the "Esc" key or a click elsewhere on the page.

Saved scripts have an option to share a link that will always load the most recent saved version and is only accessible by you and others with current access to the repository containing the script. To use this characteristic, load a saved script from the Script Director tab, click the dropdown arrow to the right of the "Get Link" button and select "Copy Script Path". A dialog box will appear presenting the shareable script URL. Notation that the script URL has too been set in the browser'due south address bar. For guidance on sharing your repository with others, please come across the Script Manager section.

The dropdown push to the right of the "Get Link" button has an option to "Manage Links". Clicking this option loads a new browser tab with an interface for y'all to recall, remove, and download previously generated script links. Selecting a script and pressing the download button volition download a zipped binder ("code_editor_links.zilch") to your arrangement containing a .txt file representation for each selected script.

The ui.url module allows programmatic manipulation of the script URL's fragment identifier via get and fix methods. This means that Code Editor scripts and Earth Engine Apps can read and shop values in the folio's URL. Notice the cease of the post-obit two URLs, the commencement sets the debug variable as imitation and the 2nd sets it as true; visit both links and detect that the debug checkbox in the console is non checked in the outset, and is checked in the second, changing the behavior of each script.

https://code.earthengine.google.com/5695887aad76979388a723a85339fbf2#debug=false;        
https://code.earthengine.google.com/5695887aad76979388a723a85339fbf2#debug=true;        

This feature can be used to set up map zoom and centre, as well as other behaviors you might want to customize when sending links to item people or groups.

To find datasets to use in your scripts, yous can employ the search tool for the information archive. The search tool is the text box at the elevation of the Lawmaking Editor that says 'Search places and datasets...' Type the name of a data production, sensor, or other keyword into the search bar and click the button to run across a list of matching places, raster and table datasets. Click on any raster or table result to come across the description for that dataset in the archive. To import the dataset directly into your script, click the import link or the button from the dataset description.

Imports

The results of importing datasets to your script are organized in an imports department at the top of your script, hidden until yous import something. In one case you have created some imports, you lot should see something similar to Figure 5. To re-create imports to another script, or convert the imports to JavaScript, click the icon next to the Imports header and copy the generated code into your script. Yous can delete the import with the icon.

imports
Figure 5. The imports section at the meridian of the code editor.

Map

The Map object in the API refers to the map display in the Code Editor. For example, Map.getBounds() will return the geographic region visible in the Code Editor. Check the Map functions in the API to run into other customizations for this display.

Layer Manager

Use the Layer Manager in the upper right corner of the map to adapt the display of layers you added to the map. Specifically, you can toggle the visibility of a layer or adjust its transparency with the slider. Click the icon to adapt visualization parameters for individual layers. The visualization tool that appears (Figure 6) allows you lot to interactively configure layer brandish parameters. Click the push button on the right of the tool (which performs a Custom stretch to the supplied min and max range past default) to linearly stretch the display to either percentiles or standard deviations of prototype values in the display window. Statistics are computed from all the pixels in the Map window at the current zoom level. Use the sliders to adjust gamma and/or transparency. Click the Palette radio button and specify a custom palette by calculation colors (), removing colors () or manually entering a comma separated list of hex strings (). Click Apply to apply the visualization parameters to the current display. Click Import to load a visualization parameters object every bit a new variable in the imports section of your script.

imports
Figure 6. The layer visualization tool.

Note that to the right of the Layer Manager are toggle buttons for dissimilar map backgrounds. Customize the background using Map.setStyle().

Inspector tab

The Inspector tab side by side to the Chore Manager lets you interactively query the map. When the Inspector tab is activated, the cursor becomes a crosshair which will display the location and layer values under the cursor when y'all click on the map. For example, Effigy seven shows the results of clicking on the map with in the Inspector tab. The cursor location and zoom level are displayed along with pixel values and a list of objects on the map. The objects list is interactive. To see more than information, expand the objects in the Inspector tab.

inspector
Figure 7. The Inspector tab shows information almost the cursor location and the layer values nether the cursor.

Panel Tab

When you print() something from your script, such as text, objects or charts, the result will be displayed in the Console. The console is interactive, then you can aggrandize printed objects to get more than details about them.

Tasks tab

Earth Engine Tasks are operations that are capable of running much longer than the standard API request timeout. These long-running tasks are the only mechanism for creating persistent artifacts in Earth Engine and next systems (Google Cloud Storage, Google Drive, etc.), and they autumn into two categories: Import and Consign.

Import tasks can exist used to upload images or upload tables into Earth Engine from a variety of filetypes (.csv, .tif, etc.). Export tasks can exist used to execute and write results from the EE computation arrangement (see the guide for exporting data ).

For exports, each call to an Consign function in the Lawmaking Editor will populate an entry in the Unsubmitted tasks section of the Tasks tab. To submit an consign task to the server, click the Run push button adjacent to the chore. A configuration dialog will appear that allows you to specify a variety of parameters for the task. If the task is fully specified at cosmos fourth dimension (that is, the call to Export has all necessary parameters), hold ctrl or while clicking Run to submit the task without showing the dialog.

For imports, file upload happens locally before the task is submitted to the server. Import tasks in the upload stage will show their progress in the Unsubmitted tasks section and automatically submit to the server once the file upload is consummate.

Unsubmitted tasks only appear on the page which created them, and they are lost when the page is closed. Once a chore is submitted to the server, clicking on its row in the UI will provide additional data and options most the task status, including the option to request cancellation.

To view, search and cancel many tasks in a total-folio view (including on mobile clients), use the Task Director.

Profiler

The profiler displays information virtually the resources (CPU time, retention) consumed by specific algorithms and other parts of a computation. This helps to diagnose why a script is running slowly or failing due to memory limits. To use the profiler, click the Run with profiler option in the dropdown on the Run push button. As a shortcut, hold down Alt (or Choice on Mac) and click Run, or press Ctrl+Alt+Enter. This activates a Profiler tab on the correct side of the code editor. As the script runs, the Profiler tab will display a table of resource usage from the script. Clicking the Run push (without profiling) volition make the Profiler tab disappear and disable the profiler.

The profiler displays information about CPU and retention usage (per algorithm and asset) resulting from computations invoked by the script and the display of every tile currently visible in the map. Each row in the profiler output corresponds to an algorithm, computation, asset load or overhead functioning as described in the 'Description' column. The columns in the profiler are:

Description
A textual description of the computation, algorithm, asset load or overhead functioning being profiled.
Count
An indicator proportional to the number of times the operation described in 'Clarification' was invoked.
Compute
An indicator of CPU time taken by the operation(s).
Current Mem
This column appears simply if in that location was an error because the script used too much memory. It shows the corporeality of retentivity in utilise on whatever single compute node at the moment the error occurred.
Superlative Mem
Maximum memory used on whatsoever single compute node for the operation.

You can also import geometries to your script by drawing them on screen. To create geometries, use the geometry cartoon tools in the upper left corner of the map brandish (Figure 8). For cartoon points, apply the placemark icon , for drawing lines, use the line icon , for drawing polygons, use the polygon icon , for cartoon rectangles employ the rectangle icon . (Annotation that rectangles are planar geometries, so they cannot be placed on a layer with geodesic geometries like lines and polygons.)

Using any of the drawing tools will automatically create a new geometry layer and add together an import for that layer to the Imports section. To add geometries to a new layer, hover on the Geometry Imports in the map display and click the +new layer link. You can as well toggle visibility of the geometries from the Geometry Imports section. Notation that drawn geometries are geodesic by default, except for rectangles, which are planar only. Use the Geometry constructor to convert them to planar geometries. Learn more than about geometries in Globe Engine on the Geometry page.

geometries
Figure viii. The geometry drawing tools are in the upper left corner of the map display.

To configure the way geometries are imported to your script, click the icon next to the layer in the Geometry Imports department on the map or in the Imports section of the code editor. The geometry layer settings tool will be displayed in a dialog box which should look something like Effigy 9. Note that y'all can import the drawn shapes as geometries, features or feature collections. The geometry import settings also allow yous to modify the colour with which the layer is displayed, add properties to the layer (if it is imported every bit a Feature or FeatureCollection) or rename the layer.

geometry_import
Figure 9. The geometry configuration tool.

Finally, to prevent geometries in a layer from being edited, you can lock the layer past pressing the icon adjacent to the layer. This will prevent adding, deleting, or editing any geometries on the layer. To unlock the layer again, press the icon.

Help!

Click the button in the upper right of the Lawmaking Editor to see links to this Programmer's Guide, other help forums, a guided bout of the Lawmaking Editor and a list of keyboard shortcuts that assistance with coding, running code, and displaying information on the Map. Click the push button to file a bug written report, request a new feature, suggest a dataset, or otherwise transport feedback when no response is needed.

thomsonsoce1994.blogspot.com

Source: https://developers.google.com/earth-engine/guides/playground

0 Response to "How to Upload Search for Code in Editor"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel