Jump to content

File:USALetterboxes.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 630 × 405 pixels, file size: 43.07 MB)

Summary

Description
English: map of letterboxes by county in the United States created from data at letterboxing.org
Date 8 August 2010 (original upload date)
Source Own work (Original caption: "
I (Protonk (talk)) created this work entirely by myself.
")
Author Protonk at en.wikipedia

Built from a .csv downloadable from letterboxing.org. Just search for boxes with no fields filled in and use the download link at the bottom of the list (I can't list exact URLs here because they are dynamically generated on the back end). The code to clean up, transform, and display the data is below in R. It assumes you have ggplot2 (and all dependencies) and stringr installed. Both packages are available from CRAN.

require(ggplot2);
require(plyr);
require(stringr);
require(maps);
options(stringsAsFactors = FALSE)

##Map plotting
statesline <- data.frame(map("state", plot=FALSE)[c("x","y")])
usamap <- qplot(x, y, data=statesline, geom="path")

#County Maps
countfr<-map_data("county")
names(countfr)<-c("long","lat","group","order","State","County")
countfr$State <- state.abb[match(countfr$State, tolower(state.name))]
state_df <- map_data("state")
WImap<-map_data("state",region="Wisconsin")
##Import and clean main data.
clues<-read.csv(file="~/Downloads/clues.csv",encoding="UTF-8")
clues<-subset(clues,select=c(Letterbox.Name,Placer,City,St,County,Place.Date,Boxes,Lat,Lon))
names(clues)<-c("Name","Placer","City","State","County","Date","Boxes","Blat","Blong")
clues$Boxes[which(clues$Boxes<0)]<-NA
clues$Blat[which(clues$Blat<10)]<-NA
clues$Blong[which(clues$Blong>-10)]<-NA
#Match with lowercase names in maps package
clues$County<-tolower(clues$County)
#Crude removal of some mystery boxes
clues$City[which(nchar(clues$City)<4)]<-NA
#Remove some malformed dates
clues$Date[which(nchar(clues$Date)<6)]<-NA
clues$Date<-as.Date(clues$Date,format="%m/%d/%Y");
#Restrict to the US and to properly formed counties
clues<-clues[which(clues$State %in% state.abb),];
clues<-clues[which(clues$County %in% countfr$County),];
#Create a subset for later.  
#WIboxes<-subset(clues,State=="WI",select=c("Blat","Blong"));

#Data frame of factor counts.  
nboxsum<-ddply(clues, c("County","State"),"nrow")
names(nboxsum)<-c("County","State","Boxes")
nboxsum$Letterboxes<-cut(nboxsum$Boxes,breaks=c(1,2,5,10,25,50,100,1000),labels=c("0-1","2-5","5-10","10-25","25-50","50-100","100-1000"),right=FALSE)

choropleth <- merge(countfr, nboxsum, by = c("County","State"))
choropleth$State<-as.factor(choropleth$State)
choropleth$County<-as.factor(choropleth$County)
choropleth <- choropleth[order(choropleth$order), ]
#WIboxcty<-subset(choropleth,State=="WI")
#WIboxcty<-rbind.fill(WIboxcty,WIboxes)

lbplot<-ggplot(choropleth, aes(long, lat, group = group)) + geom_polygon(aes(fill = Letterboxes,name="Boxes Per County"), colour = alpha("white", 1/2), size = 0.2) + geom_polygon(data = state_df, colour = "grey", fill = NA) + scale_fill_brewer(pal = "Greens")+theme_bw()+coord_map(project="lagrange")+scale_x_continuous(name=NULL,breaks = NA)+scale_y_continuous(name=NULL,breaks = NA)+ opts(axis.title.y = theme_blank(), axis.text.y =  theme_blank(),axis.title.x = theme_blank(), axis.text.x =  theme_blank());
#Wisconsin Plot

#wiplot<-ggplot(WIboxcty, aes(long, lat, group = group)) + geom_polygon(aes(fill = Letterboxes), colour = alpha("white", 1/2), size = 0.2) + geom_polygon(data = WImap, colour = "grey", fill = NA) + scale_fill_brewer(pal = "Greens")+theme_bw()+coord_map(project="lagrange")+scale_x_continuous(breaks = NA)+scale_y_continuous(breaks = NA);

##Output code.  uncomment to run.
#svg(filename="USALetterboxes.svg",onefile=TRUE,width=7,height=4.5,bg="transparent")
#lbplot
#dev.off()

Licensing

Protonk at en.wikipedia, the copyright holder of this work, hereby publishes it under the following licenses:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
Attribution: Protonk at en.wikipedia
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
You may select the license of your choice.

Original upload log

The original description page was here. All following user names refer to en.wikipedia.
  • 2010-08-08 23:31 Protonk 630×405× (45160844 bytes) Different ratio. Mostly a test edit
  • 2010-08-08 17:07 Protonk 630×630× (45366526 bytes) {{Information |Description = [[Choropleth map]] of [[Letterboxing|letterboxes]] by county in the [[United States]] created from data at [http://www.letterboxing.org/ letterboxing.org]. |Source = I (~~~) created this work entirely by myself.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

8 August 2010

45,160,844 byte

405 pixel

630 pixel

image/svg+xml

b6e6e8cf61b51a7e36524e6cd89832b5a214e151

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:11, 12 October 2011Thumbnail for version as of 12:11, 12 October 2011630 × 405 (43.07 MB)File Upload Bot (Magnus Manske) {{BotMoveToCommons|en.wikipedia|year={{subst:CURRENTYEAR}}|month={{subst:CURRENTMONTHNAME}}|day={{subst:CURRENTDAY}}}} {{Information |Description={{en|en:Choropleth map of letterboxes by county in the en:United States cre
12:08, 12 October 2011Thumbnail for version as of 12:08, 12 October 2011630 × 405 (43.07 MB)File Upload Bot (Magnus Manske) {{BotMoveToCommons|en.wikipedia|year={{subst:CURRENTYEAR}}|month={{subst:CURRENTMONTHNAME}}|day={{subst:CURRENTDAY}}}} {{Information |Description={{en|en:Choropleth map of letterboxes by county in the en:United States cre
No pages on the English Wikipedia use this file (pages on other projects are not listed).