Google Earth Engine (GEE)——Received too many arguments to function MultiPoint(). Expected at most 2

在使用Google Earth Engine (GEE)时遇到错误:Received too many arguments to function MultiPoint(). Expected at most 2 but got 60。问题源于将坐标点单独传入函数,而非作为集合传递。正确做法是将所有坐标点作为列表嵌套传递,如[[], [], ..., []]。MultiPoint函数仅接受一个参数coords,该参数为GeoJSON点格式的列表或投影坐标。修正代码后,确保参数以整体形式传递。" 100553760,7343037,Flume实战:从安装到配置案例,"['Flume', '大数据', '企业开发', '日志处理']
摘要由CSDN通过智能技术生成

当我们在进行部分操作的时候我们会发现,有些参数需要仅有两个,而你输入了太多参数,今天我们遇到了一个问题,也就是说你可能输入的参数形式错了,这里比如说对方要求的是一个集合,而你却给了集合中每一个点的坐标,并没有将每一个坐标点(经纬度)信息作为一个整体传入到函数中作为一个参数,而很多时候这个函数本身需要的必要参数也仅有一个,所以这里我们仅需要填写一个参数即可,而其他默认参数可以不选,这里要告诉大家的就是希望大家不要认为你没有当做整体输入的参数数量和所需要必备的参数进行比较,这样就错了:我们来看具体的提示:

line 28: Received too many arguments to function MultiPoint(). Expected at most 2 but got 60.

因为这里我们用到的是一个MultiPoint()  集合传参数进入,所以我们看一下这个函数:

ee.Geometry.MultiPoint(coords, proj)

Constructs an ee.Geometry describing a MultiPoint.

大家注意这里第一个参数coords是必须的 ,而坐标系统默认所以可以忽略,而这个参数我们可以看出给出的是一个列表,而我们错误的代码中,给出的却是一个一个坐标,因此无法识别,所以传参错误。

For convenience, varargs may be used when all arguments are numbers. This allows creating EPSG:4326 MultiPoints given an even number of arguments, e.g. ee.Geometry.MultiPoint(aLng, aLat, bLng, bLat, ...).

Arguments:

coords (List<Geometry>|List<List<Number>>|List<Number>):

A list of points, each in the GeoJSON 'coordinates' format of a Point, or a list of the x,y coordinates in the given projection, or an ee.Geometry describing a point.

proj (Projection, optional):

The projection of this geometry. If unspecified, the default is the projection of the input ee.Geometry, or EPSG:4326 if there are no ee.Geometry inputs.

Returns: Geometry.MultiPoint

代码:

var roi = 
    /* color: #ffc82d */
    /* displayProperties: [
      {
        "type": "rectangle"
      }
    ] */
    ee.Geometry.Polygon(
        [[[30.429507731043472, -22.939125980742634],
          [30.429507731043472, -23.005663942931854],
          [30.49868726595558, -23.005663942931854],
          [30.49868726595558, -22.939125980742634]]], null, false),
    Water = /* color: #00ffff */ee.Geometry.MultiPoint(
        [[30.498054031093798, -23.001119626028643],
         [30.49597801595204, -23.00295675151373],
         [30.495048609757237, -23.00400193440194],
         [30.494179574036412, -23.004831486690524],
         [30.491829958939366, -23.005572154067686],
         [30.492911541994562, -23.00490800940845],
         [30.496323311861506, -23.000760199326542],
         [30.49572268356365, -23.00110498839735],
         [30.497117432251393, -23.002201204940192],
         [30.494249888901543, -23.001889017334314],
         [30.49284415000893, -23.00219516976756],
         [30.497776164761813, -23.0011375500594],
         [30.49017087655273, -23.003677411118833],
         [30.487427761878763, -23.003146048511045],
         [30.488821658204806, -23.003756594382132],
         [30.486557836380527, -23.00357634158988],
         [30.485720604718008, -23.003845595696752],
         [30.485100872107697, -23.003988250935357],
         [30.484578074994538, -23.00343916809125],
         [30.484207617203616, -23.003263911360282],
         [30.483692633072756, -23.002720746390956],
         [30.482761859310532, -23.002844514761126],
         [30.482193230999375, -23.002197652402646],
         [30.481422288748256, -23.002207648980917],
         [30.48099100970214, -23.002345869916788],
         [30.478411993737392, -23.00269279475996],
         [30.478068670983486, -23.002445900818294],
         [30.476711349716105, -23.001615586975927],
         [30.47641704508444, -23.000816223354338],
         [30.474047061603812, -22.999616858706652],
         [30.47264717270953, -22.998216689237932],
         [30.47232530762774, -22.997959911014156],
         [30.472941004704225, -22.998858710760512],
         [30.470952649967007, -22.99762842391999],
         [30.461438991339513, -22.9897118980305],
         [30.461415533709037, -22.988684089744012],
         [30.45989897231293, -22.988114445042466],
         [30.458485029001256, -22.986894621731654],
         [30.459020082452962, -22.987008700785562],
         [30.458129589060018, -22.986193976961903],
         [30.470024202069283, -22.99693553874119],
         [30.469444844922066, -22.99630840049817],
         [30.47431600248194, -23.000420968384386],
         [30.480157673825634, -23.00269973370788],
         [30.49095474438094, -23.003176360812056],
         [30.491265880626667, -23.002909716290933],
         [30.4924782391014, -23.00236654989611],
         [30.496490823787678, -23.002702325743623],
         [30.496877061885822, -23.0008456723613],
         [30.4984220142784, -23.000885175890684],
         [30.466552406093335, -22.992729159141394],
         [30.466294914027905, -22.99245755573528],
         [30.46541514947102, -22.992299531683962],
         [30.4649430806844, -22.991721754672174],
         [30.464621215602612, -22.991346445203266],
         [30.463677076269338, -22.991316817100813],
         [30.463441041876028, -22.991060025754212],
         [30.462555050019546, -22.991356240184906],
         [30.46172892964296, -22.99077352082683],
         [30.456810338211255, -22.985795612304926]]),
    Vegetation = /* color: #27ff0d */ee.Geometry.MultiPoint(
        [[30.46566805943695, -22.957465258265835],
         [30.46721301182953, -22.959045897834788],
         [30.463608122913513, -22.96212809186172],
         [30.465753890125427, -22.962286151200313],
         [30.46317896947113, -22.964894103613553],
         [30.466526366321716, -22.963629648119053],
         [30.467813826648865, -22.96552632692656],
         [30.47167620763031, -22.965447299174087],
         [30.472534514515075, -22.96276032810758],
         [30.47339282139984, -22.964182848852865],
         [30.475366927234802, -22.962681298738495],
         [30.48279468282312, -22.963697713435813],
         [30.484940450035033, -22.965278280160685],
         [30.4857987569198, -22.967649095604436],
         [30.486732011798296, -22.970537087222525],
         [30.48624421648719, -22.973105368832144],
         [30.486029295249185, -22.97644389041066],
         [30.482674885099616, -22.978240798726155],
         [30.444235299704484, -22.97881392820853],
         [30.441660379050187, -22.98118450623289],
         [30.43960044252675, -22.98197468966467],
         [30.43633887636464, -22.98118450623289],
         [30.449213479636125, -22.981342543288978],
         [30.445780252097062, -22.981342543288978],
         [30.43582031071426, -22.985907360869152],
         [30.43629237950088, -22.987467914135465],
         [30.43544967775046, -22.986019605702484],
         [30.442448091688743, -22.984632729723852],
         [30.440431070509543, -22.985185844492815],
         [30.434509700959335, -22.984097477248678],
         [30.446177682254646, -22.972821279686546],
         [30.43836708960328, -22.97542902886829],
         [30.442744454715584, -22.97329541964397],
         [30.45004639006935, -22.93960468471827],
         [30.45007466921913, -22.943418704864758],
         [30.436170097685928, -22.944446229353392],
         [30.471033262074595, -22.999466985808937],
         [30.47013203984559, -22.99968425729666],
         [30.481852880005345, -23.00532771223488],
         [30.45171087375403, -22.94590717204149],
         [30.452397519261844, -22.946895158335792],
         [30.474981942983565, -22.94760647736656],
         [30.443513979487847, -22.96003605807235],
         [30.488874090621376, -22.940584646766816],
         [30.483961681178908, -22.940549164377916],
         [30.46280800027357, -22.965970560159995],
         [30.469202679872133, -22.954179364085913],
         [30.439571710397033, -23.001509910777386],
         [30.433048578072814, -22.997480509878656],
         [30.433220239449767, -22.999218697567272],
         [30.43536600666168, -23.000877855845477],
         [30.43665346698883, -23.002299975279982],
   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

此星光明

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值