ramnathv / rMaps

Interactive Maps from R
http://rmaps.github.io
389 stars 194 forks source link

multiple geoJson layers in leaflet #33

Open jmlondon opened 10 years ago

jmlondon commented 10 years ago

Hello

I'm developing a shiny app using Leaflet in rCharts (I will move to rMaps soon, thus I'm posting here) and I have two geoJson layers I would like to plot simultaneously. One layer is a predicted line of where the animal traveled and the other is the observed points that were used in the track prediction.

I, apparently incorrectly, assumed I could just make multiple calls to $geoJson(). Do I need to create a single geoJSON file with both point and line features?

For a real world example, you can find the initial development repository here

thanks for any assistance you can provide Josh

ramnathv commented 10 years ago

@jmlondon. I think you are confusing between the Leaflet implementation in rCharts and the leaflet package, which is a shiny-specific package written by rstudio.

jmlondon commented 10 years ago

@ramnathv Oops ... there's was a separate branch (feature/rcharts) that I neglected to push up to github. I originally started out using the rStudio leaflet package and that's what was still in the master branch.

I've rebased into master so the original link should work now Sorry for the confusion

jmlondon commented 10 years ago

we sorted out a solution.

turns out, mymap$geoJson() can accept a list of geojson objects (which are, themselves, lists of geojson features created by RJSONIO).

timelyportfolio commented 10 years ago

I might be way off, but would something like this potentially work http://timelyportfolio.github.io/rCharts_leaflet_templates/example_marker_layerGroup.html?

melisasa commented 9 years ago

Hi @timelyportfolio that looks interesting. How did you implement the multi layer selection in the server.r and ui.r ?