https://github.com/mit-spatial-action/unknown_pleasur
Generates regular section cuts through a raster surface for a given extent.
https://github.com/mit-spatial-action/unknown_pleasur
joy-division mapping raster spatial-analysis visualization
Last synced: over 1 year ago
JSON representation
Generates regular section cuts through a raster surface for a given extent.
- Host: GitHub
- URL: https://github.com/mit-spatial-action/unknown_pleasur
- Owner: mit-spatial-action
- License: gpl-2.0
- Created: 2023-03-15T15:09:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-10T14:08:16.000Z (almost 3 years ago)
- Last Synced: 2025-01-11T01:11:09.260Z (over 1 year ago)
- Topics: joy-division, mapping, raster, spatial-analysis, visualization
- Language: R
- Homepage:
- Size: 2.11 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unknown PleasuR

Generates regular section cuts through a raster surface for a given extent. Produces results that look quite a lot like the cover of Joy Division's _Unknown Pleasures_ (1979). Also quite a lot like some of the work of the Harvard Laboratory for Computer Graphics and Spaital Analysis (RIP). Also, scholarly integrity requires that I say: [James Cheshire got here first.](https://jcheshire.com/resources/joy-division-population-surfaces-and-pioneering-electronic-cartography/)
General workflow looks like the below. (For a more thoroughly fleshed out example using real data, see `example.R`.) Assuming an `sf` dataframe containing polygons or multipolygons (`polygons`) and a raster surface (`raster`), this generates regularly spaced lines (`st_regular_lines()`) and effecitvely "drapes" them over a raster surface, returning either polygonal or linestring section cuts (`st_unknown_pleasures()`).
Orientation and number of cut lines is set through `get_dims()` which returns a set of parameters that are subsequently passed to `st_regular_lines()` and `st_unknown_pleasures()`.
```r
dims <- get_dims(polygons, n = 100, type = "vertical") # or "horizontal"
lines <- polygons %>%
st_union() %>%
st_regular_lines(
dims = dims,
mask = TRUE
)
unknown_pleasures <- lines %>%
st_unknown_pleasures(
raster,
dims = dims,
sample_size = 250,
bleed_factor = 3,
# Or "planar"
mode = "xyz",
# Strictly speaking, the "xyz" and polygon
# combination leaves you with closed LINESTRINGs
polygon = TRUE
) %>%
st_geometry() %>%
# We devized the "xyz" mode for export to 3D Modeling software (e.g.,
# Rhino), so we export to dxf.
st_write(
"test_polys.dxf",
delete_dsn = TRUE,
driver = "dxf"
)
```

```r
# Or, for more GIS-ready output...
unknown_pleasures <- lines %>%
st_unknown_pleasures(
raster,
dims = dims,
sample_size = 250,
bleed_factor = 3,
mode = "planar",
polygon = TRUE
) %>%
st_write(
"test_polys.geojson",
delete_dsn = TRUE
)
```
