async function getLisaData(params){
const {gdaProxy, geojsonURL, geoJsonJoinCol, csvList, joinCols, names, tableName, columnName} = params;
const geoData = await loadJson(geojsonURL, gdaProxy)
const csvData = await Promise.all(
[
...csvList.map(csv => getCSV(csv)
.then(result => {return result}))
]
)
const joinedData = await simpleTabularJoin(
geoData.data.features.slice(),
geoJsonJoinCol,
csvData,
names,
joinCols
)
let orderedData = {}
joinedData.forEach(f => orderedData[f.properties[geoJsonJoinCol]] = f[tableName][columnName]);
const lisaData = getDataForLisa(orderedData, geoData.geoidIndex.geoidOrder)
const lisaValues = matchLisaValues(geoData.geoidIndex.indexOrder, getLisaValues(gdaProxy, geojsonURL.split('/').slice(-1,)[0], lisaData))
const naturalBreaks = await gdaProxy.custom_breaks(
geojsonURL.split('/').slice(-1,)[0],
'natural_breaks',
8,
null,
Object.values(orderedData)
);
const hingeBreaks = await gdaProxy.custom_breaks(
geojsonURL.split('/').slice(-1,)[0],
'hinge15_breaks',
6,
null,
Object.values(orderedData)
);
for (let i=0;i<geoData.data.features.length; i++){
geoData.data.features[i].lisaValue = lisaValues[geoData.data.features[i].properties.geoJsonJoinCol]
}
return {
geoData,
csvData,
lisaValues,
naturalBreaks,
hingeBreaks
}
}