角度异步管道语法

时间:2020-05-05 21:27:07

标签: angular

有没有一种方法可以分解

library(ggplot2)
library(raster)
library(sf)
library(dplyr)

pac_mod <- map_data("world2")
coordinates(pac_mod) <- ~long+lat
proj4string(pac_mod) <- CRS("+init=epsg:4326")
pac_mod2 <- spTransform(pac_mod, CRS("+init=epsg:4326"))
pac_rast <- raster(pac_mod2, resolution=0.5)
values(pac_rast) <- 1

all_diet_density_samples <- data.frame( lat_min = c(35, 35), lat_max = c(65, 65),
  lon_min = c(140, 180), lon_max = c(180, 235),  sample_replicates = c(38, 278), id= c(1,2))
ids <- all_diet_density_samples$id

for (idnum in ids){
  poly1 = all_diet_density_samples[idnum,]
  pol = st_sfc(st_polygon(list(cbind(c(poly1$lon_min, poly1$lon_min, poly1$lon_max, poly1$lon_max, poly1$lon_min), c(poly1$lat_min, poly1$lat_max, poly1$lat_max, poly1$lat_min, poly1$lat_min)))))
  pol_sf = st_as_sf(pol)
  x <- rasterize(pol_sf, pac_rast)
  df1 <- raster::rasterToPoints(x, fun=NULL, spatial=FALSE) #ERROR HERE
}

df2 <- as.data.frame(df1)
#Error in x$.self$finalize() : attempt to apply non-function
#Error in x$.self$finalize() : attempt to apply non-function
#Error in x$.self$finalize() : attempt to apply non-function

(places$ | async) 

我的确在我的可观察对象中存储了一组位置,并且我需要检查可观察对象是否为未定义或为null或不为空。

最诚挚的问候,

1 个答案:

答案 0 :(得分:5)

您可以使用* ngIf进行以下操作

我将其包装在{}中,以确保我们仍然能够获取数据并且不受ngIf的影响

const formData = {
    page: aPage,
    transactions: []
};

($.each loop) {
    formData.transactions.push({
        "code": code,
        "agency_number": agency_number,
        "agency_code": agency_code
    })
}
相关问题