GADM (https://gadm.org/data.html)

Hi, i wanted do load the swissmap JSON file from GADM into Scilab 2023.1. Level 0 works with 34kb. But Level 1 with unzipped 134kb crashes Scilab on windows 11. Could anyone confirm this, before making a Bug.

M.f.G. Pascal

[res, status] = http_get(“https://geodata.ucdavis.edu/gadm/gadm4.1/json/gadm41_CHE_1.json.zip","C:\Users\buehlpas\Documents\Scilab\gadm41_CHE_1.json.zip”);

[output,bOK]=dos(“cd C:\Users\buehlpas\Documents\Scilab\ && tar -xf gadm41_CHE_1.json.zip”);

result = fromJSON(“C:\Users\buehlpas\Documents\Scilab\gadm41_CHE_1.json”, “file”);

//[result, status] = http_get(“https://geodata.ucdavis.edu/gadm/gadm4.1/json/gadm41_CHE_0.json”, format=“JSON”);
//scale=3;
//coord_x=result.features.geometry.coordinates(1)(1)(:,1);
//coord_y=result.features.geometry.coordinates(1)(1)(:,2);

Hi Pascal
I can make these commands run fine, if I change to single-quotes (changing path to my user space):

→ [res, status] = http_get(‘https://geodata.ucdavis.edu/gadm/gadm4.1/json/gadm41_CHE_0.json.zip’,'D:\Userdata\Claus\Documents\Scilab\gadm41_CHE_1.json.zip’);

→ [output,bOK]=dos(‘cd D:\Userdata\Claus\Documents\Scilab && tar -xf gadm41_CHE_1.json.zip’);

result = fromJSON(‘D:\Userdata\Claus\Documents\Scilab\gadm41_CHE_0.json’, ‘file’);

Note how CHE_1 changes name to CHE_0 (not sure why, looks confusing, but that’s what is inside the ZIP file).

Cannot upload ZIP or JSON data? Have to do it this way
gadm41_CHE_1.json.zip.sod (40.0 KB)

but just remove sod, unzip the file and you have the JSON File from GADM

Thanks :slight_smile:

Tried with Scilab 2024.0 following code:

countries=["CHE"];
depth=["0","1","2","3"];
URL=["https://geodata.ucdavis.edu/gadm/gadm4.1/json/gadm41"];
path=fullfile(TMPDIR,"Messungen");
ending=[".csv",".svg",".json",".zip"];

[CHF_0, status]=http_get(URL(1)+"_"+countries(1)+"_"+depth(1)+ending(3), format="JSON");

[res, status]=http_get(URL(1)+"_"+countries(1)+"_"+depth(2)+ending(3)+ending(4),path(1)+"GADM");
files=decompress(res,path(1));
CHF_1=fromJSON(files, "file");

works, but fromJSON crashes?

Hello,

You are right, there is a crash (tested on Scilab 2024.0.0 macOS version). Can you take the time to create a Gitlab account and create an issue at Issues · scilab / scilab · GitLab? Please include your code above as modified (I have changed the path of the file so that anybody can copy/paste it).

S.

1 Like