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

possibility of implementing geom_sf #167

Open
curioussavage opened this issue Jan 19, 2023 · 3 comments
Open

possibility of implementing geom_sf #167

curioussavage opened this issue Jan 19, 2023 · 3 comments

Comments

@curioussavage
Copy link

Hello!

I was just looking at the ggplot2 documentation and source trying to figure out how difficult it would be to implement the geom_sf and related dependencies in ggplotnim. Thought I would just ask here how difficult it would be.

@Vindaar
Copy link
Owner

Vindaar commented Jan 30, 2023

Hey,

sorry too busy at the moment and didn't look into Github. geom_sf is used to plot maps (country outlines etc.), right? I'd say it depends. The one thing that I've wondered in the past, but never looked up is how the data that represents the countries is actually structured. Depending on what it contains it might be quite simple. Or it may not be.
In addition one might want to implement different projections. Those are not too difficult in principle either, but it's possible one might want to restructure some code here or there for it (e.g. scTransformedData might not be flexible enough; not sure).

Anyhow, it's definitely not a trivial 1h task. If you could provide me with some references about how this kind of map data is usually represented, that would be much appreciated.

In case you feel like trying to implement something yourself, feel free to ping me on matrix/discord (better than github at the moment) and I'll try to help.

@pietroppeter
Copy link

I am also interested in these type of "geospatial" features and some time ago collected some references. Here is a brief summary of my notes on how this type of stuff is implemented in R:

  • the most common spatial data format used is called Simple Features (sounds like a very generic name but it is implicitly referring to geograhpic features) from what I can tell. It is a relatively recent standard (2004)
  • there is an R implementation of simple features in package sf (released on CRAN in 2017); particularly interesting are ref article, package vignettes and blog posts linked in that github readme
  • geom_sf was added in ggplot2 in release 3.0.0 (2018) and it took advantage of package sf from the start (it was the new thing replacing some sp stuff I have not yet researched but the sf article above tells more details). See PR by Hadley. Note that initially all sf related functionalities were in a single module and were later (2019) refactored in multiple modules.

from the above my take on how hard it is to add this feature in ggplotnim I would say that it definitely requires some work. In particular it seems that starting from an independent repo to provide sf functionalities could be a good option. I guess that as a first step one could define a minimal set of target plots that one would want to implement in the first release on sf-related functionalities and implement just what is needed (also to know what one would need to implement in sf package).

And to specify above the kind of interest I have is more on the happy-to-see-it-implemented side than on the I-plan-to-work-on-it side that (at least for this year), sorry! :)

@Vindaar
Copy link
Owner

Vindaar commented Jan 31, 2023

Thanks for the references! That's super valuable. :)

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