【问题标题】:Error in tmap projection: invalid crs: hdtmap 投影错误:无效 crs:hd
【发布时间】:2022-05-08 17:42:58
【问题描述】:

当我尝试用 Hobo-Dyer 投影绘制地图时,它告诉我:

Error in st_crs.character(x[[shape.id[masterID]]]$projection) : invalid crs: hd

这是我的代码:

tm_shape(countries_spdf, projection = "hd") +
  tm_grid(n.x = 11, n.y = 11) +
  tm_fill(col = "population", style = "quantile")  +
  tm_borders(col = "burlywood4") 

我该怎么办?

【问题讨论】:

    标签: tmap


    【解决方案1】:

    我相信 tm_shape 的投影功能已更改为仅采用表示所需 CRS 的整数。即它仍然适用于行业中最常见的 4326。但是有一个使用 ggplot 库中的 coord_map 的解决方法,我在下面包含:

    tm_shape(countries_spdf, projection = 4326) +
      tm_grid(n.x = 11, n.y = 11) +
      tm_fill(col = "population", style = "quantile")  +
      tm_borders(col = "burlywood4")
    
    tm_shape(countries_spdf, projection = coord_map("hr")) +
      tm_grid(n.x = 11, n.y = 11) +
      tm_fill(col = "population", style = "quantile")  +
      tm_borders(col = "burlywood4")
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 2020-09-18
      • 2021-05-15
      • 2022-01-11
      • 1970-01-01
      • 2015-04-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-14
      • 1970-01-01
      相关资源
      最近更新 更多