Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geemap--usda_naip_imagery.ipynb #18

Closed
gaowudao opened this issue Apr 19, 2020 · 1 comment
Closed

geemap--usda_naip_imagery.ipynb #18

gaowudao opened this issue Apr 19, 2020 · 1 comment

Comments

@gaowudao
Copy link

  • geemap version:0.6.6
  • Python version:3.7.3
  • Operating System:Mac

Description

Describe what you were trying to get done.
I am trying using my watershed baoundry(.shp) ('users/gaowudao/hybas_lake_as_lev06_v1c') to get the image in the specific watershed.
Tell us what happened, what went wrong, and what you expected to happen.
The error"Number.multiply: Parameter 'left' is required" occured

What I Did

Paste the command(s) you ran and the output.
import geemap
from ipyleaflet import *
from ipywidgets import *
from geemap.eelib import *

Map = geemap.Map(center=(120, 40), zoom=4)
Map.default_style = {'cursor': 'pointer'}
Map

Map.setOptions('ROADMAP')

HUC6 = ee.FeatureCollection('users/gaowudao/hybas_lake_as_lev06_v1c');  

# Add HUC layer to the map
Map.setCenter(120.00, 47.01, 8);
Map.addLayer(ee.Image().paint(HUC6, 0, 1), {}, 'HUC-6 Watershed')   # HUC10 for the entire U.S.

label = Label("Click on the map to select a watershed")
widget_control = WidgetControl(widget=label, position='bottomright')
Map.add_control(widget_control)

layer = None

def handle_interaction(**kwargs):
    latlon = kwargs.get('coordinates')
    if kwargs.get('type') == 'click':
        Map.default_style = {'cursor': 'wait'}
        xy = ee.Geometry.Point(latlon[::-1])
        watershed = HUC6.filterBounds(xy)
        huc6_id = watershed.first().get('basin').getInfo()
        Map.layers = Map.layers[:3]
        Map.addLayer(ee.Image().paint(watershed, 0, 2), {'palette': 'red'}, 'HUC ID: ' + huc6_id) 
        
        NAIP_images = findNAIP(watershed)
        first_image = ee.Image(NAIP_images.toList(5).get(0))
        Map.addLayer(first_image, {'bands': ['N', 'R', 'G']}, 'first image')
#          count = NAIP_images.size().getInfo()
#          for i in range(0, count):
#              image = ee.Image(NAIP_images.toList(count).get(i))
#              Map.addLayer(image, {'bands': ['N', 'R', 'G']}, str(i))
        
        Map.default_style = {'cursor': 'pointer'}

Map.on_interaction(handle_interaction)

Map
If there was a crash, please include the traceback here.
---------------------------------------------------------------------------
HttpError                                 Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
    337   try:
--> 338     return call.execute(num_retries=num_retries)
    339   except apiclient.errors.HttpError as e:

~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 

~/opt/anaconda3/lib/python3.7/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
    897         if resp.status >= 300:
--> 898             raise HttpError(resp, content, uri=self.uri)
    899         return self.postproc(resp, content)

HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/maps?fields=name&alt=json returned "Number.multiply: Parameter 'left' is required.">

During handling of the above exception, another exception occurred:

EEException                               Traceback (most recent call last)
<ipython-input-12-c2f4a242aeb9> in handle_interaction(**kwargs)
     34         NAIP_images = findNAIP(watershed)
     35         first_image = ee.Image(NAIP_images.toList(5).get(0))
---> 36         Map.addLayer(first_image, {'bands': ['N', 'R', 'G']}, 'first image')
     37 #          count = NAIP_images.size().getInfo()
     38 #          for i in range(0, count):

~/opt/anaconda3/lib/python3.7/site-packages/geemap/geemap.py in add_ee_layer(self, ee_object, vis_params, name, shown, opacity)
    409             image = ee_object.mosaic()
    410 
--> 411         map_id_dict = ee.Image(image).getMapId(vis_params)
    412         tile_layer = ipyleaflet.TileLayer(
    413             url=map_id_dict['tile_fetcher'].url_format,

~/opt/anaconda3/lib/python3.7/site-packages/ee/image.py in getMapId(self, vis_params)
    129     vis_image, request = self._apply_visualization(vis_params)
    130     request['image'] = vis_image
--> 131     response = data.getMapId(request)
    132     response['image'] = self
    133     return response

~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in getMapId(params)
    589         parent=_get_projects_path(),
    590         fields='name',
--> 591         body=request))
    592     map_name = result['name']
    593     url_format = '%s/%s/%s/tiles/{z}/{x}/{y}' % (

~/opt/anaconda3/lib/python3.7/site-packages/ee/data.py in _execute_cloud_call(call, num_retries)
    338     return call.execute(num_retries=num_retries)
    339   except apiclient.errors.HttpError as e:
--> 340     raise _translate_cloud_exception(e)
    341 
    342 

EEException: Number.multiply: Parameter 'left' is required.
@giswqs
Copy link
Member

giswqs commented Apr 19, 2020

@gaowudao USDA NAIP images only cover the United States. Your watershed boundary is outside the US. Therefore, you won't get any NAIP imagery.

@giswqs giswqs closed this as completed Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants