始める無料で始める

Urban Residents 地区の中心

urban_poly_3857 の中心点を求めて、ポリゴンの上にプロットしてみましょう。

この演習はコースの一部です

Pythonで可視化する地理空間データ

コースを見る

演習の手順

  • GeoSeries の centroid 属性を使って、urban_poly_3857 から downtown_center を作成します。
  • downtown_center のデータ型を出力します。
  • urban_poly_3857ax として、色は lightgreen でプロットします。
  • downtown_center を、ax = axcolor = 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()
コードを編集して実行