tanaka

Tanaka Maps with R

https://github.com/riatelab/tanaka

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 2 committers (100.0%) from academic institutions
  • Institutional organization owner
    Organization riatelab has institutional domain (riate.cnrs.fr)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords

map r-package spatial tanaka
Last synced: 4 months ago · JSON representation ·

Repository

Tanaka Maps with R

Basic Info
Statistics
  • Stars: 81
  • Watchers: 4
  • Forks: 4
  • Open Issues: 0
  • Releases: 3
Topics
map r-package spatial tanaka
Created almost 7 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog Citation Codemeta

README.md

Tanaka

Cran version R-CMD-check Coverage status N. Download
Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.

Also called "relief contours method", "illuminated contour method" or "shaded contour lines method", the Tanaka method1 enhances the representation of topography on a map by using shaded contour lines. The result is a 3D-like map.

This package is a simplified implementation of the Tanaka method, north-west white contours represent illuminated topography and south-east black contours represent shaded topography. Even if the results are quite satisfactory, a more refined method could be used based on the Kennelly and Kimerling's paper2.

tanaka is a small package with two functions:

  • tanaka() uses a terra object and displays the map directly;
  • tanaka_contour() builds the isopleth polygon layer.

The contour lines creation relies on mapiso, spatial manipulation and display rely on sf.

Installation

  • From CRAN r install.packages("tanaka")

  • Development version on GitHub r require(remotes) install_github("riatelab/tanaka")

Demo

  • This example is based on the dataset shipped within the package. r library(tanaka) library(terra) ras <- rast(system.file("tif/elev.tif", package = "tanaka")) tanaka(ras, breaks = seq(80,400,20), legend.pos = "topright", legend.title = "Elevation\n(meters)")

  • This example is based on an elevation raster downloaded via elevatr. ```r library(tanaka) library(elevatr) library(terra)

    use elevatr to get elevation data

    ras <- getelevraster(locations = data.frame(x = c(6.7, 7), y = c(45.8,46)), z = 10, prj = "EPSG:4326", clip = "locations") ras <- rast(ras)

    custom color palette

    cols <- c("#F7E1C6", "#EED4C1", "#E5C9BE", "#DCBEBA", "#D3B3B6", "#CAA8B3", "#C19CAF", "#B790AB", "#AC81A7", "#A073A1", "#95639D", "#885497", "#7C4692", "#6B3D86", "#573775", "#433266", "#2F2C56", "#1B2847")

    display the map

    tanaka(ras, breaks = seq(500,4800,250), col = cols) ```

  • The last example illustrates the use of tanaka with non-topographical data. This map is based on the Global Human Settlement Population Grid (1km).

```r library(terra) library(sf) library(tanaka) library(mapsf)

Download

tempzip <- tempfile() tempfolder <- tempdir() dataurl <- paste0("http://cidportal.jrc.ec.europa.eu/ftp/jrc-opendata/GHSL/", "GHSPOPGPW4GLOBER2015A/GHSPOPGPW42015GLOBER2015A540091k/", "V1-0/GHSPOPGPW42015GLOBER2015A540091kv10.zip") download.file(dataurl, tempzip) unzip(tempzip, exdir = tempfolder)

Import

pop2015 <- rast(paste0(tempfolder, "/GHSPOPGPW42015GLOBER2015A540091kv10/", "GHSPOPGPW42015GLOBER2015A540091kv10.tif"))

Mask raster

center <- stassf(data.frame(x=425483.8, y=5608290), coords=(c("x","y")), crs = stcrs(pop2015)) center <- stbuffer(center, dist = 800000) ras <- crop(pop2015, st_bbox(center)[c(1,3,2,4)])

Smooth values

mat <- focalMat(x = ras, d = c(10000), type = "Gauss") rassmooth <- focal(x = ras, w = mat, fun = sum, na.rm = TRUE)

Map

bks <- c(0,25,50,100,250,500,750,1000,1750,2500,5000, 7500,10000) mfexport(x = center, filename = "circle.png", width = 800, res = 100) tanaka(x = rassmooth, breaks = bks, mask = center, col = hcl.colors(n = 12, palette = "Inferno"), shift = 2500, add = TRUE, legend.pos = "topleft", legend.title = "Inhabitants\nper km2") mfmap(center, add = TRUE, border = "white", col = NA, lwd = 6) mftitle(txt = "Smoothed Population Density") mfcredits(paste0("T. Giraud, 2022\n", "Data : European Commission, Joint Research Centre (JRC); ", "Columbia University, CIESIN (2015): GHS population grid, ", "derived from GPW4.")) text(-250000 ,6420000, "Gaussian filter, sigma = 10km", adj = 0, font = 3, cex = .8, xpd = TRUE ) dev.off() ```

Alternative Package

The metR package allows to draw Tanaka contours with ggplot2.


1: Tanaka, K. (1950). The relief contour method of representing topography on maps. Geographical Review, 40(3), 444-456.
2: Kennelly, P., & Kimerling, A. J. (2001). Modifications of Tanaka's illuminated contour method. Cartography and Geographic Information Science, 28(2), 111-123.

Owner

  • Name: riatelab
  • Login: riatelab
  • Kind: organization
  • Location: Paris

Spatial analysis and mapping software packages created by the Center for Spatial Analysis and Geovisualization - RIATE

Citation (CITATION.cff)

# -----------------------------------------------------------
# CITATION file created with {cffr} R package, v0.5.0
# See also: https://docs.ropensci.org/cffr/
# -----------------------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "tanaka" in publications use:'
type: software
license: GPL-3.0-only
title: 'tanaka: Design Shaded Contour Lines (or Tanaka) Maps'
version: 0.4.0
abstract: The Tanaka method enhances the representation of topography on a map using
  shaded contour lines. In this simplified implementation of the method, north-west
  white contours represent illuminated topography and south-east black contours represent
  shaded topography. See Tanaka (1950) <doi:10.2307/211219>.
authors:
- family-names: Giraud
  given-names: Timothée
  email: timothee.giraud@cnrs.fr
  orcid: https://orcid.org/0000-0002-1932-3323
repository: https://CRAN.R-project.org/package=tanaka
repository-code: https://github.com/riatelab/tanaka/issues/
url: https://github.com/riatelab/tanaka/
contact:
- family-names: Giraud
  given-names: Timothée
  email: timothee.giraud@cnrs.fr
  orcid: https://orcid.org/0000-0002-1932-3323
references:
- type: software
  title: terra
  abstract: 'terra: Spatial Data Analysis'
  notes: Imports
  url: https://rspatial.org/
  repository: https://CRAN.R-project.org/package=terra
  authors:
  - family-names: Hijmans
    given-names: Robert J.
    email: r.hijmans@gmail.com
    orcid: https://orcid.org/0000-0001-5872-2872
  year: '2023'
- type: software
  title: sf
  abstract: 'sf: Simple Features for R'
  notes: Imports
  url: https://r-spatial.github.io/sf/
  repository: https://CRAN.R-project.org/package=sf
  authors:
  - family-names: Pebesma
    given-names: Edzer
    email: edzer.pebesma@uni-muenster.de
    orcid: https://orcid.org/0000-0001-8049-7069
  year: '2023'
- type: software
  title: mapiso
  abstract: 'mapiso: Create Contour Polygons from Regular Grids'
  notes: Imports
  url: https://github.com/riatelab/mapiso
  repository: https://CRAN.R-project.org/package=mapiso
  authors:
  - family-names: Giraud
    given-names: Timothée
    email: timothee.giraud@cnrs.fr
    orcid: https://orcid.org/0000-0002-1932-3323
  year: '2023'
- type: software
  title: maplegend
  abstract: 'maplegend: Legends for Maps'
  notes: Imports
  url: https://github.com/riatelab/maplegend/
  repository: https://CRAN.R-project.org/package=maplegend
  authors:
  - family-names: Giraud
    given-names: Timothée
    email: timothee.giraud@cnrs.fr
    orcid: https://orcid.org/0000-0002-1932-3323
  year: '2023'
- type: software
  title: grDevices
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  location:
    name: Vienna, Austria
  year: '2023'
  institution:
    name: R Foundation for Statistical Computing
- type: software
  title: graphics
  abstract: 'R: A Language and Environment for Statistical Computing'
  notes: Imports
  authors:
  - name: R Core Team
  location:
    name: Vienna, Austria
  year: '2023'
  institution:
    name: R Foundation for Statistical Computing
- type: software
  title: tinytest
  abstract: 'tinytest: Lightweight and Feature Complete Unit Testing Framework'
  notes: Suggests
  url: https://github.com/markvanderloo/tinytest
  repository: https://CRAN.R-project.org/package=tinytest
  authors:
  - family-names: van der Loo
    given-names: Mark
    email: mark.vanderloo@gmail.com
    orcid: https://orcid.org/0000-0002-9807-4686
  year: '2023'
- type: software
  title: covr
  abstract: 'covr: Test Coverage for Packages'
  notes: Suggests
  url: https://covr.r-lib.org
  repository: https://CRAN.R-project.org/package=covr
  authors:
  - family-names: Hester
    given-names: Jim
    email: james.f.hester@gmail.com
  year: '2023'
- type: software
  title: lwgeom
  abstract: 'lwgeom: Bindings to Selected ''liblwgeom'' Functions for Simple Features'
  notes: Suggests
  url: https://github.com/r-spatial/lwgeom/
  repository: https://CRAN.R-project.org/package=lwgeom
  authors:
  - family-names: Pebesma
    given-names: Edzer
    email: edzer.pebesma@uni-muenster.de
    orcid: https://orcid.org/0000-0001-8049-7069
  year: '2023'

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "tanaka",
  "description": "The Tanaka method enhances the representation of topography on a map using shaded contour lines. In this simplified implementation of the method, north-west white contours represent illuminated topography and south-east black contours represent shaded topography. See Tanaka (1950) <doi:10.2307/211219>.",
  "name": "tanaka: Design Shaded Contour Lines (or Tanaka) Maps",
  "codeRepository": "https://github.com/riatelab/tanaka/",
  "issueTracker": "https://github.com/riatelab/tanaka/issues/",
  "license": "https://spdx.org/licenses/GPL-3.0",
  "version": "0.4.0",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.3.2 (2023-10-31)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Timothe",
      "familyName": "Giraud",
      "email": "timothee.giraud@cnrs.fr",
      "@id": "https://orcid.org/0000-0002-1932-3323"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "tinytest",
      "name": "tinytest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tinytest"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "covr",
      "name": "covr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=covr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "lwgeom",
      "name": "lwgeom",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=lwgeom"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "terra",
      "name": "terra",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=terra"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "sf",
      "name": "sf",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=sf"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "mapiso",
      "name": "mapiso",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=mapiso"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "maplegend",
      "name": "maplegend",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=maplegend"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "grDevices",
      "name": "grDevices"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "graphics",
      "name": "graphics"
    },
    "SystemRequirements": null
  },
  "fileSize": "630.085KB"
}

GitHub Events

Total
  • Watch event: 3
Last Year
  • Watch event: 3

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 58
  • Total Committers: 2
  • Avg Commits per committer: 29.0
  • Development Distribution Score (DDS): 0.172
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
rCarto t****d@c****r 48
rCarto t****d@c****r 10
Committer Domains (Top 20 + Academic)
cnrs.fr: 2

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 4
  • Total pull requests: 1
  • Average time to close issues: 15 days
  • Average time to close pull requests: 33 minutes
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 4.25
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • edzer (2)
  • beroe (1)
  • rsbivand (1)
Pull Request Authors
  • rCarto (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 426 last-month
  • Total docker downloads: 21,613
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 10
  • Total maintainers: 1
proxy.golang.org: github.com/riatelab/tanaka
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Stargazers count: 5.6%
Dependent repos count: 5.7%
Average: 6.4%
Forks count: 8.8%
Last synced: 4 months ago
cran.r-project.org: tanaka

Design Shaded Contour Lines (or Tanaka) Maps

  • Versions: 7
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 426 Last month
  • Docker Downloads: 21,613
Rankings
Stargazers count: 5.0%
Forks count: 14.4%
Dependent packages count: 17.7%
Average: 21.9%
Dependent repos count: 24.4%
Downloads: 48.1%
Maintainers (1)
Last synced: 4 months ago

Dependencies

DESCRIPTION cran
  • grDevices * imports
  • graphics * imports
  • mapiso * imports
  • sf * imports
  • terra * imports
  • covr * suggests
  • lwgeom * suggests
  • tinytest * suggests
.github/workflows/check-standard.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite