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

Choropleth example from documentation does not work #1621

Open
fa-bien opened this issue Dec 27, 2024 · 2 comments
Open

Choropleth example from documentation does not work #1621

fa-bien opened this issue Dec 27, 2024 · 2 comments

Comments

@fa-bien
Copy link

fa-bien commented Dec 27, 2024

I try to follow the example here, but I get errors:

  • GMT.mk_codes_values expects a Vector{String}, however paises[!, 2] is a Vector{String3}. Perhaps one solution would be to make GMT.mk_codes_values expect a Vector{AbstractString}? Converting it to a Vector{String} makes that call work.
  • The call to plot() a bit below fails:
ERROR: MethodError: no method matching palette_init(::Ptr{Nothing}, ::Vector{GMTdataset{Float64, 2}})
The function `palette_init` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  palette_init(::Ptr{Nothing}, ::GMTcpt)
   @ GMT ~/.julia/packages/GMT/3I1CI/src/gmt_main.jl:1245
  • Further down, the call countries = gmtread("/vsicurl/https://github.com/datasets/geo-countries/raw/master/data/countries.geojson") fails, because the master branch on that repository was renamed to main (this is an easy fix, just substitute master with main in the URL and it works).
@joa-quim
Copy link
Member

Thanks. Those examples are not rebuild on each docs update so the accumulated errors piled up unnoticed. For me it even errors before with

paises = CSV.File(HTTP.get("https://raw.githubusercontent.com/tillnagel/unfolding/master/data/data/countries-population-density.csv").body, delim=';') |> DataFrame;
ERROR: UndefVarError: `HTTP` not defined

I have to rewrite these examples as we now have the low resolution data directly in GMT se no need to download anything.

@joa-quim
Copy link
Member

I have fixed the bug in latest GMT.jl version but stump in a follow up problem. The truth is that I don't remember how that example has ever worked. The problem is that the number of levels (pod density) is different from the number of countries, which is normal since countries can have many polygons (think on islands). I must have had a solution to this in a previous version but can't find it. It seems that I must reinvent one.

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

2 participants