Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide different resolutions (feature request) #17

Open
z3tt opened this issue Feb 6, 2023 · 4 comments
Open

Provide different resolutions (feature request) #17

z3tt opened this issue Feb 6, 2023 · 4 comments
Assignees

Comments

@z3tt
Copy link

z3tt commented Feb 6, 2023

Hi @dickoa et al, thanks for the package!

I think it would be great if other data variants with different resolutions / levels of detail would be available as well (called scale in the rnaturalearth package). I am aware that one can do it afterwards but would be nice to "just" have it available without any further processing.

Cheers,
Cédric

@DanRunfola
Copy link
Member

@z3tt In the new version of the package we hope to push soon, we have a "Simplified" toggle, which lets the user choose between the simplified and unsimplified files for each case. Is that what you're after?

(Also - I'm looking for testers of the updated package, so let me know if you're interested - [email protected] :) ).

@z3tt
Copy link
Author

z3tt commented Feb 6, 2023

Sounds as it's similar --- just trying to keep the computation time low and the borders clean when plotting e.g. the whole world.

@rohith4444
Copy link
Collaborator

Hi @z3tt @DanRunfola ,

Thank you for your feedback! I'm glad to hear that you're interested in the updated version of the package. Indeed, in the new version, we have included both simplified and unsimplified variants for each case. This toggle allows users to choose the level of detail they prefer, balancing computation time and the clarity of borders when plotting large geographical areas. Simplified one takes less time.

Below, you can see a comparison of the geometry between the simplified and unsimplified cases:

Screenshot from 2024-02-23 14-43-03

I hope this addresses your concerns and meets your needs.

Cheers,
Rohith

@z3tt
Copy link
Author

z3tt commented Jul 14, 2024

Hi @rohith4444, I was just using the simplified version for the global admin-0 level and realized it is still way too detailed. Looking at the object sizes of the simplified and unsimplified geodata both are actually identical.

library(ggplot2)
library(rgeoboundaries)
library(rmapshaper)

## using rgeoboundaries type options
world_detail <- rgeoboundaries::gb_adm0(type = "unsimplified")
world_simple <- rgeoboundaries::gb_adm0(type = "simplified")

object.size(world_detail)
#> 163002152 bytes
object.size(world_simple) ## same!
#> 163002152 bytes

ggplot(world_simple) + geom_sf() + theme_void() ## same for world_detail

I think with respect to file size, computing time, and "readability", a version with a level of detail like this would be useful:

## simplify borders with ms_simplify
world_simplified <- ms_simplify(world_detail, keep = .01, keep_shapes = TRUE)

object.size(world_simplified)
#> 1963160 bytes

ggplot(world_simplified) + geom_sf() + theme_void()

Or maybe even more simplified:

world_simplified <- ms_simplify(world_detail, keep = .004, keep_shapes = TRUE)

object.size(world_simplified)
#> 815272 bytes

ggplot(world_simplified) + geom_sf() + theme_void()

First and foremost, the two versions are the same on a global scale.
I am fine with creating those myself, however, it would be convenient to have these available as ready-to-use shapes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants