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

There might be something wrong with Kalimantan's boundaries #6

Open
j4p opened this issue Mar 28, 2022 · 1 comment
Open

There might be something wrong with Kalimantan's boundaries #6

j4p opened this issue Mar 28, 2022 · 1 comment

Comments

@j4p
Copy link

j4p commented Mar 28, 2022

Before going further, I'd like to put on a disclaimer that I'm not very well-versed in GIS.

I was using this geojson for a choropleth map in R.
For some reason, I couldn't get it to work properly: some areas seemed to be hidden.
I tried changing the color scale and found out that it was the color that represents the z-value that was leaking out, and not that some areas are hidden.

Here are the data that I used: leak_test.xlsx
I tried to use only the first few rows and found out that it worked well until the 19th row as you can see down below:
image
When I tried to include the 20th row, this happened:
image
As you can see from leak_test.xlsx, the 20th row has the province id of 61 (Kalimantan Barat).

The same process is done from the bottom.
Last 10 rows returned a perfectly fine plot:
image
But not the last 11 rows:
image
As you can also see from leak_test.xlsx, the 11th row from the bottom has the province id of 65 (Kalimantan Utara).

These findings led me to believe that there might be something wrong with Kalimantan's boundaries.

Libraries used:

  • tidyverse
  • plotly
  • readxl
  • rjson

The code if anyone is interested:

library(tidyverse)
library(plotly)
library(readxl)
library(rjson)

id_map <- fromJSON(file="https://raw.githubusercontent.com/ans-4175/peta-indonesia-geojson/master/indonesia-prov.geojson")
lt <- read_xlsx("leak_test.xlsx")
lt_subset <- head(lt, 19)
# lt_subset <- head(lt, 20)
# lt_subset <- tail(lt, 10)
# lt_subset <- tail(lt, 11)

plot_ly() %>%
  add_trace(
    type="choropleth",
    geojson=id_map,
    locations=lt_subset$Province,
    z=lt_subset$Value,
    colorscale="Viridis"
  ) %>%
  colorbar(title="Value") %>%
  layout(
    geo=list(
      fitbounds="locations",
      showcoastlines=FALSE),
    title="Province Value"
  )
@ans-4175
Copy link
Owner

Hi @j4p , thanks for your report. I believe its valid, since it's Kalimantan have multiple geojson polyfill. I will take a look at it

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