Cartopy错误地填充了Shapely多边形的外部

时间:2019-07-27 05:32:05

标签: python matplotlib shapely cartopy

下面以“ mywkt”形式列出的Shapely多边形在Cartopy中绘制错误;尽管是有效的多边形,但它填充的是外部而不是内部。在GIS软件中,它可以正确绘制。在许多经过测试的预测中都出现了此问题,包括以下预测。如预期的那样,我如何纠正它以填充内部?

Incorrectly filled polygon

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from cartopy.feature import ShapelyFeature
import shapely
import shapely.wkt as wkt

# Main plot setup, issue occurs regardless of projection used.
fig = plt.figure(figsize=[5, 5])
crs = ccrs.NearsidePerspective(central_longitude=-100, central_latitude=65, satellite_height=6200000)
ax = fig.add_subplot(1, 1, 1, projection=crs)

# Build and plot the polygon, valid
mywkt = "POLYGON ((-66.64127406774401 63.2679483443407, -66.48652697503979 63.1988718046901, -66.4817891045834 63.1004449790526, -66.379143168922 63.0115892305586, -66.1973803825985 62.9848443902565, -66.0559008189676 62.9537393506905, -65.97118398525259 62.9850694644843, -65.850509788396 62.9360773051236, -65.69642646101229 62.9192773820456, -65.6182098640938 62.8587266887857, -65.473922680887 62.8270608886491, -65.3890303678572 62.8197557451316, -65.31233201541011 62.7191354685271, -65.25006848777041 62.6268846390149, -65.12107061571631 62.5688402034127, -64.96662902810711 62.6103134144326, -64.52292746513029 60.3009837190234, -64.678588195289 60.3290634023542, -64.7726142595404 60.3596734442741, -64.8751520004644 60.2840499669325, -64.9515074450125 60.2243558221635, -65.0198404413832 60.1228099129471, -65.095375384966 60.0444670754952, -65.1483835964257 59.944148956709, -65.2920146315699 59.8405379513654, -65.453168021487 59.7919610620534, -65.47048148623151 59.6270483926692, -65.4267596751189 59.4696754279787, -65.49367684990671 59.3679086749455, -65.6342827626394 59.2531493848363, -65.6786190418353 59.1322782877129, -65.7005535515051 59.0241583127559, -65.8285595801605 58.9623716488326, -65.9420170341587 58.8275171137239, -66.0506960726655 58.7706855047323, -66.149750409254 58.7371845390353, -66.256134042452 58.7978006318937, -66.3347385322574 58.8311493351738, -66.45372349384409 58.800538690708, -66.49451082791229 58.7198367831411, -66.5676193169778 58.6466901412371, -66.6218795870732 58.5770604645689, -66.7814218532359 58.4949434629705, -66.88831340553919 58.4688908893032, -67.0380290656889 58.4144607966286, -67.1342663928796 58.3776258669403, -67.2353212911446 58.3398129542046, -67.33057432114791 58.3205410987927, -67.47232732814371 58.2854808444655, -67.5925217519772 58.1990972702229, -67.6903910465095 58.2706693512096, -67.7234163041191 58.3415155704872, -67.81171229568589 58.4379109661182, -67.9250695391279 58.4466397966894, -68.0271575596735 58.5408090366078, -68.1713938511453 58.5239214763951, -68.3308705567307 58.6276111553306, -68.37026229227089 58.7457949055105, -68.4149256971631 58.8196035851374, -68.5609516754794 58.8743733607421, -68.67261845427809 58.9022758569453, -68.8273157758023 58.9054559910013, -68.9202407883817 58.878506525256, -69.07570399414401 58.9052582049023, -69.2647591176391 58.8920751275651, -69.3652429760824 58.869404278185, -69.4899762315179 58.7899739103677, -69.6132537210823 58.7566270839728, -69.72686138794261 58.6796452157541, -69.842988449757 58.6732594077955, -69.8395047468465 58.8392757000136, -69.6917509226669 58.8574368306453, -69.5327113793267 58.8471842391614, -69.46260960175159 58.9405896192156, -69.4404513848235 59.0222669548561, -69.3474281644782 59.1017357623955, -69.3028958231836 59.2196576443848, -69.4281941172646 59.3568617410766, -69.5182813676909 59.3316304588787, -69.6520868841024 59.4400386197865, -69.65458094065789 59.5726276160716, -69.5578593654174 59.6813767639266, -69.5928206493534 59.798270974426, -69.70748724543991 59.9355825212164, -69.737201347664 60.0551376260007, -69.616491617694 60.15187842425, -69.6398101732009 60.2406957887797, -69.7022901640597 60.3436465118771, -69.7505086681404 60.4372696447783, -69.7298120033212 60.5385315013278, -69.6576941750461 60.635072446836, -69.58624424267749 60.736179235983, -69.5121017580896 60.7615279039897, -69.4052339964517 60.8147459704502, -69.4564300739886 60.9777373363091, -69.5537354306456 61.0800360797014, -69.67305901935821 60.9755718380699, -69.74723982315921 60.8975333096147, -69.84465196801381 60.847667578496, -69.99184594083739 60.836894867704, -70.1006539538168 60.9605688827478, -70.1916436091651 61.0764643475517, -70.3686452388866 61.0577015965515, -70.5324451896937 61.0420612242462, -70.66397847542621 61.043868155591, -70.8089575088819 61.0657154903776, -70.9218584021435 61.0859015570113, -71.1063331804318 61.1279448078067, -71.2168983247977 61.13527297217, -71.39589387470249 61.1518817695281, -71.5711726138249 61.2143165838433, -71.67622634576909 61.2783583103878, -71.7435230974129 61.4217185605632, -71.7156399546202 61.5457269912077, -71.745408594431 61.6792414618241, -71.84647644023541 61.7009009129468, -72.0093717180302 61.7027090727656, -72.1138114630285 61.768727955231, -72.22976980123519 61.8808668843993, -72.3646309526563 61.8955630162203, -72.4438507145388 61.911258570027, -72.5975236614877 62.0116845813784, -72.65332864939759 62.1237777818192, -72.751459880469 62.1445197697716, -72.903374167184 62.1482523240856, -73.0173601185745 62.183594747, -73.0963776310228 62.2126581636434, -73.1944329188441 62.2876760141368, -73.28965616150251 62.3318380343978, -73.42240349692371 62.3685538308947, -73.56754929616309 62.4005830290836, -73.73324404207889 62.4774707715589, -73.8655810825009 62.4501908903973, -73.9502095218519 62.3978956398719, -74.1022008669764 62.3374917528422, -74.2265877898945 62.3260057582592, -74.29980367420011 62.2777694125284, -74.42241445316439 62.2427918022999, -74.511257930409 62.2428908122612, -74.62888748866651 62.2598035705784, -74.7267889348615 62.2046664902664, -74.8163182386957 62.2027195416736, -74.9442040738588 62.2578310929307, -75.03847038480041 62.2674159350974, -75.1831341600134 62.2847549100112, -75.3442277576048 62.3174456539938, -75.5153162981086 62.2713303206378, -75.6416712506276 62.2500114445726, -75.8110834269585 62.3090148398631, -75.93677284069391 62.3500193062461, -76.10534289276021 62.3775115497183, -76.2125175210667 62.3952569876199, -76.3685719204577 62.4278825055732, -76.48766814167131 62.4468325304969, -76.6064638391348 62.4572315361066, -76.7061760154107 62.4969147689015, -76.8642309126265 62.5259033871317, -76.9682144998992 62.5369445167761, -77.0828220366076 62.5335578426204, -77.25888406544721 62.5470384120931, -77.3441128508273 62.5540247837169, -77.47945886273619 62.5781576537528, -77.5586235987 62.541063735503, -77.6682454270847 62.5150911061697, -77.81984122339369 62.4436013059556, -77.9415896901121 62.405578487857, -78.0408993361354 62.3642756102313, -78.1703715205291 62.2442638953625, -78.1610545162529 62.1223761632295, -78.14890860634701 62.0181106241061, -78.07967792379711 61.8977229845282, -78.05323718115091 61.8092322177927, -77.99494302809821 61.7128768347981, -77.9110333772885 61.6805678431315, -77.7752377331347 61.6529479256063, -77.68604436295691 61.5902604530575, -77.7464299002197 61.4447707602625, -77.7713878361796 61.2809443639912, -81.1208442837367 61.6343186366958, -85.9087502533215 61.4403863269675, -87.7835499471722 60.796390048462, -88.8519416879585 60.1195386784673, -89.8256929935368 59.1331428536598, -90.28917688060849 58.6636404579409, -90.67532027770859 57.2245717427917, -90.79091050271749 57.2407170808287, -90.9217394124439 57.2601567677207, -91.01806055105349 57.2568265287214, -91.1159991221617 57.249242901139, -91.2779177991671 57.2192479316468, -91.4525318115937 57.1780529852571, -91.5799427372674 57.1525440913368, -91.7268544003103 57.1197453081995, -91.8391362308523 57.0876751359988, -91.9249059071818 57.0659466097483, -92.0507985856861 57.049360294542, -92.13512631242941 57.04835702076, -92.25875306989821 57.0716991447998, -92.3518469706611 57.0584964685373, -92.4861090971571 57.0399379517752, -92.4857200468426 57.1999797751466, -92.4425224316648 57.3074512552713, -92.4497627547472 57.3881817001254, -92.5112404799642 57.5276470395793, -92.59639221412939 57.6298542247927, -92.65817509550421 57.7008037788714, -92.7342173331634 57.8130054717252, -92.77113601131779 57.8940105722302, -92.8201015390547 58.0647373586422, -92.874468654005 58.1538677627871, -92.97732059736759 58.2803554957096, -93.0559415825379 58.4189625249007, -93.1315794841059 58.5865955877163, -93.1591292778938 58.7012920988514, -93.2823669526727 58.7624760209517, -93.3608810776995 58.7592754812785, -93.4738800798018 58.7538242685752, -93.62835249617071 58.7846698986969, -93.71609056722581 58.7966098944312, -93.89549583566421 58.7730426754791, -94.0091280782981 58.7725887156967, -94.14890625412031 58.7425517739453, -94.24527317181941 58.7465228653381, -94.4130130857852 58.709989490023, -94.496623682337 58.803209247309, -94.605174776095 58.8845767350284, -94.668979477321 58.9607562380101, -94.7854498526285 59.019945075305, -94.8760642082965 59.0353373705233, -95.0288505271301 59.0589655922883, -94.9498328680923 59.0871371413661, -94.78415853948491 59.1531909238221, -94.75664135421501 59.3040141602254, -94.7311897255254 59.4165820732042, -94.8055229949902 59.5517024667955, -94.8188439536855 59.6357478828585, -94.7946054061145 59.7556094972806, -94.82640478525261 59.8905277160813, -94.7793129086637 60.072941390333, -94.73645838124919 60.2213475638391, -94.6762507910411 60.3269215005269, -94.6734126925416 60.423391387003, -94.6149944348452 60.513830240873, -94.5353359405012 60.6169071910141, -94.4341091386257 60.7222386291095, -94.37695735929471 60.8089810418417, -94.2591747562099 60.8856145118004, -94.2088665424568 60.964075215299, -94.117840250527 61.0820447451689, -94.04385803502031 61.2004110028656, -93.9886975318655 61.2938901704951, -93.9522824524732 61.3760549440805, -93.9426923501717 61.491502950301, -93.804676572166 61.5421430732443, -93.69641544681529 61.598573904762, -93.5824475313284 61.6549169984208, -93.4946942149659 61.6810438713776, -93.4563641740674 61.8020346349905, -93.4010892366789 61.9084074808207, -93.32190375965079 61.9974730456446, -93.1770367754268 62.0318396699648, -93.113697555198 62.1166098847385, -93.0654263904156 62.1899207446467, -92.9374432540029 62.2031119824321, -92.7967037820538 62.2611297306526, -92.68520018074371 62.3574088907078, -92.6355176019556 62.4841178883299, -92.5609097442893 62.5284408665528, -92.3973812421505 62.5429100292745, -92.29000511624299 62.5757202526876, -92.19575159456041 62.695326287878, -92.0960278026409 62.834230877553, -92.00510827732511 62.8504166473105, -91.8950160639401 62.8354172685921, -91.723606384527 62.8273682724279, -91.6037180224687 62.8120141273502, -91.51237887258679 62.8096223192147, -91.3764153861611 62.8267961003598, -91.195743643854 62.8759637552232, -91.0767021706686 62.9177041853999, -90.945301069089 62.9480195986257, -90.8332252075772 62.9270273293478, -90.7121848562461 63.0189462910386, -90.6908760112189 63.1564279904595, -90.75826653966899 63.2864176159803, -90.83001343447241 63.3706194286438, -90.8963892209857 63.4225221952432, -91.04234724652819 63.4645029278679, -91.0056193874247 63.5928255403664, -90.84331157107211 63.5712992167855, -90.734394298558 63.5932146644253, -90.57693117953031 63.6349169525554, -90.4958383024956 63.6178995949904, -90.3111839970437 63.6364504873002, -90.1911506903521 63.6513583348194, -90.0785332049434 63.7674586633867, -90.09151085913879 63.8706767468345, -89.987567986873 63.956850772745, -89.8510933464807 64.0146358231847, -89.6954002542183 64.07326773821561, -89.6150550465531 64.034685895238, -89.476774932617 64.0453088761038, -89.3606832879034 64.02033502574091, -89.2708623726004 63.986059977586, -89.12059375799549 63.9970920969228, -89.00106399340849 64.0190990964462, -88.819049435583 63.9913967794379, -88.66757537690209 64.0033367967558, -88.5629534490424 64.0129498434605, -88.4285540041639 64.0731839294948, -88.3423570797154 64.0983151648131, -88.1679795916847 64.1600140962736, -88.03858503766931 64.235651929493, -87.8977998100131 64.3457898877932, -87.8045304874919 64.486819262499, -87.67589122909681 64.52863598846019, -87.5598252258534 64.5852384789727, -87.4955704786946 64.6759901377348, -87.403468411438 64.72561935974581, -87.30076911360371 64.7830381954564, -87.2086212942372 64.8866224981298, -87.13297583926349 64.9438811151214, -87.04295660816079 65.01542958800511, -86.9738190351204 65.0813780841314, -87.0019258024338 65.214266882011, -87.1682314416277 65.2549620607506, -87.2687563954912 65.2654753576017, -87.3695407435104 65.2699766928702, -87.5550724563287 65.2932921070451, -87.672191344455 65.29336076218949, -87.8180730562265 65.28059677162381, -87.98862825109281 65.2838468774315, -88.10628882606839 65.2803831223832, -88.21958538595671 65.2826414135705, -88.3569145495667 65.28509043657439, -88.481838319183 65.29619119576709, -88.5829431100365 65.3128995606663, -88.7499735227598 65.3185834441707, -88.821048993616 65.3223828774679, -88.9447825770542 65.3325909965773, -89.03952443690309 65.32480137568299, -89.12854429728149 65.4086865640338, -89.2718930900939 65.47440615841749, -89.3944288907806 65.5483960190611, -89.47274469730991 65.61487855869861, -89.5859955023904 65.65442933124871, -89.6893509905557 65.7181347698038, -89.8548555487445 65.76428496358029, -89.892712677548 65.8680752478745, -89.8472491674151 65.9957913234109, -89.7289553357201 65.9677914549118, -89.58537003200129 65.908060935264, -89.4675644692248 65.8565320132419, -89.33667450902141 65.8462018255539, -89.1824996027743 65.7857999206299, -89.0757032607967 65.7328366707758, -88.9438901303252 65.6937665516851, -88.7899365049656 65.6880445198388, -88.6762889810516 65.6670560636864, -88.57616072353849 65.5965070586539, -88.4880335311225 65.56534098929529, -88.361385490448 65.50024700199759, -88.2690468664197 65.46194744811631, -88.1663932793262 65.3914518484241, -88.07439798857619 65.3724699218495, -87.9584234895524 65.33616164144669, -87.8748434303799 65.3235044831454, -87.7509648942145 65.3238249295769, -87.6514622896529 65.3308592395623, -87.5082279661476 65.3211317739123, -87.4191700041923 65.3224364078141, -87.3157687765078 65.3291045084663, -87.1970172123744 65.36031637310219, -87.0824203887553 65.391353511131, -86.19775771305351 64.85291030109521, -86.2442882170275 64.7571059717632, -86.32390094037601 64.66191400482749, -86.3809077265102 64.4934798466177, -86.35802712735 64.413348313374, -86.3106332449282 64.2786666072782, -86.22036216947841 64.187564008772, -86.2779869616289 64.0708571495379, -86.3801827380429 64.05316457378611, -86.47285701873631 64.0198469978407, -86.6226068279427 63.9899779037573, -86.724581347751 63.9622259702524, -86.8859964979399 63.916262666389, -86.9900538332177 63.8612318328829, -87.10030622305371 63.7731084958605, -87.1830012486087 63.7357053790001, -87.173403404943 63.5933752024037, -87.0755182139943 63.5522069946571, -86.9497552186285 63.5508222707313, -86.8146919967382 63.5675344721382, -86.71865315352009 63.6085844397202, -86.59764329460231 63.6556501865069, -86.5092567233191 63.6640196407939, -86.3792594076954 63.6473265355912, -86.2353155541694 63.6404715360327, -86.1552068852894 63.6621123217263, -85.9680806546985 63.6859389384313, -85.79514510006619 63.7071448542517, -85.6993351253158 63.7117873507057, -85.6090106328344 63.5890723529068, -85.63833798161259 63.4528800204966, -85.645616358608 63.2824965547723, -85.6180055296314 63.1828566588078, -85.509271323113 63.1111022070013, -85.3826309500583 63.1142798589284, -85.2088561543879 63.1131240196579, -85.05288839028699 63.1557685364888, -84.9375547940184 63.1815177526422, -84.80197278111891 63.2255660770129, -84.7200406927237 63.2648765408198, -84.6114133391543 63.2991477911377, -84.46032077738199 63.3875457892069, -84.42369971007351 63.4929153675502, -84.3627942522529 63.5631820996742, -84.2592480835322 63.6143906076405, -84.1496136358606 63.6134407571852, -84.0352337022735 63.6136810911095, -83.9035960978815 63.6852906027792, -83.7422038462304 63.7682183252156, -83.6065913472128 63.8946145224424, -83.584580587624 64.0302842417244, -83.49345508968059 64.1090348641677, -83.3827448918632 64.1013444420924, -83.1991129159284 64.1116136224708, -83.07296084596631 64.1778520384409, -83.0066231907077 64.0764802712476, -82.94601520883479 63.9640840289548, -82.7939841901181 63.9521097051988, -82.63841313855541 63.9574464782724, -82.5287557986411 63.9509996477156, -82.4869618965743 63.7920373903133, -82.3810886897912 63.6545404410886, -82.26029243334899 63.6605257089943, -82.1756061226244 63.6781000274944, -82.01801326829749 63.651164459872, -81.94321464463999 63.6374239242748, -81.80551926450239 63.6250948323607, -81.6371918333364 63.5614771325637, -81.5207443331844 63.5585512674271, -81.435592609811 63.5258631305791, -81.31211079517701 63.5023188263528, -81.1656187099354 63.4575228434045, -81.0769574713101 63.445498922937, -80.9414593750501 63.48022030912, -80.8146130266698 63.550197129494, -80.6725231372329 63.6020388779919, -80.5647197569111 63.6408458032913, -80.4219737436933 63.7144236988946, -80.4587932625989 63.8407779229629, -80.55911225372751 63.9453616638098, -80.6660459140877 63.9920268507587, -80.71445474596069 64.033819580696, -80.3046263074668 64.09006107806491, -79.0904559802441 64.2550682373605, -79.09042986435421 64.2550718099133, -77.9650089573083 64.4100325023033, -77.8272233003151 64.3721120512303, -77.6572174185489 64.3663442384959, -77.559309350646 64.3563802538457, -77.4368040945332 64.3257787581832, -77.2720472210024 64.2663305222359, -77.1466580675157 64.2855947513967, -76.9916744612073 64.2493932816747, -76.87635611024621 64.24878293698301, -76.70648755675521 64.2424047714631, -76.6052073099693 64.2889974937394, -76.4764535822669 64.27468475549711, -76.354238259488 64.2964437966439, -76.2682702053057 64.317554338462, -76.14462056818461 64.3744238565758, -76.0178810062034 64.3816412703284, -75.91278605023589 64.3963583797355, -75.7954459270877 64.4687918628542, -75.6769690338937 64.5719794368016, -75.50846613600331 64.54076759105151, -75.4066975852252 64.5199240885259, -75.26134990617309 64.47008125864321, -75.0765277296709 64.4542960505224, -74.94823938673829 64.4170035736561, -74.7806367614773 64.40159220471649, -74.6101197140535 64.4119147850394, -74.5589798963051 64.5428886124196, -74.4577606865064 64.6090049553145, -74.3456237853093 64.5845451205609, -74.213337660005 64.6295814464267, -74.0764433536777 64.5839271541149, -73.95660072664219 64.4317054692321, -73.8716550343523 64.5373344480264, -73.72642944636181 64.5669365082134, -73.6222652536385 64.4982948456307, -73.51404985072 64.42818834031971, -73.4140741991649 64.3656654517992, -73.2567178440532 64.2992439464511, -73.17885220036879 64.27727129293589, -73.0262184425271 64.2150154365133, -72.9183387403406 64.1730079913258, -72.89667121780241 64.0405388054216, -72.7271002005138 63.988319419006, -72.60951589254429 63.8962059231649, -72.4569584295878 63.8165321574332, -72.3577304779791 63.8243980678166, -72.210933226687 63.8205108975599, -72.1250872168016 63.7320747691354, -71.9750016879774 63.6924095506603, -71.8269303419616 63.7619553070918, -71.67220613160769 63.6913147447797, -71.51773368466171 63.5926056372404, -71.57384024313259 63.4262543043927, -71.6588241080461 63.417434720536, -71.7607070705748 63.3189354095415, -71.6622038781064 63.1676788411057, -71.558505089938 63.1224060151256, -71.4669980851935 63.0994415406946, -71.3256787294896 63.0382804991458, -71.1630733697401 63.0500068870083, -70.82220713335251 63.1167564776294, -70.92711897566021 63.0537643732273, -70.8385797831304 62.9195671310183, -70.7098413133258 62.8894119518002, -70.5622811212766 62.8754272763478, -70.4596046797122 62.8648834565064, -70.33521496080169 62.7985802021147, -70.171114228139 62.7537231812798, -70.0178777689438 62.7597580369039, -69.83246051104371 62.7897911583353, -69.6793842642724 62.7753449040441, -69.52267640938869 62.6744728622328, -69.41952693072319 62.583488513784, -69.27991656569679 62.5175133248801, -69.15217753766311 62.4323425763489, -69.08314674022979 62.4139709953652, -68.9529586846955 62.3789711493991, -68.7664275265091 62.3391762306986, -68.6182493455308 62.2785416181013, -68.50950753254649 62.2540474481313, -68.38235598124341 62.2433777438878, -68.3025677345132 62.2349472643049, -68.15387839597111 62.2275353119052, -68.04071152911369 62.2018738444024, -67.9512263199386 62.2076073381082, -67.7808847464339 62.1904335740502, -67.667031235503 62.1683731808777, -67.5475243460717 62.1769142932601, -67.4579933542098 62.1444474058232, -67.32158734378081 62.1284294945256, -67.2217414050418 62.0822869144096, -67.0966879360993 62.047626576905, -67.00144470690761 62.0415908840121, -66.8809755518802 62.0379386886197, -66.7458287362071 62.010521850603, -66.56848938137981 61.9408073255976, -66.38661301427911 61.8848849311947, -66.2605215757101 61.8666706344423, -66.1703828831634 61.8680953889911, -66.05410316772689 61.8776442043167, -66.00581322420081 61.9763169972317, -66.0284912942377 62.1202253086511, -66.0977332048235 62.22617411964, -66.15206509962459 62.3074199749519, -66.2784021682254 62.3385812068573, -66.39642556209 62.3532548951973, -66.49938548075529 62.4683787713633, -66.6196345500943 62.606103143845, -66.72430870248451 62.6434864261577, -66.8661701200549 62.6626958686195, -66.9795012193058 62.7005728337693, -67.11189343043741 62.8094941613265, -67.2228401454563 62.860798026208, -67.2971047148107 62.9185220279693, -67.40728086282149 62.9699250745826, -67.4872827372085 63.0039674330507, -67.6298914518289 63.0330010920268, -67.7365657036442 63.0789834534237, -67.8876354280325 63.1482202090954, -67.9837276999733 63.1604730142183, -68.1048443992495 63.1794435023158, -68.1727079036468 63.2291223048505, -68.2685407877272 63.3055345101096, -68.3723692770204 63.3671151690299, -68.49981075536201 63.4394761622952, -68.6105057015768 63.4779244946198, -68.7273270597959 63.5467111180237, -68.7948930207962 63.6070787039191, -68.6855256420946 63.7386590718588, -68.49940644894841 63.7373620803958, -68.35683587007929 63.6653329657439, -68.1920713792907 63.6187211814374, -68.06613289831461 63.5909959640925, -67.992333722723 63.5498315649748, -67.8937161140074 63.5086557228833, -67.7660381436453 63.558918182728, -67.5598460266726 63.5650407771102, -67.4963312776663 63.502723880103, -67.3908853549751 63.4287416394152, -67.27697079896311 63.3634721665073, -67.18624961642659 63.3173906233786, -67.0267875607972 63.2847291874022, -66.93208383220301 63.2137033357404, -66.85270756310349 63.1551935072746, -66.7301641604476 63.0855638369016, -66.5590520172367 63.0848581227043, -66.5560689390303 63.2054750444379, -66.64127406774401 63.2679483443407))"
p = shapely.geometry.Polygon(wkt.loads(mywkt))
print(p.is_valid)
shape_feature = ShapelyFeature([p], ccrs.Geodetic(), edgecolor='black', facecolor="red")
ax.add_feature(shape_feature)
plt.show()

1 个答案:

答案 0 :(得分:2)

该多边形没有ccw序列。为正确起见,您需要颠倒顺序。这是为您解决问题的相关代码。

# Your code is OK up to this line:
p = shapely.geometry.Polygon(wkt.loads(mywkt))

# Add these lines to reverse vertices sequence
px = p.exterior
if px.is_ccw==False:
    px.coords = list(px.coords)[::-1]

# Continue your remaining code.

希望这很有用。