小编com*_*man的帖子

模块“shapely”没有属性“geometry”错误

我正在使用克林特·哈里斯的解决方案

import fiona
import shapely

with fiona.open("./areas_shp.shp") as fiona_collection:
    shapefile_record = next(iter(fiona_collection))
    shape = shapely.geometry.asShape( shapefile_record['geometry'] )
    point = shapely.geometry.Point(coords[0])
    for point in coords:
        if (shape.contains(point)):
            print("yay")
Run Code Online (Sandbox Code Playgroud)

在这里,我只是用 shapefile 测试一个坐标,但看起来代码可能已经过时了。我已经更改shapefile_record = fiona_collection.next()shapefile_record = next(iter(fiona_collection)),但这个错误我似乎无法解决:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-18ca8979d01f> in <module>
     38 with fiona.open("./areas_shp.shp") as fiona_collection:
     39     shapefile_record = next(iter(fiona_collection))
---> 40     shape = shapely.geometry.asShape( shapefile_record['geometry'] )
     41     point = shapely.geometry.Point(coords[0])
     42     for point in coords:

AttributeError: module 'shapely' has no attribute …
Run Code Online (Sandbox Code Playgroud)

python python-import attributeerror shapely

2
推荐指数
1
解决办法
9445
查看次数

Haskell不能压缩字符串然后与列表理解相结合

combineIndex :: String -> String -> [Char]
combineIndex pair1 pair2 = [a ++ b | (a, b) <- zip pair1 pair2]
Run Code Online (Sandbox Code Playgroud)

combineIndex "AB" "CD"应该返回,["AC", "BD"]但我只是继续得到类型错误.

haskell

0
推荐指数
2
解决办法
190
查看次数

使用公共数据库的Firebase聊天应用setValue失败错误?

我有一个使用Firebase的聊天应用程序,它继续使用

x处的setValue失败:DatabaseError:权限被拒绝

每次输入消息时都会出错.

我已将数据库设置为公开:

service cloud.firestore {
  match /databases/{database}/documents {
    match /{allPaths=**} {
      allow read, write: if request.auth.uid != null;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

这是我的聊天参考内容吗?

private void displayChat() {

    ListView listOfMessage = findViewById(R.id.list_of_message);

    Query query = FirebaseDatabase.getInstance().getReference();
    FirebaseListOptions<Chat> options = new FirebaseListOptions.Builder<Chat>()
            .setLayout(R.layout.list_item)
            .setQuery(query, Chat.class)
            .build();

    adapter = new FirebaseListAdapter<Chat>(options) {
        @Override
        protected void populateView(View v, Chat model, int position) {
            //Get reference to the views of list_item.xml
            TextView messageText, messageUser, messageTime;
            messageText = v.findViewById(R.id.message_text);
            messageUser = v.findViewById(R.id.message_user);
            messageTime = v.findViewById(R.id.message_time); …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-realtime-database firebase-security-rules

0
推荐指数
1
解决办法
1141
查看次数