peta-indonesia-geojson icon indicating copy to clipboard operation
peta-indonesia-geojson copied to clipboard

There might be something wrong with Kalimantan's boundaries

Open j4p opened this issue 2 years ago • 1 comments

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"
  )

j4p avatar Mar 28 '22 11:03 j4p

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

ans-4175 avatar May 15 '22 18:05 ans-4175