Newer
Older
osm-data / index2.js
@Your Name Your Name 1 day ago 1 KB index2
const geojson = "index.geojson";
 
var code = "0000";
var dir = "./";
var name = "";
 
var queryString = window.location.search;
if(queryString){
	queryString = queryString.substring(1);
	var parameters = queryString.split('&');
	for (var i = 0; i < parameters.length; i++) {
		var element = parameters[i].split('=');
		var paramName = decodeURIComponent(element[0]);
		var paramValue = decodeURIComponent(element[1]);
		if (paramName == "code") {
			code = paramValue;
		}
	}
}
 
function loadMap() {
	
	$.when(
		$.getJSON("index.json")
	).done(function(data1) {
		site = data1.site;
		
	    $(data1.list).each(function() {
			if (this.code == code) {
				dir = this.path + "/bldg/";
				name = this.name;
			}
	    });
 
		var title = document.getElementById("title");
		title.innerHTML = "PLATEAU OSMデータ : " + code + " " + name;
	    
		var table2str = dir + geojson + "<table>";
		$.when(
			$.getJSON(dir + geojson)
		).done(function(date2) {
			features = this.features;
		    $(features).each(function() {
				table2str = table2str + "<tr>";
				table2str = table2str + "<td>" + this.properties.path + "</td>";
				table2str = table2str + "</tr>";
		    });
		});
		table2str = table2str + "</table>";
		var table2 = document.getElementById("table2");
		table2.innerHTML = table2str;
	});
}