之前我一直在使用Leaflet来获取不同的数据集,该数据集来自CSV文件。但是,此数据集位于数据框中,该数据框有675行(某些lat和lon是NA值,但大多数都在那里)。
问题在于我希望地图上至少有500个或更多点,但它似乎只渲染了大约6个。之前有人经历过这个吗?
renderUiMeetup <- function(data){
return (leaflet(data) %>% addTiles('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png') %>%
setView(5, 52.37, zoom = 11) %>%
addCircles(~results.venue.lon, ~results.venue.lat, weight = 1, radius=2,
color="#000", stroke = TRUE, fillOpacity = 0.8))
}
当我检查data
时,它确实是具有675行的数据帧。这个函数在被动函数中被调用,如果这很重要(我假设没有,因为每次我看到函数内部的数据帧仍然返回它应该的东西)
任何帮助表示感谢,不知道这是来自哪里..
编辑:一些数据(聚会数据)
results.venue.address_1 results.venue.name results.venue.lon results.venue.id
1 Amstel 1 Amsterdam Raadzaal Stadhuis Amsterdam 4.900240 24631310
2 16 Notweg FitClub Bergen 4.699218 24632049
3 16 Notweg FitClub Bergen 4.699218 24632049
4 Nieuwmarkt 4 Waag Society 4.900210 23744775
5 Overtoom 301 Anamorphic Studio in OT301 4.865707 16443062
6 Langs de Akker 3 Emergohal 4.879670 23816542
7 <NA> <NA> NA NA
8 Goeman Borgesiuslaan 77 Ibuildings Utrecht 5.113864 19126412
9 Amstelstraat 2 Vapiano Restaurant - Rembrantplein 4.910965 12762372
10 Amstelveenseweg 130 All4Running 4.855405 23844308
11 Overtoom 301 OT301 4.865604 6736512
12 Ceintuurbaan 338, 1072 GN Amsterdam | The Rialto Cinema 4.893891 24690797
13 Weteringschans 6 Paradiso 4.884215 698679
14 Singel 165A 1012 WE Het Spinhuis 4.889594 24224032
15 Recht Boomssloot 52 De Boomsspijker 4.903769 1110122
16 Oosterpark 10 Bar Bukowski 4.917633 21271582
17 Nieuwe Achtergracht 170 Crea 4.912870 9152402
18 James Wattstraat 10 Basisschool 'Spectrum' 4.925560 23633711
19 Volmolengracht 13 MakerSpace Leiden 4.493560 23445132
20 Lizzy Ansinghstraat 88 Sporthal de Pijp 4.893200 23594478
21 ketelhuisplein 41 WG cursusruimte 4.869719 1500646
22 Jansdam 3 Mick O'Connells Irish Pub 5.122060 702533
23 Spui 25-27 Spui 25 4.889688 2549081
24 Arthur van Schendelstraat 650 HNK Utrecht 0.000000 24251942
25 Vondelpark 6B, 1071 AA Amsterdam Kinderkook cafe 4.864780 23666288
results.venue.lat results.venue.repinned results.venue.phone results.venue.address_2 results.rating.count
1 52.36768 FALSE <NA> <NA> 0
2 52.67305 FALSE <NA> <NA> 0
3 52.67305 FALSE <NA> <NA> 0
4 52.37271 FALSE <NA> <NA> 1
5 52.36014 FALSE <NA> <NA> 0
6 52.29020 FALSE <NA> <NA> 0
7 NA NA <NA> <NA> 8
8 52.10300 FALSE <NA> <NA> 1
9 52.34731 FALSE <NA> <NA> 0
10 52.35427 FALSE <NA> <NA> 0
11 52.36013 FALSE <NA> <NA> 0
12 52.35298 FALSE <NA> <NA> 0
13 52.36223 FALSE 020 - 626 45 2 <NA> 1
14 52.37452 TRUE <NA> <NA> 0
15 52.37190 FALSE 020-626-4002 1011EC 0
16 52.35798 FALSE <NA> <NA> 0
17 52.36328 FALSE <NA> <NA> 0
18 52.35243 FALSE <NA> <NA> 0
19 52.16282 FALSE <NA> <NA> 1
20 52.34951 FALSE <NA> <NA> 0
21 52.36355 FALSE <NA> <NA> 0
22 52.09256 FALSE 030 236 8466 <NA> 0
23 52.36859 FALSE <NA> <NA> 6
24 0.00000 FALSE <NA> <NA> 2
25 52.35920 FALSE <NA> <NA> 0
答案 0 :(得分:2)
Leaflet将在遇到第一个错误时停止解析数据点。要查看地图上的所有点,您需要删除所有NA值:
data <- data[!is.na(data$lat), ]