Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygons contained in other polygons: strange connecting lines #103

Open
mtennekes opened this issue Nov 28, 2024 · 1 comment
Open

Polygons contained in other polygons: strange connecting lines #103

mtennekes opened this issue Nov 28, 2024 · 1 comment

Comments

@mtennekes
Copy link

Data set
x = structure(list(structure(list(structure(c(5.90077355612138, 5.90103108959858, 
5.89987813300355, 5.89917813077747, 5.89642742513157, 5.89542356468034, 
5.89766640568094, 5.89374806106966, 5.89135904983083, 5.89153964286464, 
5.89455127778153, 5.90077355612138, 50.8797484649166, 50.8781791031756, 
50.8780255656331, 50.8786829430791, 50.8773544354483, 50.8761746503451, 
50.8758472287919, 50.8740045056457, 50.8755972033944, 50.8768820927646, 
50.8794934968871, 50.8797484649166), dim = c(12L, 2L))), class = c("XY", 
"POLYGON", "sfg")), structure(list(structure(c(5.86718246926256, 
5.86456785924311, 5.86325077661363, 5.86230997360323, 5.86332764218912, 
5.86369892988252, 5.86690743034895, 5.86718246926256, 50.8792693729732, 
50.8787127534017, 50.8790030655434, 50.8817699911716, 50.8820497996761, 
50.8812521766815, 50.8802188245431, 50.8792693729732), dim = c(8L, 
2L))), class = c("XY", "POLYGON", "sfg")), structure(list(structure(c(5.89089914548963, 
5.88973449779324, 5.88732825327685, 5.88876083685434, 5.89330157425175, 
5.88749023262515, 5.88724182055004, 5.88901435225914, 5.88810348785437, 
5.88225500318969, 5.87991286658139, 5.88144115599949, 5.88131495825503, 
5.87894713457087, 5.87803304501632, 5.87958112217099, 5.88136748307204, 
5.88236841922257, 5.8851369898756, 5.88363853513561, 5.88075665645447, 
5.87736033536936, 5.87602949608293, 5.87452220262287, 5.8761416384675, 
5.87509641095305, 5.87053308912874, 5.87697680721891, 5.87889121239277, 
5.87792752353057, 5.87984319563266, 5.88419856619061, 5.88654689500658, 
5.89089914548963, 50.8764759431355, 50.8736307754754, 50.8726515713931, 
50.8697720765477, 50.8682818111834, 50.8652092401289, 50.8658776880744, 
50.866726535983, 50.8682790635461, 50.8679079995717, 50.8666431481062, 
50.8658302243405, 50.8652451987539, 50.8641609210772, 50.8646428257975, 
50.8683118100961, 50.869211234826, 50.8687400054247, 50.8730010878732, 
50.8728196541974, 50.8737898129102, 50.872330221807, 50.8724122792398, 
50.875584275365, 50.8758852836986, 50.8788767948873, 50.8828836028572, 
50.8822681733014, 50.8808877513841, 50.8800845193878, 50.8791779987939, 
50.8785760171746, 50.8767204852929, 50.8764759431355), dim = c(34L, 
2L))), class = c("XY", "POLYGON", "sfg")), structure(list(structure(c(5.91917279986198, 
5.9140766786604, 5.91247842279296, 5.91817725469093, 5.92080717865904, 
5.91917279986198, 50.8925299316249, 50.8908048520328, 50.8924801331554, 
50.8946372570889, 50.8936784303528, 50.8925299316249), dim = c(6L, 
2L))), class = c("XY", "POLYGON", "sfg")), structure(list(structure(c(5.91687115582134, 
5.91501829623884, 5.91143358310351, 5.91154136014894, 5.913201798257, 
5.91755527472882, 5.91801088229411, 5.91687115582134, 50.898518387512, 
50.8975283557618, 50.8977117510986, 50.8989388012972, 50.8999720028188, 
50.9019390403699, 50.901512216836, 50.898518387512), dim = c(8L, 
2L))), class = c("XY", "POLYGON", "sfg")), structure(list(structure(c(5.92340497708512, 
5.92418062521156, 5.92529703504685, 5.92548481329452, 5.92869608987267, 
5.9389055564522, 5.94639795376299, 5.95262853606695, 5.9454227797353, 
5.94126330723364, 5.93932868867301, 5.93756417110731, 5.93185022987635, 
5.91739957747576, 5.91912717935388, 5.91519980859262, 5.9172824071261, 
5.92040473733918, 5.92043932506679, 5.92146678974958, 5.92702954135314, 
5.93098704742487, 5.9359752053468, 5.93911976114384, 5.93989971787032, 
5.94284945216539, 5.94565027840951, 5.94792440297702, 5.9540285635376, 
5.96159671938115, 5.96873954579334, 5.96936233249457, 5.96480618785376, 
5.96133498898102, 5.96072011893878, 5.95738501811196, 5.95477623497721, 
5.9534410380744, 5.95359111361745, 5.94895579670062, 5.94494899085651, 
5.9434327972218, 5.94166429981802, 5.93967877155177, 5.94021448340983, 
5.94285585964504, 5.94989684156708, 5.95360940336596, 5.95380343780211, 
5.9532638296757, 5.95529556928768, 5.95481621414461, 5.95089221152855, 
5.94680168793213, 5.94823869164683, 5.94739394127504, 5.94576362835268, 
5.946108437152, 5.9453467584389, 5.94041391299753, 5.93580694129331, 
5.93318719866198, 5.92960858954904, 5.92910849128029, 5.92500241107352, 
5.9161694055858, 5.90325788535756, 5.89877166057733, 5.89158946172933, 
5.89244796773421, 5.89179734536509, 5.88945681034099, 5.88799257196251, 
5.883671713302, 5.8766417336881, 5.87572745061911, 5.87663926206785, 
5.87430726676178, 5.8690327183739, 5.86948178202027, 5.87130416779322, 
5.87142313595114, 5.87310361968892, 5.87133255471988, 5.87040809510261, 
5.87014165308214, 5.86906178956847, 5.8706711171647, 5.86913149644162, 
5.87006849666638, 5.86534910947228, 5.86389164879478, 5.86279413084996, 
5.86183965582368, 5.86275102840017, 5.86161843437494, 5.87145602078456, 
5.8807864451243, 5.88585981515524, 5.88709860781108, 5.88859811430087, 
5.88960524086733, 5.8904616525972, 5.89400729718117, 5.89039005550333, 
5.90366611275782, 5.90157234538132, 5.91470710716031, 5.91339270175607, 
5.91724213200787, 5.92054340492208, 5.92340497708512, 50.9044057458296, 
50.9048442876797, 50.903949104577, 50.9026089494451, 50.9005485955283, 
50.8903311642779, 50.884209387415, 50.8778822727253, 50.8760564840816, 
50.8791681737615, 50.8816580296505, 50.8811367956401, 50.8873698505039, 
50.8823011695817, 50.879335905407, 50.8772538081419, 50.8764753668863, 
50.8764543374257, 50.8744488125517, 50.8738234142544, 50.8721963753808, 
50.8718529280308, 50.8736994873443, 50.8739138470799, 50.8728207246182, 
50.8733669060151, 50.8740162416962, 50.8754539156216, 50.8765033177847, 
50.86957587261, 50.8609296516462, 50.8600804019693, 50.8551457490697, 
50.8540510422109, 50.8548705076974, 50.8530612480516, 50.85258636994, 
50.8553984359156, 50.8573796770193, 50.8566044232899, 50.8574959762213, 
50.8568739464069, 50.8543052025921, 50.8533413769935, 50.8516452068685, 
50.8517505019864, 50.8500776508553, 50.8500478242935, 50.8504935166919, 
50.848217459881, 50.8469206966429, 50.8459241177283, 50.8445695722836, 
50.8446862985117, 50.8455531352022, 50.8465431440214, 50.8463484701243, 
50.844287257783, 50.8438939547297, 50.8415157577155, 50.8401368179805, 
50.8396609417854, 50.8402477043304, 50.8430426923329, 50.8488412535232, 
50.8488189087602, 50.8457060957188, 50.8433508951031, 50.842846925439, 
50.8457128455527, 50.8466445134084, 50.8452109954462, 50.8470337028415, 
50.8516774258595, 50.8550276843395, 50.8555273430739, 50.8565878902549, 
50.8572432063411, 50.8566794491882, 50.858413557675, 50.8608764904835, 
50.863012350509, 50.8646607339731, 50.8678101024043, 50.8677167724228, 
50.8686412624457, 50.8687567178403, 50.8707549945208, 50.8721960977092, 
50.8730188530217, 50.8758406217789, 50.8770956838441, 50.8797435172332, 
50.8799411945416, 50.8801824970606, 50.8824175128466, 50.8834592105682, 
50.882530159556, 50.8843050654805, 50.8837183320247, 50.8843454539247, 
50.8856364934732, 50.8850769758491, 50.8856020601969, 50.8884130732037, 
50.8942384535487, 50.8957934572245, 50.9017216777503, 50.9027249689041, 
50.9042645599532, 50.9030637008337, 50.9044057458296), dim = c(112L, 
2L)), structure(c(5.91801088229411, 5.91755527472882, 5.913201798257, 
5.91154136014894, 5.91143358310351, 5.91501829623884, 5.91687115582134, 
5.91801088229411, 50.901512216836, 50.9019390403699, 50.8999720028188, 
50.8989388012972, 50.8977117510986, 50.8975283557618, 50.898518387512, 
50.901512216836), dim = c(8L, 2L)), structure(c(5.91817725469093, 
5.91247842279296, 5.9140766786604, 5.91917279986198, 5.92080717865904, 
5.91817725469093, 50.8946372570889, 50.8924801331554, 50.8908048520328, 
50.8925299316249, 50.8936784303528, 50.8946372570889), dim = c(6L, 
2L)), structure(c(5.8851369898756, 5.88236841922257, 5.88136748307204, 
5.87958112217099, 5.87803304501632, 5.87894713457087, 5.88131495825503, 
5.88144115599949, 5.87991286658139, 5.88225500318969, 5.88810348785437, 
5.88901435225914, 5.88724182055004, 5.88749023262515, 5.89330157425175, 
5.88876083685434, 5.88732825327685, 5.88973449779324, 5.89089914548963, 
5.88654689500658, 5.88419856619061, 5.87984319563266, 5.87792752353057, 
5.87889121239277, 5.87697680721891, 5.87053308912874, 5.87509641095305, 
5.8761416384675, 5.87452220262287, 5.87602949608293, 5.87736033536936, 
5.88075665645447, 5.88363853513561, 5.8851369898756, 50.8730010878732, 
50.8687400054247, 50.869211234826, 50.8683118100961, 50.8646428257975, 
50.8641609210772, 50.8652451987539, 50.8658302243405, 50.8666431481062, 
50.8679079995717, 50.8682790635461, 50.866726535983, 50.8658776880744, 
50.8652092401289, 50.8682818111834, 50.8697720765477, 50.8726515713931, 
50.8736307754754, 50.8764759431355, 50.8767204852929, 50.8785760171746, 
50.8791779987939, 50.8800845193878, 50.8808877513841, 50.8822681733014, 
50.8828836028572, 50.8788767948873, 50.8758852836986, 50.875584275365, 
50.8724122792398, 50.872330221807, 50.8737898129102, 50.8728196541974, 
50.8730010878732), dim = c(34L, 2L)), structure(c(5.90077355612138, 
5.89455127778153, 5.89153964286464, 5.89135904983083, 5.89374806106966, 
5.89766640568094, 5.89542356468034, 5.89642742513157, 5.89917813077747, 
5.89987813300355, 5.90103108959858, 5.90077355612138, 50.8797484649166, 
50.8794934968871, 50.8768820927646, 50.8755972033944, 50.8740045056457, 
50.8758472287919, 50.8761746503451, 50.8773544354483, 50.8786829430791, 
50.8780255656331, 50.8781791031756, 50.8797484649166), dim = c(12L, 
2L)), structure(c(5.94780394346335, 5.9458254902496, 5.94572788911195, 
5.94690856164917, 5.94741734783731, 5.9460111010826, 5.94780394346335, 
50.8735759421895, 50.8731165437907, 50.869682524701, 50.8696106031423, 
50.8706323860103, 50.8730238706437, 50.8735759421895), dim = c(7L, 
2L)), structure(c(5.90169689988948, 5.89447472575195, 5.89255069168765, 
5.88412432665621, 5.88723940689999, 5.89319426325663, 5.90417986816489, 
5.90415610595898, 5.90169689988948, 50.8670805320067, 50.8651506542683, 
50.8669753796156, 50.8631266929936, 50.8616398635936, 50.8623395690585, 
50.8656093581453, 50.8669784783628, 50.8670805320067), dim = c(9L, 
2L)), structure(c(5.93148184326587, 5.93051657523007, 5.92977662411053, 
5.93085953244796, 5.93303217432856, 5.9345445367029, 5.93148184326587, 
50.8643231115536, 50.8645225362496, 50.863413148133, 50.8623098369222, 
50.8613736077217, 50.8614501513505, 50.8643231115536), dim = c(7L, 
2L)), structure(c(5.86369892988252, 5.86332764218912, 5.86230997360323, 
5.86325077661363, 5.86456785924311, 5.86718246926256, 5.86690743034895, 
5.86369892988252, 50.8812521766815, 50.8820497996761, 50.8817699911716, 
50.8790030655434, 50.8787127534017, 50.8792693729732, 50.8802188245431, 
50.8812521766815), dim = c(8L, 2L)), structure(c(5.93182697128133, 
5.93099737756398, 5.9307017021112, 5.93472037552486, 5.93733703656214, 
5.93621667967347, 5.93519489726357, 5.93592241886404, 5.93392033279275, 
5.93214827657005, 5.93182697128133, 50.8538956857239, 50.8540935014287, 
50.8511848295843, 50.8509495539536, 50.8524311127652, 50.8540170912084, 
50.8540134176753, 50.8529344843222, 50.8528214786151, 50.853099037481, 
50.8538956857239), dim = c(11L, 2L))), class = c("XY", "POLYGON", 
"sfg"))), precision = 0, bbox = structure(c(xmin = 5.86161843437494, 
ymin = 50.8396609417854, xmax = 5.96936233249457, ymax = 50.9048442876797
), class = "bbox"), crs = structure(list(input = "EPSG:4326", 
    wkt = "GEOGCRS[\"WGS 84\",\n    ENSEMBLE[\"World Geodetic System 1984 ensemble\",\n        MEMBER[\"World Geodetic System 1984 (Transit)\"],\n        MEMBER[\"World Geodetic System 1984 (G730)\"],\n        MEMBER[\"World Geodetic System 1984 (G873)\"],\n        MEMBER[\"World Geodetic System 1984 (G1150)\"],\n        MEMBER[\"World Geodetic System 1984 (G1674)\"],\n        MEMBER[\"World Geodetic System 1984 (G1762)\"],\n        MEMBER[\"World Geodetic System 1984 (G2139)\"],\n        ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n            LENGTHUNIT[\"metre\",1]],\n        ENSEMBLEACCURACY[2.0]],\n    PRIMEM[\"Greenwich\",0,\n        ANGLEUNIT[\"degree\",0.0174532925199433]],\n    CS[ellipsoidal,2],\n        AXIS[\"geodetic latitude (Lat)\",north,\n            ORDER[1],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        AXIS[\"geodetic longitude (Lon)\",east,\n            ORDER[2],\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n    USAGE[\n        SCOPE[\"Horizontal component of 3D system.\"],\n        AREA[\"World.\"],\n        BBOX[-90,-180,90,180]],\n    ID[\"EPSG\",4326]]"), class = "crs"), n_empty = 0L, class = c("sfc_POLYGON", 
"sfc"))
leaflet() |> 
	leafgl::addGlPolygons(data = x, fillOpacity = 0.1)
Screenshot 2024-11-28 at 20 41 12
leaflet() |> 
	addPolygons(data = x, fillOpacity = 0.1)
Screenshot 2024-11-28 at 20 41 52
@trafficonese
Copy link
Collaborator

This seems to happen with the current CRAN and dev version.

With #95 merged, the issue dissapears:

remotes::install_github("r-spatial/leafgl", ref=remotes::github_pull(95), uprade="never")
leaflet() |> 
  leafgl::addGlPolygons(data = x, fillOpacity = 0.1)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants