Reputation: 1047
I have been using Leaflet before for a different dataset, which was from a CSV file. This dataset however, is in a Data Frame, which has 675 rows (some lat and lon are NA values, but most are there).
The problem is that I would expect there to be at least 500 or more points on the map, but it seems to render only about 6. Anyone experienced this before?
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))
}
When I check the data
, it is indeed the dataframe with 675 rows. This function is called in a reactive functions, if that matters (I assume not, since each time I see the dataframe inside the function still returns what it should)
Any help appreciated, do not know where this is coming from ..
EDIT: Some data (meetup data)
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
Upvotes: 1
Views: 98
Reputation: 209
Leaflet will stop parsing data points when it hits the first error. To see all the points on your map, you will need to remove all of the NA values:
data <- data[!is.na(data$lat), ]
Upvotes: 2