Skip to content

Commit

Permalink
change tile provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Moore committed Dec 22, 2015
1 parent 197cded commit bf1a568
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
6 changes: 1 addition & 5 deletions server.R
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ shinyServer(function(input, output, session) {
ax <- getData() ax <- getData()


l <- leaflet(data=ax) %>% l <- leaflet(data=ax) %>%
addTiles(urlTemplate="http://openmapsurfer.uni-hd.de/tiles/roadsg/x={x}&y={y}&z={z}", addProviderTiles("CartoDB.Positron", tileOptions(minZoom=10, maxZoom=17)) %>%
options=tileOptions(minZoom=10, maxZoom=17)) %>%
addTiles('http://{s}.tile.openstreetmap.se/hydda/roads_and_labels/{z}/{x}/{y}.png',
attribution='&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
options=tileOptions(minZoom=10, maxZoom=17)) %>%
setView(lng=-3.19, lat=55.95, zoom=13) %>% setView(lng=-3.19, lat=55.95, zoom=13) %>%
setMaxBounds(lng1=-5, lat1=55, lng2=-2, lat2=57) setMaxBounds(lng1=-5, lat1=55, lng2=-2, lat2=57)


Expand Down
60 changes: 30 additions & 30 deletions ui.R
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,68 +7,68 @@ library("leaflet")
shinyUI(navbarPage("Blackspot", id="nav", collapsible=T, shinyUI(navbarPage("Blackspot", id="nav", collapsible=T,
tabPanel("Map", tabPanel("Map",
div(class="outer", div(class="outer",

tags$head( tags$head(
includeScript("analytics.js"), includeScript("analytics.js"),
tags$link(rel = "stylesheet", type = "text/css", tags$link(rel = "stylesheet", type = "text/css",
href = "ion.rangeSlider.skinFlat.css"), href = "ion.rangeSlider.skinFlat.css"),
includeScript("spin.min.js"), includeScript("spin.min.js"),
includeCSS("styles.css") includeCSS("styles.css")
), ),

leafletOutput("mymap", width="100%", height="100%"), leafletOutput("mymap", width="100%", height="100%"),
tags$script(" tags$script("
var spinner = new Spinner().spin(); var spinner = new Spinner().spin();
$( 'div#mymap' ).append(spinner.el);"), $( 'div#mymap' ).append(spinner.el);"),

absolutePanel(id = "controls", class = "panel panel-default", fixed = TRUE, absolutePanel(id = "controls", class = "panel panel-default", fixed = TRUE,
draggable = TRUE, top = 100, left = "auto", right = 20, bottom = "auto", draggable = TRUE, top = 100, left = "auto", right = 20, bottom = "auto",
width = 360, height = "auto", width = 360, height = "auto",

h2(), h2(),
p(class="intro", p(class="intro",
strong("Blackspot"), " shows vechicle collisions in", strong("Blackspot"), " shows vechicle collisions in",
"the city of Edinburgh, UK. Data from", "the city of Edinburgh, UK. Data from",
a("Edinburgh Open Data.", a("Edinburgh Open Data.",
href="http://www.edinburghopendata.info/dataset/vehicle-collisions", href="http://www.edinburghopendata.info/dataset/vehicle-collisions",
target="_blank")), target="_blank")),

tabsetPanel( tabsetPanel(
tabPanel("Controls", tabPanel("Controls",

dateRangeInput('dates', dateRangeInput('dates',
label = 'Occurred between:', label = 'Occurred between:',
start = as.Date("2010-01-01"), end = as.Date("2013-07-01")), start = as.Date("2010-01-01"), end = as.Date("2013-07-01")),

selectInput("color", "Colour by:", selectInput("color", "Colour by:",
choices=c("None", "Severity", "Casualties", "Time", "Vehicles", "Speed limit")), choices=c("None", "Severity", "Casualties", "Time", "Vehicles", "Speed limit")),

sliderInput("alpha", label="Opacity:", sliderInput("alpha", label="Opacity:",
min=0, max=1, value=0.4, step=.025, ticks=T), min=0, max=1, value=0.4, step=.025, ticks=T),

fluidRow( fluidRow(
column(6, column(6,
sliderInput("base", label="Point size:", sliderInput("base", label="Point size:",
min=1, max=5, value=1) min=1, max=5, value=1)
), ),

column(6, column(6,
selectInput("scale", label="Scale by:", width=120, selectInput("scale", label="Scale by:", width=120,
selected="Vehicles", selected="Vehicles",
choices=c("Casualties", "Vehicles"))#) choices=c("Casualties", "Vehicles"))#)
) )
), ),

hr(class="thin"), hr(class="thin"),
p("Under development by", p("Under development by",
a("@benjaminlmoore", href="http://twitter.com/benjaminlmoore", a("@benjaminlmoore", href="http://twitter.com/benjaminlmoore",
target="_blank"), target="_blank"),
HTML("&bull;"), "See the code on ", HTML("&bull;"), "See the code on ",
a("github", href="http://github.com/blmoore/blackspot", a("github", href="http://github.com/blmoore/blackspot",
target="_blank"), target="_blank"),
class="foot") class="foot")
), ),

tabPanel("Graphs", tabPanel("Graphs",
#p("Static plots"), #p("Static plots"),
plotOutput("monthTotals", height = "110px"), plotOutput("monthTotals", height = "110px"),
Expand All @@ -81,7 +81,7 @@ $( 'div#mymap' ).append(spinner.el);"),
p(class="topp", "Explore vehicle collisions recorded in Edinburgh", p(class="topp", "Explore vehicle collisions recorded in Edinburgh",
"between 2010 and 2013 in this interactive data visualisation." "between 2010 and 2013 in this interactive data visualisation."
), ),
p("Blackspot is written in ", p("Blackspot is written in ",
a("Shiny,", href="http://shiny.rstudio.com/", target="_blank"), a("Shiny,", href="http://shiny.rstudio.com/", target="_blank"),
"a web application framework for the R language.", "a web application framework for the R language.",
"Maps are built with ", "Maps are built with ",
Expand All @@ -97,39 +97,39 @@ $( 'div#mymap' ).append(spinner.el);"),
a("@benjaminlmoore", href="http://twitter.com/benjaminlmoore", a("@benjaminlmoore", href="http://twitter.com/benjaminlmoore",
target="_blank"), target="_blank"),
HTML("&mdash;"), HTML("&mdash;"),
"see the full code on ", "see the full code on ",
a("github", href="http://github.com/blmoore/blackspot", a("github", href="http://github.com/blmoore/blackspot",
target="_blank"), target="_blank"),
"or run locally with:" "or run locally with:"
), ),
pre("shiny::runGitHub('blmoore/blackspot')"), pre("shiny::runGitHub('blmoore/blackspot')"),
hr(class="thin") hr(class="thin")
) )
# end about panel # end about panel
), ),

tags$script(' tags$script('
Shiny.addCustomMessageHandler("map_done", Shiny.addCustomMessageHandler("map_done",
function(s) { function(s) {
spinner.stop(); spinner.stop();
$( "div#mymap" ).remove(spinner); $( "div#mymap" ).remove(spinner);
});') });')

), ),

# mobile panel # mobile panel
div(class="mobile-panel", div(class="mobile-panel",
p(strong("Blackspot"), " shows vechicle collisions in", p(strong("Blackspot"), " shows vechicle collisions in",
"the city of Edinburgh, UK. Written in R Shiny by", "the city of Edinburgh, UK. Written in R Shiny by",
a("@benjaminlmoore,", href="https://twitter.com/benjaminlmoore"), a("@benjaminlmoore,", href="https://twitter.com/benjaminlmoore"),
"see the code on ", "see the code on ",
a("github.", href="http://github.com/blmoore/blackspot"), a("github.", href="http://github.com/blmoore/blackspot"),
"Data: ", "Data: ",
a("Edinburgh Open Data.", a("Edinburgh Open Data.",
href="http://www.edinburghopendata.info/dataset/vehicle-collisions")), href="http://www.edinburghopendata.info/dataset/vehicle-collisions")),

hr(class="thin"), hr(class="thin"),

radioButtons("color_mob", "Colour by:", inline=T, radioButtons("color_mob", "Colour by:", inline=T,
choices=c("None", "Severity", "Casualties", "Time", "Vehicles", "Speed limit")) choices=c("None", "Severity", "Casualties", "Time", "Vehicles", "Speed limit"))
) )
Expand All @@ -138,4 +138,4 @@ $( 'div#mymap' ).append(spinner.el);"),
) )
), tabPanel("Table", DT::dataTableOutput("table")) ), tabPanel("Table", DT::dataTableOutput("table"))
) )
) )

0 comments on commit bf1a568

Please sign in to comment.