Urban Residents 地区の中心
urban_poly_3857 の中心点を求めて、ポリゴンの上にプロットしてみましょう。
この演習はコースの一部です
Pythonで可視化する地理空間データ
演習の手順
- GeoSeries の
centroid属性を使って、urban_poly_3857からdowntown_centerを作成します。 downtown_centerのデータ型を出力します。urban_poly_3857をaxとして、色はlightgreenでプロットします。downtown_centerを、ax = ax、color = blackを指定してプロットします。x 軸の目盛りは回転済みです。プロットを表示するコードは用意してあります。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Create downtown_center from urban_poly_3857
downtown_center = urban_poly_3857.____.____
# Print the type of downtown_center
print(type(downtown_center))
# Plot the urban_poly_3857 as ax and add the center point
ax = ____.plot(color = 'lightgreen')
____.plot(ax = ____, color = 'black')
plt.xticks(rotation = 45)
# Show the plot
plt.show()