Replies: 1 comment 1 reply
-
You need to provide a complete notebook that can produce the errors. Make sure all private datasets are also accessible directly through the notebook. A question that makes it easier for others to debug is more likely to get an answer. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to work on calculating surface water area and vegetation area for catchments layers.
I made some changes to the original code. Which doesn't run into errors but does not even work when you submit. Also, it is not allowing to apply the filters.
Here are the changes I made to the code (:
Add Earth Engine data
fc = ee.FeatureCollection('users/msahajar/Catchments')
Map.addLayer(fc, {}, 'NSW catchments')
Map
#Design Interactive widgets (admin1 is removed and only admin 2 is retained for catchments)
admin2_widget = widgets.Text(
description='Catchment:',
value='Lachlan',
width=300,
style=style
)
def aoi_change(change):
Map.layers = Map.layers[:4]
Map.user_roi = None
Map.user_rois = None
Map.draw_count = 0
admin2_widget.value = ''
output_widget.clear_output()
full_widget = widgets.VBox([
widgets.HBox([admin2_widget, aoi_widget, download_widget]),
widgets.HBox([band_combo, year_widget, fmask_widget]),
widgets.HBox([nd_indices, first_band, second_band, nd_threshold, nd_color]),
submit
])
full_widget
Capture user interaction with the map
def handle_interaction(**kwargs):
latlon = kwargs.get('coordinates')
if kwargs.get('type') == 'click' and not aoi_widget.value:
Map.default_style = {'cursor': 'wait'}
xy = ee.Geometry.Point(latlon[::-1])
selected_fc = fc.filterBounds(xy)
Map.on_interaction(handle_interaction)
Click event handler
def submit_clicked(b):
I am just posting only the relevant code section where layer interaction is involved.
I am having trouble applying filters for the layer mostly. Also, I have trouble understanding the data formats, how is the catchment layer I am using is different from the US Counties file? US counties layer has metadata displayed in the attribute section whereas the layer I am using is in a tabular format.
How to address this in the code? PFA shp files of the catchment layer I am using for your reference.
lachlan_boundary.zip
I appreciate your time and support.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions