{"id":19857464,"url":"https://github.com/stscl/geocn","last_synced_at":"2025-09-13T19:47:21.324Z","repository":{"id":251302090,"uuid":"837003621","full_name":"stscl/geocn","owner":"stscl","description":"Loads Spatial Data Sets of China","archived":false,"fork":false,"pushed_at":"2024-12-05T08:00:10.000Z","size":58572,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-02T02:38:41.593Z","etag":null,"topics":["china","china-region","geospatial-visualization","maps","r"],"latest_commit_sha":null,"homepage":"https://stscl.github.io/geocn/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stscl.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-02T02:37:11.000Z","updated_at":"2025-01-19T09:28:22.000Z","dependencies_parsed_at":"2024-12-05T08:38:46.109Z","dependency_job_id":null,"html_url":"https://github.com/stscl/geocn","commit_stats":null,"previous_names":["spatlyu/geocn","stscl/geocn"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/stscl/geocn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stscl%2Fgeocn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stscl%2Fgeocn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stscl%2Fgeocn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stscl%2Fgeocn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stscl","download_url":"https://codeload.github.com/stscl/geocn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stscl%2Fgeocn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275020168,"owners_count":25391650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["china","china-region","geospatial-visualization","maps","r"],"created_at":"2024-11-12T14:18:45.894Z","updated_at":"2025-09-13T19:47:21.297Z","avatar_url":"https://github.com/stscl.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"##\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\",\n  warning = FALSE,\n  message = FALSE\n)\n```\n\n# geocn \u003ca href=\"https://stscl.github.io/geocn/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"139\" alt=\"geocn website\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n\n[![CRAN](https://www.r-pkg.org/badges/version/geocn)](https://CRAN.R-project.org/package=geocn)\n[![R-universe](https://stscl.r-universe.dev/badges/geocn)](https://stscl.r-universe.dev/geocn)\n\n\u003c!-- badges: end --\u003e\n\nThe goal of **geocn** is to provide various commonly used spatial data related to Chinese regions in the R programming environment.\n\n## Installation\n\n- Install development binary version from [R-universe](https://stscl.r-universe.dev/geocn) with:\n\n``` r\ninstall.packages(\"geocn\", \n                 repos = c(\"https://stscl.r-universe.dev\",\n                           \"https://cloud.r-project.org\"),\n                 dep = TRUE)\n```\n\n- Install development source version from [GitHub](https://github.com/stscl/geocn) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"stscl/geocn\",\n                         build_vignettes = TRUE,\n                         dep = TRUE)\n```\n\n## Example\n\n### Drawing a Map of China Using `ggplot2`\n\n```{r map1,fig.width=9.5,fig.height=7.5,fig.dpi=120}\nlibrary(sf)\nlibrary(ggplot2)\nlibrary(cowplot)\nlibrary(geocn)\n\nalbers = load_cn_alberproj()\nprovince = load_cn_province()\ntenline = load_cn_tenline()\nocean = load_world_ocean()\nlakes = load_world_lake()\ncoastline = load_world_coastline()\n\nggplot() +\n  geom_sf(data = ocean,fill=\"#BEE8FF\",color=\"white\",size=.1) +\n  geom_sf(data = coastline,color=\"#252525\",size=.5) +\n  geom_sf(data = province,fill=\"white\",size=.1,color=\"grey\") + \n  geom_sf(data = lakes,fill=\"#BEE8FF\",color=\"white\",size=.1) +\n  geom_sf(data = tenline,size=.2,color=\"#9d98b7\") +\n  ggfx::with_shadow(geom_sf(data = tenline,size=.2,color=\"#9d98b7\") , \n                    sigma = 3,x_offset = -5,y_offset = -2) -\u003e fig1\n\nfig1 +\n  coord_sf(crs = albers,\n           ylim = c(1500000,6000000),\n           xlim = c(-3100000,2000000),\n           expand = FALSE) +\n  theme_bw() +\n  theme(plot.background = element_rect(\"grey97\", fill = NA),\n        axis.text = element_blank(),\n        axis.ticks = element_blank(),\n        axis.title = element_blank()) -\u003e china.main\n\nfig1 + \n  coord_sf(crs = albers,\n           ylim = c(273000,2800000),\n           xlim = c(-350000,1350000)) +\n  theme_minimal() +\n  theme(\n    axis.text = element_blank(),\n    axis.ticks = element_blank(),\n    axis.title = element_blank(),\n    panel.grid = element_blank(),\n    panel.background = element_rect(\"#BEE8FF\", color = NA),\n    panel.border = element_rect(fill=NA,\n                                linetype = 1,\n                                linewidth = 0.5),\n    plot.margin=unit(c(0,0,0,0),\"cm\")) -\u003e china.ocean\n\nggdraw() +\n  draw_plot(china.main) +\n  draw_plot(china.ocean,x = .815, y = .015,\n            width = .13, height = .20) -\u003e cnmap1\ncnmap1\n```\n\n### Drawing a Map of China Using `tmap`\n\n```{r ,fig.show='hide',fig.dpi=120}\nlibrary(sf)\nlibrary(tmap)\nlibrary(cowplot)\nlibrary(geocn)\n\nalbers = load_cn_alberproj()\ncn_border = load_cn_border()\nmain_border = load_cn_landcoast()\ntenline = load_cn_tenline()\nprovince = load_cn_province()\n\ntm_shape(main_border,\n         projection = albers) +\n  tm_lines(col = NA,lwd = 0.01) +\n  tm_shape(province) +\n  tm_fill(col = 'white',alpha = .5) +\n  tm_borders(col = 'grey40', lwd = 1.25) +\n  tm_shape(cn_border) +\n  tm_lines(col='#9d98b7',lwd = 2.5) +\n  tm_scale_bar(position = c(0.05,0.01),\n               width = 0.15,text.size = 1.05,\n               lwd = 2) +\n  tm_compass(position = c(0.05,0.9),\n             just = 'center',size = 1.5,\n             text.size = .65,show.labels = 1) +\n  tm_layout(legend.width = 0.75,\n            legend.text.size = 1,\n            legend.height = 1.75,\n            legend.position = c(0.045,0.075),\n            compass.type = \"arrow\",\n            fontfamily = \"serif\") -\u003e cn_mainplot\n\ntm_shape(tenline,\n         projection = albers) +\n  tm_lines(col=NA,lwd=0.01) +\n  tm_shape(province) +\n  tm_fill(col = 'white',alpha = .5) +\n  tm_borders(col = 'grey40', lwd = 1.25) +\n  tm_shape(cn_border) +\n  tm_lines(col='#9d98b7',lwd = 2.5) -\u003e cn_miniplot\n\nggdraw() +\n  draw_plot(tmap_grob(cn_mainplot)) +\n  draw_plot(tmap_grob(cn_miniplot),\n            halign = 0.5,valign = 0.5,\n            height = 0.2,\n            x = 0.427,\n            y = 0.019) -\u003e cnmap2\n```\n\n```{r map2,fig.width=7.25,fig.height=6,fig.dpi=120}\ncnmap2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstscl%2Fgeocn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstscl%2Fgeocn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstscl%2Fgeocn/lists"}