0
我有一個包含多邊形數據的geojson文件。下面是它的例子。Python + Mysql:將geojson多邊形值插入到mysql sptial列中
[[[127.00733253963132, 37.583203339216226],
[127.00884131783923, 37.58045263873488],
[127.00861398800201, 37.57670881432089],
[127.00783306341832, 37.57663511179821],
[126.99967765278153, 37.57589728327857],
[126.9971834726848, 37.57693224535312],
[126.99675796489285, 37.578422160319896],
[126.99660663904614, 37.579345394336194],
[126.99641172469617, 37.580645880422686],
[126.99649978451932, 37.581022567729896],
[126.99823026308687, 37.581266540341],
[127.00180462191403, 37.58253031283794],
[127.00172112834049, 37.583133635452405],
[127.00272082947205, 37.583723680505784],
[127.00580459526145, 37.584756278282704],
[127.00618219538146, 37.58396129485959],
[127.00733253963132, 37.583203339216226]]]
我在MySQL中有空間表。我試圖使用row sql將這個多邊形數據插入多邊形列,但是,保持失敗。後來,我發現插入到mysql db中的多邊形數據看起來與我所擁有的有點不同。這是我從互聯網教程中看到的數據。
((126.97688884274817 37.575650779448786,
126.9770344988775 37.569194530054546,
126.97597472821249 37.569336299425764,
126.97537470991254 37.569315567021562,
126.97433193562325 37.569261800517531,
126.96904837001854 37.568194417708312,
126.96854493603384 37.568427679612753,
126.9666499598212 37.569491655206569,
126.96628175024485 37.569700734798701,
126.9660973270804 37.569856509723699,
126.96572852922577 37.570183936115114,
126.96592699822128 37.570318805686199,
126.96601094018429 37.57154839557748,
126.96365922052196 37.575174660660359,
126.96308600434513 37.576485920015529,
126.96284099051198 37.576661586092726,
126.96281041047263 37.579448809656768,
126.96742431584332 37.579601537124489,
126.96742176302651 37.579263521441646,
126.9674300601846 37.579192577998612,
126.96745709009561 37.578975250585444,
126.96806604699626 37.578246780467865,
126.96895511695477 37.577935262340283,
126.96921284296906 37.577935299309395,
126.96941453886579 37.578121124142172,
126.96966442669471 37.578531136682209,
126.96966721914872 37.578736205134923,
126.96966877353309 37.578992879009881,
126.96966949910363 37.579112526749597,
126.96990457361626 37.579301753628719,
126.97135197544759 37.579513277939817,
126.97381925784454 37.579372140302631,
126.97391736338342 37.578487073041011,
126.97393961998088 37.578240429978088,
126.97433153835757 37.575749906299862,
126.97580378997804 37.575649468824203,
126.97688884274817 37.575650779448786))'
所以我的想法是把多邊形數據轉換爲字符串,並使用正則表達式替換括號。但是這種方法會花費很多時間。所以,我想知道是否有任何解決方案將這些數據插入到mysql多邊形字段中。
我不知道是否MySQL不支持插入geojson多邊形值到mysql表嗎?或者只是geoalchemy不支持與mysql的多邊形 – camila