riatelab / cartography

Thematic Cartography for R
http://riatelab.github.io/cartography/docs/
398 stars 46 forks source link

Can cartography create curved road labels, and loop base maps of different extents? #84

Closed HMB3 closed 3 years ago

HMB3 commented 3 years ago

Hi,

Thanks for making the package, it's fantastic!

I work for a government agency in Australia, which makes many maps of political boundaries.

We need to make hundreds of maps with the same layers and symbology, but different extents. Previously this was done in ArcMap by hand, but we want to automate the process of creating the initial maps, which can then be edited by hand.

We are heavy R users, so if we can use Cartography instead of QGIS/Python, that would be great.

Also, we really need the road labels to bend with the curves in the road, as they do with the ArcMap annotation engine, EG :

image

image

image

Any advice would be greatly appreciated - I wanted to ask the experts as I haven't found an answer to this anywhere yet....

h

rCarto commented 3 years ago

Hello, cartography has been superseded by mapsf. It is easy to loop over different extents with mapsf:

library(mapsf)
#> Le chargement a nécessité le package : sf
#> Linking to GEOS 3.7.1, GDAL 3.1.2, PROJ 7.1.0
mtq <- mf_get_mtq()
par(mfrow = c(3,3))
for (i in 1:9){
  mf_theme(bg = "lightblue")
  mf_init(mtq[i,])
  mf_map(mtq, add = TRUE)
  mf_map(mtq[i,], add = TRUE, col = "tomato")
  mf_title(txt = mtq[[i, "LIBGEO"]])
  mf_scale()
}

Created on 2021-09-01 by the reprex package (v2.0.1)

Unfortunately it is not possible to render curved labels with mapsf (nor with cartography). I'll have a look at what is possible to do with R.

rCarto commented 3 years ago

This question in SO addresses the same problem, unfortunately without relevant answers. Feel free to reopen this issue if you find something.

rCarto commented 3 years ago

This solution is from maptools and for Lattice plots (not compatible with mapsf): https://procomun.wordpress.com/2012/12/29/label-placement-lattice/

image