WikimapsAtlas/WikimapsAtlas-generator

master.makefile d3 returns error at makeMap

hugolpz opened this issue · 1 comments

Admin map, projected: Thu Sep 03 2020 12:26:54 GMT+0200 (Central European Summer Time)
Error: Uncaught [TypeError: Cannot read property 'objects' of undefined]
    at reportException (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:62:24)
    at innerInvokeEventListeners (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:333:9)
    at invokeEventListeners (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
    at XMLHttpRequestImpl._dispatch (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
    at fireAnEvent (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/helpers/events.js:18:36)
    at Request.<anonymous> (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:889:5)
    at Request.emit (events.js:327:22)
    at IncomingMessage.<anonymous> (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22) TypeError: Cannot read property 'objects' of undefined
    at makeMap (about:blank:467:49)
    at o (about:blank:21:257)
    at Object.<anonymous> (about:blank:21:205)
    at Object.t (about:blank:4:619)
    at XMLHttpRequest.u (about:blank:4:8330)
    at XMLHttpRequest.<anonymous> (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js:32:32)
    at innerInvokeEventListeners (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:318:25)
    at invokeEventListeners (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
    at XMLHttpRequestImpl._dispatch (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
    at fireAnEvent (/home/yug/Documents/projects_maps/make-modules-d/09_d3/node_modules/jsdom/lib/jsdom/living/helpers/events.js:18:36)
Cambodia_location_map,_admin_relief_(2020)-en.svg
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

makeMap is wikiatlas.js main function, called after loading the needed .json, .b64, etc.
Digging into wikiatlas.js for "makeMap", putting some console.log, I identified the breaking points.

// Runs code server or client side => raster images urls
var root= urlToData(title,nodejs); timer.now("Ready to load files");

var urls = [
	root+"/administrative.topo.json", // https://rugger-demast.codio.io/output/"
	root+"/color.jpg.b64",
	root+"/trans.png.b64", 
	root+"/waters.topo.json",
	root+"/elevations.topo.json"
];
console.log('URLS:', urls[0], urls[5])
console.log('URLS:', urls[0], urls[5])                                                  // THIS PRINTED OUT IN TERMINAL ... BUT!!!!![1]
 queue()
	.defer(d3.json, urls[0])	// timer.now("Load file: administrative");
	.defer(d3.text, urls[1])	// timer.now("Load file: color");
	.defer(d3.text, urls[2])	// timer.now("Load file: trans");
	.defer(d3.json, urls[3])	// timer.now("Load file: waters");
	.defer(d3.json, urls[4])	// timer.now("Load file: elevations");
	.await(makeMap); timer.now("Loaded files");
console.log('Queue():','/* **************************************** */')      // THIS PRINTED OUT IN TERMINAL

console.log() [1] printed out URLS: http://localhost:8080/output/Cambodia/administrative.topo.json undefined

Indeed, http://localhost:8080 is NOT running.

So in wikiatlas.js, I searched and replaced http://localhost:8080 by the correct active server http://127.0.0.1:8097/ printed into my $make -f master.makefile d3 terminal earlier. It gives :

function urlToData(name_,nodejs){
	var root;
	return root = nodejs? "http://127.0.0.1:8097/output/"+name_ : "../output/"+name_;
	console.log('root',root)
}

It now works ! 🌻 🚀