我正在使用克林特·哈里斯的解决方案
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) 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"]但我只是继续得到类型错误.
我有一个使用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