Skip to content

Instantly share code, notes, and snippets.

@mrjoh3
Last active November 1, 2018 21:46
Show Gist options
  • Save mrjoh3/a25043590996528567e3ac30d4398560 to your computer and use it in GitHub Desktop.
Save mrjoh3/a25043590996528567e3ac30d4398560 to your computer and use it in GitHub Desktop.
Copy of Rmd used in Radix blog
---
title: "Industry Area"
description: "industrial estates"
author:
- name: Jane Doe
url: http://localhost:9999/index.html
date: August 10 2018
client:
- 'John Doe'
categories:
- industry
- assessment
- impact
output:
radix::radix_article:
self_contained: false
preview: webshot.png
---
```{r, child=paste0(here::here(), "/_drafts/_setup.Rmd")}
```
```{r, echo=TRUE, eval=TRUE}
library(howfar) # in house package used to setup DB connection
library(sf)
con <- howfar::con_postgresql()
```
## Industrial Estates ('IN1Z', 'IN2Z', 'IN3Z')
```{sql query, connection=con, echo=TRUE, eval=TRUE, output.var="ind"}
select id, lga, zone_code, ST_AsText(geom) AS wkt
from plan_zone
where zone_code in ('IN1Z', 'IN2Z', 'IN3Z');
```
## Map
```{r, layout="l-screen-inset"}
ind <- st_as_sf(ind, wkt = 'wkt', crs = 4283)
map <- mapview::mapview(ind, zcol = "zone_code")
map@map
```
```{r preview, echo=FALSE, warning=FALSE, error=FALSE, include=FALSE}
htmlwidgets::saveWidget(map@map, 'preview.html')
webshot::webshot('preview.html')
```
```{r, child=paste0(here::here(), "/_drafts/_sessioninfo.Rmd")}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment