how to get Alighnment value for all buildings #411
-
Hello, I have tried to get Alignment value of 621,420 buildings as below. But, I have got the Alignment value of only 2,727 buildings. Sincerely, queen = libpysal.weights.Queen.from_dataframe(buildings,silence_warnings=True,ids='uID')
sw = mm.sw_high(k=3, gdf=buildings, ids='uID', contiguity='queen')
buildings['alignment'] = mm.Alignment(buildings, sw, 'uID', 'orientation').series |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hello! Since you have created One option is to create tessellation (see the docs) and use the Queen weights matrix derived from that but it may be tricky for such a large number of buildings. Other option is to create KNN or DistanceBand weights instead of Queen. Then you don't need to do the higher order. W = libpysal.weights.KNN.from_dataframe(df=buildings, ids=buildings['uID'], k=10)
buildings['alignment'] = mm.Alignment(buildings, W, 'uID', 'orientation').series You can obviously change the K to your liking. |
Beta Was this translation helpful? Give feedback.
-
Your information is working well. Thank you so much. Sincerely, |
Beta Was this translation helpful? Give feedback.
Hello! Since you have created
Queen
weights based on buildings, the resulting weights matrix will be composed mostly of islands. With Queen contiguity, two buildings are considered neighbours if they share at least one vertex (point). You will need to find another way of defining spatial weights matrix to get a proper result ofAlignment
.One option is to create tessellation (see the docs) and use the Queen weights matrix derived from that but it may be tricky for such a large number of buildings. Other option is to create KNN or DistanceBand weights instead of Queen. Then you don't need to do the higher order.