Question: I have a question regarding looking things up on google. Is this an appropriate way to get unstuck when we run into an issue? I found myself looking through the tutorials and did not see what I was looking for so I decided to google but am not sure I came up with the right solution.
Answer: Google is totally acceptable but this link posted here is probably more useful! Obviously, let us know if you’re having problems and it’s dire, email us directly! We’re always willing to help.
Those of you who are new to coding and having trouble applying the tutorial lessons to your own regions of interest, there are alot of online resources for help understanding javascript and also GEE’s brand of javascript. When I have a question, I typically use google tp search for an answer. Here are a few sites that popped up when I typed in “coding javascript in GEE” into a google search bar:
3) Earth Engine 101: Introduction to the API
4) Introduction to the Code Editor & Data Archive
5) Intro to JavaScript for GEE
I think any of these or a few could be very helpful in helping orient you to what this course is trying to teach and how to get there with the GEE tutorials. I know it is not easy to set aside specific time to learn coding when this course is supposed to be an applications course, but for those who are new to it, I think it will be very helpful to spend a separate hour or two working through one or some of these basic coding documents.
Another suggestion: I have often found that when I am doing a tutorial typing the code line by line provides me with a better way of understanding what I am being taught. Something is lost when you are just cutting and pasting code, then pressing ‘run.’ If you work through on the these or the textbook’s beginner tutorials, I think you will gain a better understanding.
Question: How do I share my GEE code link?
Answer: The way to produce a hyperlink of your script in GEE is to click “Get Link” at the top of your script (blue box). It is next to the “Save” button. Make sure you ‘get link’ AFTER you save your code because it will produce a link from the last code save. It’s basically sending bits of code that are a snapshot in time…So for instance, you might produce a code that can do one thing and then send a link to that. If you keep working on that script though, I won’t see updates unless you send a new link. I hope that makes sense!
Selecting multiple lines for comments with ctrl + /, Q & A
Question: I’m having trouble learning the shortcut on page 14. When I select several lines and hit ctrl + /, nothing happens. Maybe it’s my computer? Or I could be interpreting the instructions wrong. I don’t mind typing double / on each line, however I see how this shortcut could save time when debugging. Anyone have ideas?
Answer: This may be a Mac/PC thing. I am on a Mac and I highlight the block of code/text that I want to comment out and press ‘command’ + ‘/’. If I press it once it is commented out, if I press it again, it is uncommented. Basically ‘command’ + ‘/’ is a way to turn on and off code lines in your script.
Java Syntax, Q & A
Question: I’ve worked through the textbook tutorials and the option reading on Java code in the course materials. I’m still a bit confused about how to put things together. For example, I tried out the assignment on p. 18 since I’ve never coded in Java before. The doc tab shows two arguments for cat(string2), but I’m not sure where those arguments go. To me, it looks like cat(string2) only has one argument. In the explainer notes for cat, it names one of the arguments “this: string1”. What is “this”?
I got it to work with this code:
var mission = ee.String(‘Sentinel’)
var satellite = ee.String(‘2A’)
var missionName = mission.cat(satellite)
print (missionName)To do this, I was kind of just modeling off of other things I saw. And I’d like to understand it better than that.
I think that maybe ee.String is the ee object (?) here, And then you add something to it by putting a period after something (what kind of thing?) and then it seems to work.
So, are the functions those things listed under Docs at the first level (e.g., ee.String with a drop down arrow by it)? And then the things you put after the period (not sure what to call them) are the things listed under the drop-down arrow? But ee.String is listed there, too? How do you use this period stuff to string things together? Do you always start with an ee.thing and then add the other stuff to it after periods?
Answer:
There are some great online resources that can do a far better job of explaining what these different java script code components are. Strings are one way of storing objects, typically information in text (with single or double quotes depending on their use/meaning) or number form (no quotes).
I think your code looks good and you made the assignment work! In it you were basically telling it that you had two pieces of information that you wanted to join together, and you used concatenate to join them. You could get the same result by using print(‘Sentinel2A’), but since that is just a string of text to print, it would not be stored or useable in another way, as it is if you create a variable to store it. Variables are also containers or information. They can be strings, text, numbers, equations, images, collections, and more. The ‘ee’ signafier just stands for Earth Engine…Google’s just putting it’s stamp on the javascript resources.
Here is a good resource that should help your understanding javascript in the context of GEE.