geopanda sjoin ValueError:需要至少一个数组才能连接

时间:2017-08-17 06:39:39

标签: geopandas

我需要在Canada Province shapefile中找到一个lat lon数组。我对geopandas来说很新鲜

latlon = np.array([[  41.68254852, -140.93778992],
   [  51.04940796, -140.93778992],
   [  60.4166674 , -140.93778992],
   [  69.7831192 , -140.93778992],
   [  79.14993286, -140.93778992],
   [  46.99043655, -140.62530518],
   [  56.35729599, -140.62530518],
   [  65.72415161, -140.62530518],
   [  75.09098816, -140.62530518],
   [  42.93146133, -140.31280518],
   [  52.29832458, -140.31280518],
   [  61.66518021, -140.31280518]])

geom = [Point(lat, lon) for lat, lon in latlon]

crs = None
geo_df = GeoDataFrame(latlon, crs=crs, geometry=geom)

从这里读取加拿大省的shapefile: http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm

ca_sh = gpd.read_file("gpr_000b11a_e.dbf")
d = gpd.sjoin(geo_df, ca_sh, how = 'left',  op='within')

但我收到了以下警告和错误:

Warning: CRS does not match!
---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call last)

in()      ----> 1 d = gpd.sjoin(geo_df,ca_sh,how =' left',op =' in')

   /usr/local/lib/python3.4/site-packages/geopandas/tools/sjoin.py in 
   sjoin(left_df, right_df, how, op, lsuffix, rsuffix)
    55     idxmatch = idxmatch[idxmatch.apply(len) > 0]
    56 
   ---> 57     r_idx = np.concatenate(idxmatch.values)
      58     l_idx = np.concatenate([[i] * len(v) for i, v in 
    idxmatch.iteritems()])
    59 

   ValueError: need at least one array to concatenate

有什么建议吗?

0 个答案:

没有答案