geocompx / geocompr

Geocomputation with R: an open source book
https://r.geocompx.org/
Other
1.59k stars 585 forks source link

Add code for front cover #1037

Closed BjnNowak closed 10 months ago

BjnNowak commented 10 months ago

Code for the front cover of the second edition

Nowosad commented 10 months ago

I like the new version.

I plan to look at the code it tomorrow and update it to the geocompr style.

Nowosad commented 10 months ago

Dear @BjnNowak @Robinlovelace @jannes-m -- I just cleaned and updated the code. I also have two questions:

  1. Do you prefer the "three palettes" version (top) or the "one palette" version (bottom) of the cover?
  2. Do you prefer keeping the names of African cities or removing it from the final cover?

test-map test-map-uc (1)

jannes-m commented 10 months ago

Excellent work from all of you, looks fantastic!!! I would go with the three-palette version and actually I would keep the names to make the Africa map less 'empty'.

BjnNowak commented 10 months ago

On my side:

eblondel commented 10 months ago

Hello, jumping into this, and congrats for this nice cover. Working daily with international boundaries, i'm wondering where you got the country & territories boundaries layer. Since we deal with a book cover on geospatial data, and that you display countries & territories boundaries, they are some boundary issues (e.g. Western Sahara, Abyei region, boundary Egypt/North Sudan) that might deserve to be addressed. In case you would like to fix these, and if I can support, let me know. Cheers

BjnNowak commented 10 months ago

Country boundaries are from Natural Earth. Issue may be related to Natural Earth position on this subject, as stated on their website : "'Natural Earth shows boundaries by default according to who controls the territory, versus de jure." ?

Nowosad commented 10 months ago

Regarding borders, do you have any suggestions on what could be done here @eblondel ?

Robinlovelace commented 10 months ago

On my side:

* I do prefer the "three palettes" version (top) because it allows to see more see the difference between the three types of map

* I think leaving the names illustrates an additional mapping technique.

:+1: to that, my preferences also.

Robinlovelace commented 10 months ago

Regarding the country borders, what are the specific issues? I think it's clear that the purpose here is to visualise some data, not to endorse any particular boundary. But if there's a quick way to improve the map as Jakub suggests let us know.

BjnNowak commented 10 months ago

One of my objectives with the proposal was to use as many "directly" accessible datasets as possible. Hence the TidyTuesday dataset for the cartogram and {rnaturalearth} for country boundaries. But if those boundaries are an issue, a quick fix would be to just change the source of the boundary files 'mp_with_countries' (L43 of Jakub's version)

@eblondel do you have any url to access a 'clean' vector file of country boundaries, with at least one column for country name and one for continent in the table of attribute?

eblondel commented 10 months ago

@BjnNowak They are more official sources of truth, although I understand the logic that you followed to get data using a data-oriented R package and the choice of rnaturalearth.

To reply to @Robinlovelace the matter is not to endorse any boundary obviously, but you publish a book on geospatial data, and the cover uses country/territory boundaries. I believe it would give more credit to this book if you display accurate boundaries. Again it's just a suggestion.

As datasources:

If you want to quickly compare boundaries between natural earth and UN source, you can see these views:

You can use this code:

require(ows4R)
WFS = WFSClient$new(url = "https://www.fao.org/fishery/geoserver/wfs", serviceVersion = "1.0.0", logger = "INFO")
boundaries = WFS$getFeatures("fifao:UN_intbnd_legacy")

Attributes give you countries/territories involved in the boundary (as ISO 3 code), and you also have the type of boundaries, in case you want to display it in different styles. I don't think it's really needed for your cover, but at least you will get more accurate boundaries. This layer is a relatively low resolution, probably enough for the cover. There is a higher resolution, but it might increase substantially the file size of your cover.

Cheers

BjnNowak commented 10 months ago

Thx for the file @eblondel

I kept Natural Earth vector for the continent selection, but used the new boundary files in the plot. See result below. Script still in my repo (including Jakub's latest modifications), I could make a new PR later if it's ok for you ?

cover_un_boundaries

Robinlovelace commented 10 months ago

Great work @BjnNowak we have our new cover! Let us know if you'd like to write a blog post about the process, see here for info: https://github.com/geocompx/geocompx.org/blob/main/post/2023/map-cover-competition/index.qmd We should do some kind of write-up.