Skip to content

Commit e1e10ba

Browse files
v3.3.0 as submitted
1 parent 700fa97 commit e1e10ba

5 files changed

Lines changed: 68 additions & 70 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# CI & codecov-related
1313
^\.travis\.yml$
14+
^\.lintr$
1415

1516
^logo_maker.R$
1617
^_pkgdown\.yml$

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: geohashTools
2-
Version: 0.3.2.9999
2+
Version: 0.3.3
33
Title: Tools for Working with Geohashes
44
Authors@R: c(
55
person('Michael', 'Chirico', role = c('aut', 'cre'), email = 'MichaelChirico4@gmail.com'),

README.Rmd

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,30 @@ The park is quite large, and this is too precise to cover the park; we can "zoom
4747
gh_encode(11.3113917, -74.0779006, precision = 5L)
4848
```
4949

50+
<!-- TODO(michaelchirico): restore this. Site appears to be down as of this CRAN submission, seemingly temporarily -->
51+
5052
### Public Art in Chicago
5153

52-
We can use this as a simple, regular level of spatial aggregation for spatial points data, e.g., counting presence of public art throughout the city of Chicago, as captured in [this dataset](https://data.cityofchicago.org/Parks-Recreation/Parks-Public-Art/sj6t-9cju) provided by the City:
54+
We can use this as a simple, regular level of spatial aggregation for spatial points data, e.g., counting presence of public art throughout the city of Chicago, as captured in a dataset
55+
56+
<!-- http s://data.cityofchicago.org/Parks-Recreation/Parks-Public-Art/sj6t-9cju -->
57+
58+
provided by the City:
59+
60+
NB: As of this writing, the Chicago data portal is down, apparently temporarily. However I'd like to submit this package update to CRAN in order to avoid deprecation issues around {rgdal} & co, so please check back on the website for a working version of the code below.
5361

5462
```{r chicago_art}
5563
## first, pull the data internally from https://data.cityofchicago.org
56-
api_stem = 'https://data.cityofchicago.org/api/views'
57-
URL = file.path(api_stem, 'sj6t-9cju/rows.csv?accessType=DOWNLOAD')
64+
# api_stem = 'https://data.cityofchicago.org/api/views'
65+
# URL = file.path(api_stem, 'sj6t-9cju/rows.csv?accessType=DOWNLOAD')
5866
59-
suppressPackageStartupMessages(library(data.table))
60-
art = fread(URL)
67+
# suppressPackageStartupMessages(library(data.table))
68+
# art = fread(URL)
6169
6270
# count art by geohash
63-
gh_freq = art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 5L))]
71+
# gh_freq = art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 5L))]
6472
# only show the top 10
65-
gh_freq[order(-N)][1:10]
73+
# gh_freq[order(-N)][1:10]
6674
```
6775

6876
This is pretty impractical _per se_ (where is `dp3wm`?); we'll return to this once we've introduced more functionality.
@@ -118,23 +126,23 @@ Returning to public art locations in Chicago, we can visualize the spatial aggre
118126
library(sf)
119127
120128
## first, pull neighborhood shapefiles from https://data.cityofchicago.org
121-
tmp = tempfile(fileext = '.zip')
122-
shp_url = file.path(
123-
api_stem, '9wp7-iasj', 'files',
124-
'TMTPQ_MTmUDEpDGCLt_B1uaiJmwhCKZ729Ecxq6BPfM?filename=Neighborhoods_2012.zip'
125-
)
126-
download.file(shp_url, tmp)
127-
128-
chicago = paste0('/vsizip/', tmp) |>
129-
st_read(quiet = TRUE) |>
130-
st_transform(crs = 4326L)
131-
132-
artSF = gh_to_sf(
133-
art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 6L))],
134-
gh_col = 'geohash'
135-
)
136-
plot(st_geometry(chicago), lwd = 0.5, main = 'Public Art Locations in Chicago')
137-
plot(artSF['N'], add = TRUE)
129+
# tmp = tempfile(fileext = '.zip')
130+
# shp_url = file.path(
131+
# api_stem, '9wp7-iasj', 'files',
132+
# 'TMTPQ_MTmUDEpDGCLt_B1uaiJmwhCKZ729Ecxq6BPfM?filename=Neighborhoods_2012.zip'
133+
# )
134+
# download.file(shp_url, tmp)
135+
136+
# chicago = paste0('/vsizip/', tmp) |>
137+
# st_read(quiet = TRUE) |>
138+
# st_transform(crs = 4326L)
139+
140+
# artSF = gh_to_sf(
141+
# art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 6L))],
142+
# gh_col = 'geohash'
143+
# )
144+
# plot(st_geometry(chicago), lwd = 0.5, main = 'Public Art Locations in Chicago')
145+
# plot(artSF['N'], add = TRUE)
138146
```
139147

140148
Chicago connoisseurs will recognize the biggest concentration around Lincoln Park, with another concentration along the waterfront near Millenium/Grant Parks.

README.md

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -43,37 +43,31 @@ gh_encode(11.3113917, -74.0779006, precision = 5L)
4343
## [1] "d6526"
4444
```
4545

46+
<!-- TODO(michaelchirico): restore this. Site appears to be down as of this CRAN submission, seemingly temporarily -->
47+
4648
### Public Art in Chicago
4749

48-
We can use this as a simple, regular level of spatial aggregation for spatial points data, e.g., counting presence of public art throughout the city of Chicago, as captured in [this dataset](https://data.cityofchicago.org/Parks-Recreation/Parks-Public-Art/sj6t-9cju) provided by the City:
50+
We can use this as a simple, regular level of spatial aggregation for spatial points data, e.g., counting presence of public art throughout the city of Chicago, as captured in a dataset
51+
52+
<!-- http s://data.cityofchicago.org/Parks-Recreation/Parks-Public-Art/sj6t-9cju -->
53+
54+
provided by the City:
55+
56+
NB: As of this writing, the Chicago data portal is down, apparently temporarily. However I'd like to submit this package update to CRAN in order to avoid deprecation issues around {rgdal} & co, so please check back on the website for a working version of the code below.
4957

5058

5159
```r
5260
## first, pull the data internally from https://data.cityofchicago.org
53-
api_stem = 'https://data.cityofchicago.org/api/views'
54-
URL = file.path(api_stem, 'sj6t-9cju/rows.csv?accessType=DOWNLOAD')
61+
# api_stem = 'https://data.cityofchicago.org/api/views'
62+
# URL = file.path(api_stem, 'sj6t-9cju/rows.csv?accessType=DOWNLOAD')
5563

56-
suppressPackageStartupMessages(library(data.table))
57-
art = fread(URL)
64+
# suppressPackageStartupMessages(library(data.table))
65+
# art = fread(URL)
5866

5967
# count art by geohash
60-
gh_freq = art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 5L))]
68+
# gh_freq = art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 5L))]
6169
# only show the top 10
62-
gh_freq[order(-N)][1:10]
63-
```
64-
65-
```
66-
## geohash N
67-
## 1: dp3wm 46
68-
## 2: dp3wn 42
69-
## 3: dp3wt 16
70-
## 4: dp3wq 13
71-
## 5: dp3wk 10
72-
## 6: dp3wj 9
73-
## 7: dp3ty 9
74-
## 8: dp3w7 8
75-
## 9: dp3tw 6
76-
## 10: dp3wu 4
70+
# gh_freq[order(-N)][1:10]
7771
```
7872

7973
This is pretty impractical _per se_ (where is `dp3wm`?); we'll return to this once we've introduced more functionality.
@@ -180,29 +174,24 @@ Returning to public art locations in Chicago, we can visualize the spatial aggre
180174
library(sf)
181175

182176
## first, pull neighborhood shapefiles from https://data.cityofchicago.org
183-
tmp = tempfile(fileext = '.zip')
184-
shp_url = file.path(
185-
api_stem, '9wp7-iasj', 'files',
186-
'TMTPQ_MTmUDEpDGCLt_B1uaiJmwhCKZ729Ecxq6BPfM?filename=Neighborhoods_2012.zip'
187-
)
188-
download.file(shp_url, tmp)
189-
190-
chicago = paste0('/vsizip/', tmp) |>
191-
st_read(quiet = TRUE) |>
192-
st_transform(crs = 4326L)
193-
194-
artSF = gh_to_sf(
195-
art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 6L))],
196-
gh_col = 'geohash'
197-
)
198-
plot(st_geometry(chicago), lwd = 0.5, main = 'Public Art Locations in Chicago')
199-
plot(artSF['N'], add = TRUE)
200-
```
201-
202-
<div class="figure">
203-
<img src="README-chicago_plot-1.png" alt="A viridis-color-scaled plot of Chicago overlaid with two types of polygons: (1) the erose, semi-regular map of neighborhoods; and (2) the regular, rectangular map of geohashes with public art. The salient features of the plot are further described in the README body below." width="\textwidth" />
204-
<p class="caption">plot of chunk chicago_plot</p>
205-
</div>
177+
# tmp = tempfile(fileext = '.zip')
178+
# shp_url = file.path(
179+
# api_stem, '9wp7-iasj', 'files',
180+
# 'TMTPQ_MTmUDEpDGCLt_B1uaiJmwhCKZ729Ecxq6BPfM?filename=Neighborhoods_2012.zip'
181+
# )
182+
# download.file(shp_url, tmp)
183+
184+
# chicago = paste0('/vsizip/', tmp) |>
185+
# st_read(quiet = TRUE) |>
186+
# st_transform(crs = 4326L)
187+
188+
# artSF = gh_to_sf(
189+
# art[, .N, by = .(geohash = gh_encode(LATITUDE, LONGITUDE, 6L))],
190+
# gh_col = 'geohash'
191+
# )
192+
# plot(st_geometry(chicago), lwd = 0.5, main = 'Public Art Locations in Chicago')
193+
# plot(artSF['N'], add = TRUE)
194+
```
206195

207196
Chicago connoisseurs will recognize the biggest concentration around Lincoln Park, with another concentration along the waterfront near Millenium/Grant Parks.
208197

vignettes/geohashTools.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ gh_encode(11.3113917, -74.0779006, precision = 5L)
5151

5252
### Example: Encoding many points
5353

54-
We can use this as a simple, regular level of spatial aggregation for spatial points data, e.g., counting presence of public art throughout the city of Chicago, as captured in [this dataset](https://data.cityofchicago.org/Parks-Recreation/Parks-Public-Art/sj6t-9cju) provided by the City:
54+
We can use this as a simple, regular level of spatial aggregation for spatial points data. Here with randomly-selected coordinates:
5555

5656
```{r}
5757
coords = data.frame(

0 commit comments

Comments
 (0)