0

Long story short: I´d like to plot bus lines on my GeoJSON data with Leaflet but need to get rid of the overlap.

I´ve been skimming the forum for an answer to my question but, haven´t found any yet. I was trying to use the polylineoffset.js https://github.com/bbecquet/Leaflet.PolylineOffset for Leaflet but couldn't figure out how it works. It may be due to the fact that I´m trying to plot the map in R Studio only.

my output

Code:

leaflet()%>%
addTiles()%>%
setView(lat = 51.545483, 
        lng=9.905548,
        zoom=18)%>%
addMarkers(lng = Ein$Longitude, 
           lat = Ein$Latitude, 
           popup = str_c(as.character(Ein$Ein),"Einstiege:",as.character(Ein$Einstiege), 
"Ausstiege:", as.character(Ein$Ausstiege),sep="<br/>") 
          ,label =  as.character(Ein$Ein))%>%
addPolylines(data=lines1,
             color=~pal(lines1@data$`(pers = n())`),
             fillOpacity = 1,
             popup =str_c(as.character(lines1@data$ref), "Durchschnittliche 
Stationen", as.character(lines1@data$`(Stationen = 
mean(round(StationenGesamt, 2), na.rm = TRUE))`),"Durchschnittliche 
WLQ:",as.character(lines1@data$WLQ),sep="<br/>"))%>%
addLegend(position="bottomright",
          pal=pal, 
          values=lines1@data$`(pers = n())`, 
          labels)%>%
registerPlugin(polylineoffset_Plugin)

How can I do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.