mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-21 19:41:23 +01:00
added geographic data to burgs CSV export
This commit is contained in:
parent
ee70be134f
commit
2df9f02440
1 changed files with 8 additions and 4 deletions
|
|
@ -252,7 +252,7 @@ function editBurgs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadBurgsData() {
|
function downloadBurgsData() {
|
||||||
let data = "Id,Burg,State,Culture,Population,Capital,Port\n"; // headers
|
let data = "Id,Burg,State,Culture,Population,Capital,Port,Longitude,Latitude,Elevation\n"; // headers
|
||||||
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
||||||
|
|
||||||
valid.forEach(b => {
|
valid.forEach(b => {
|
||||||
|
|
@ -262,7 +262,12 @@ function editBurgs() {
|
||||||
data += pack.cultures[b.culture].name + ",";
|
data += pack.cultures[b.culture].name + ",";
|
||||||
data += rn(b.population * populationRate.value * urbanization.value) + ",";
|
data += rn(b.population * populationRate.value * urbanization.value) + ",";
|
||||||
data += b.capital ? "capital," : ",";
|
data += b.capital ? "capital," : ",";
|
||||||
data += b.port ? "port\n" : "\n";
|
data += b.port ? "port," : ",";
|
||||||
|
|
||||||
|
// add geography data
|
||||||
|
data += (b.x / graphWidth) * mapCoordinates.lonT + mapCoordinates.lonW + ",";
|
||||||
|
data += (b.y / graphHeight) * mapCoordinates.latT + mapCoordinates.latS + ",";
|
||||||
|
data += parseInt(getFriendlyHeight(pack.cells.h[b.cell])) + "\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
const dataBlob = new Blob([data], {type: "text/plain"});
|
const dataBlob = new Blob([data], {type: "text/plain"});
|
||||||
|
|
@ -315,7 +320,7 @@ function editBurgs() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fileReader.readAsText(fileToLoad, "UTF-8");
|
fileReader.readAsText(fileToLoad, "UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,4 +344,3 @@ function editBurgs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue