困っていること
Pythonでgeopandasを利用して地理空間情報処理を行っています.
Polygon型という型のデータから座標データを取り出したいと思っています.
1558 POLYGON ((139.49724 36.27460, 139.48871 36.272... Name: geometry, dtype: geometry
というデータを
[(139.49724 36.27460, 139.48871 36.272),...]
と変換してリスト化したいです.
そこで下のソースコードを作成したのですが取り出し方が分かりません.
どなたか地理空間情報処理やPythonに詳しい方,教えていただけると幸いです.
ソースコード
import pandas as pd import numpy as np import os import geopandas as gpd from shapely.geometry import Point import matplotlib import matplotlib.pyplot as plt import folium import plotly_express as px from datetime import datetime import geemap from ipygee import* from shapely.ops import cascaded_union from geopy.distance import geodesic from shapely.geometry.polygon import Polygon import shapely # ルートディレクトリ ROOT = './' # GEOJSONファイル読み込み geo = gpd.read_file(f'{ROOT}/gadm36_JPN_shp/gadm36_JPN_2.shp') # 足利市ポリゴン ashikaga = geo[geo['NL_NAME_2'].isin(['足利市'])] pol = ashikaga.geometry print(pol) # 1558 POLYGON ((139.49724 36.27460, 139.48871 36.272... # Name: geometry, dtype: geometry # ポリゴンデータをPolygon型に変換 poly = pol.geometry.iloc[0] print(poly) # POLYGON ((139.4972381591798 36.27460098266607, 139.4887084960938 36.27207565307617, 139.4786376953125 36.26980972290039, 139.4697570800782 36.27577590942388, 139.4637145996094 36.28420639038097, 139.4529418945314 36.28525543212902, 139.4490203857422 36.28792572021496, 139.4403381347657 36.29381561279308, 139.4317626953126 36.29954147338867, 139.4220581054689 36.30975723266613, 139.4266204833986 36.3207244873048, 139.4269256591797 36.32144546508789, 139.4241638183595 36.3332977294923, 139.4117889404298 36.3374862670899, 139.3975830078125 36.34402847290045, 139.385223388672 36.35514450073254, 139.3763732910156 36.36146926879894, 139.3756866455079 36.36195373535168, 139.3706359863281 36.36556243896496, 139.3698577880859 36.3730812072755, 139.3696441650391 36.37512588500982, 139.3695373535156 36.37607574462885, 139.3685913085938 36.3870201110841, 139.374969482422 36.39543151855474, 139.3798370361328 36.4047966003418, 139.3884429931643 36.41651535034185, 139.3951263427737 36.42425155639648, 139.4025268554688 36.43260574340832, 139.4099273681641 36.44254302978521, 139.4151611328126 36.45134735107428, 139.417434692383 36.45193862915039, 139.417434692383 36.45183181762701, 139.4171295166017 36.45092391967785, 139.416259765625 36.44982528686523, 139.4158172607422 36.44888305664074, 139.4154663085938 36.44719314575195, 139.4154205322266 36.44538879394537, 139.4155883789064 36.4441871643067, 139.4160614013672 36.44304275512701, 139.4167633056641 36.44219589233398, 139.4176788330079 36.4415283203125, 139.4188537597656 36.44103240966803, 139.4215393066406 36.44044113159191, 139.4232788085938 36.43986892700207, 139.4263916015625 36.43839645385742, 139.4296264648438 36.43588638305664, 139.4305725097656 36.43528366088879, 139.4326171875 36.43454742431646, 139.4345092773438 36.43422317504883, 139.4359588623048 36.43420028686523, 139.4374084472656 36.43434524536127, 139.4408569335938 36.43506240844738, 139.4420776367189 36.43542861938482, 139.4430541992189 36.43598175048828, 139.4458618164065 36.43804168701183, 139.4468688964845 36.43854904174799, 139.4487762451173 36.43885040283203, 139.4501037597657 36.4388160705567, 139.4513854980471 36.43858337402355, 139.4519500732422 36.43837356567383, 139.453338623047 36.43752288818359, 139.4588623046876 36.43459320068371, 139.4613037109377 36.43269348144543, 139.46240234375 36.43168258666987, 139.4648742675781 36.42980575561523, 139.469940185547 36.42721557617188, 139.4725189208984 36.42535781860363, 139.475036621094 36.42296600341808, 139.4761962890626 36.42074966430675, 139.4768218994142 36.41997528076172, 139.4786071777344 36.4182701110841, 139.4798278808595 36.41738128662115, 139.4809265136719 36.41638946533203, 139.4821624755861 36.4155158996582, 139.4840240478517 36.41385650634766, 139.4844055175782 36.41348648071295, 139.4850158691407 36.41259002685553, 139.4857482910157 36.41095733642589, 139.4860229492188 36.40978240966808, 139.4861602783204 36.40792465209967, 139.4862060546875 36.40413284301763, 139.4864196777344 36.40230178833002, 139.4870605468752 36.40058898925787, 139.4879302978516 36.39920043945312, 139.4901580810548 36.39717102050787, 139.4913635253906 36.39628219604498, 139.4934997558594 36.39424896240234, 139.4947814941406 36.39207839965826, 139.4955596923828 36.39131164550793, 139.4984436035156 36.38964462280279, 139.5004730224611 36.38858413696289, 139.501708984375 36.38761520385737, 139.5042572021486 36.38590240478521, 139.5074920654298 36.38475036621099, 139.5088500976564 36.38389968872076, 139.5104217529297 36.38309097290039, 139.5118560791018 36.38208770751959, 139.5127105712891 36.38126373291016, 139.5133666992188 36.38030624389654, 139.5136260986329 36.37973022460938, 139.513916015625 36.37853240966808, 139.5140380859375 36.37729644775396, 139.513916015625 36.35499954223627, 139.5137634277346 36.35312271118164, 139.5131072998047 36.35006713867193, 139.5124969482423 36.34527206420893, 139.5121765136719 36.34424209594732, 139.5111389160157 36.34268951416027, 139.510955810547 36.34225082397461, 139.5108184814453 36.34128952026367, 139.5108642578125 36.34079742431635, 139.5112152099609 36.33988189697266, 139.5115356445314 36.33950424194347, 139.5147552490236 36.33644104003906, 139.5178833007812 36.33226776123047, 139.5204010009766 36.33036041259766, 139.5215606689453 36.32996368408203, 139.5235748291016 36.32971572875982, 139.5271911621094 36.32967376708996, 139.5307769775392 36.32989120483398, 139.5325164794923 36.33024215698242, 139.5343780517579 36.33108520507812, 139.5355377197267 36.33142852783214, 139.5418243408204 36.33229827880865, 139.5432434082031 36.33236694335949, 139.5482025146484 36.33189773559582, 139.5501861572268 36.33155059814459, 139.5513610839845 36.33101654052746, 139.5522003173828 36.33017349243175, 139.5530395507812 36.32860565185547, 139.5534057617188 36.32684707641607, 139.5534820556642 36.32436752319342, 139.5532989501954 36.32121276855469, 139.5518035888672 36.31328964233398, 139.5513610839845 36.31225204467785, 139.5499572753906 36.31008911132807, 139.5492706298829 36.30923843383789, 139.5470275878906 36.3072242736817, 139.5457458496094 36.3063316345216, 139.5446777343751 36.30530929565435, 139.54345703125 36.30443572998053, 139.5423889160157 36.3034172058106, 139.5402221679688 36.30189514160156, 139.5393829345704 36.30149078369152, 139.5388488769531 36.30134582519531, 139.5359191894532 36.30095672607422, 139.5348205566406 36.30070877075195, 139.5339660644531 36.3003044128418, 139.5317535400392 36.29877471923839, 139.5306854248047 36.29779815673834, 139.5294647216798 36.29692459106451, 139.5272216796875 36.29488754272472, 139.5263366699219 36.2934951782226, 139.5256652832031 36.29184341430675, 139.5254058837892 36.28964614868164, 139.5256347656251 36.28742218017578, 139.5259246826172 36.28646850585938, 139.5266571044922 36.28486251831055, 139.5274658203125 36.2836532592774, 139.5286560058595 36.28258514404308, 139.5305633544923 36.28144073486339, 139.5310363769531 36.2810516357423, 139.5297698974609 36.28137588500971, 139.5294494628907 36.28145599365246, 139.5287933349609 36.28124237060558, 139.5191497802736 36.27812576293957, 139.5077514648438 36.27771377563488, 139.4972381591798 36.27460098266607))
回答2件
あなたの回答
tips
プレビュー