Last active
July 14, 2016 17:03
-
-
Save fernandogelin/baa5dda0722582953ebc to your computer and use it in GitHub Desktop.
Ballard Breweries Map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name | address | lat | long | |
---|---|---|---|---|
Urban Family Brewing Co. | 4441 26th Ave W, Seattle, WA 98199 | 47.660573 | -122.390032 | |
Northwest Peaks Brewery | 4818 17th Ave NW, Seattle, WA 98107 | 47.664298 | -122.378785 | |
Peddler Brewing Company | 1514 NW Leary Way, Seattle, WA 98107 | 47.664407 | -122.377095 | |
Maritime Pacific Brewing Company | 1111 NW Ballard Way, Seattle, WA 98107 | 47.662831 | -122.371739 | |
Reuben's Brews | 5010 14th Ave NW, Seattle, WA 98107 | 47.665416 | -122.373390 | |
Stoup Brewery | 1108 NW 52nd St, Seattle, WA 98107 | 47.666549 | -122.371235 | |
Lucky Envelope Brewing | 907 NW 50th St, Seattle, WA 98107 | 47.664900 | -122.369097 | |
Populuxe Brewing | 826B NW 49th St, Seattle, WA 98107 | 47.664486 | -122.367583 | |
Hale's Ales Brewery & Pub | 4301 Leary Way NW, Seattle, WA 98107 | 47.659077 | -122.365141 | |
Hilliard's Beer | 1550 NW 49th St, Seattle, WA 98107 | 47.664492 | -122.378035 | |
Bad Jimmy's Brewing Co. | B, 4358 Leary Way NW, Seattle, WA 98107 | 47.660392 | -122.365465 | |
Ballard Beer Company | 2050 NW Market St, Seattle, WA 98107 | 47.668806 | -122.384313 | |
Ballard Station Public House | 2236 NW Market St, Seattle, WA 98107 | 47.668793 | -122.386354 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(leaflet) | |
breweries <- read.csv("../d3/ballard_breweries.csv") | |
m <- leaflet(data=breweries) | |
m %>% addProviderTiles("CartoDB.Positron") %>% addMarkers(~long, ~lat, popup = ~as.character(name)) | |
library(shiny) | |
library(leaflet) | |
r_colors <- rgb(t(col2rgb(colors()) / 255)) | |
names(r_colors) <- colors() | |
pint = makeIcon("../d3/pint.png") | |
ui <- fluidPage( | |
h1("Ballard Breweries"), | |
leafletOutput("mymap", width= "50%", height= 500), | |
p() | |
) | |
server <- function(input, output, session) { | |
output$mymap <- renderLeaflet({ | |
breweries <- read.csv("../d3/ballard_breweries.csv") | |
m <- leaflet(data=breweries) | |
m %>% addProviderTiles("CartoDB.Positron") %>% addMarkers(~long, ~lat, popup = ~as.character(name,address), icon=pint) | |
}) | |
} | |
shinyApp(ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
#map { | |
height: 500px; | |
width: 100%; | |
} | |
.header { | |
text-align: center; | |
padding: 14px; | |
} | |
</style> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" /> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script> | |
<script src="https://raw.githubusercontent.com/leaflet-extras/leaflet-providers/master/leaflet-providers.js"></script> | |
<script src="http://rawgit.com/jashkenas/coffee-script/master/extras/coffee-script.js"></script> | |
<script type="text/coffeescript"> | |
map = L.map('map').setView [47.6619, -122.3775], 15 | |
L.tileLayer.provider('MapBox', {id: 'fernandogelin.6e8ee4d4', accessToken: 'pk.eyJ1IjoiZmVybmFuZG9nZWxpbiIsImEiOiIyOWEzM2M5MTZmNmI0YjJjMTdkMTBiZDJjYjE3YTlhZCJ9.nJZf5CLZ57PXvcFGQ1KdOQ'}).addTo(map) | |
pintIcon = L.icon { | |
iconUrl: './pint.png'} | |
data = d3.csv 'ballard_breweries.csv', (error, dataset) -> | |
dataset.forEach (d) -> | |
d.lat = +d.lat | |
d.long = +d.long | |
popup = "<b>" + d.name + "</b>" + "<br>" + d.address | |
marker = L.marker([d.lat,d.long], {icon: pintIcon}).addTo(map) | |
marker.bindPopup(popup, closeButton:false).openPopup() | |
marker.on 'mouseover', (e) -> | |
this.openPopup() | |
marker.on 'mouseout', (e) -> | |
this.closePopup() | |
</script> | |
<div id="map"></div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment