Skip to content

Commit 0d81841

Browse files
authored
Merge pull request #681 from SlideRuleEarth/carlos-dev3
fix export parquet as geo for atl03x-surface #680
2 parents dcff5be + 10eb1cd commit 0d81841

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

web-client/src/components/SrExportDialog.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,13 @@ async function exportParquet(fileName: string): Promise<boolean> {
212212
}
213213
214214
async function exportGeoParquet(fileName: string) : Promise<boolean> {
215-
const { url, options } = await getFetchUrlAndOptions(props.reqId, true, true);
215+
const { url, options } = await getFetchUrlAndOptions(props.reqId,true);
216216
217217
const wb = await getWritableFileStream(`${fileName}_GEO.parquet`, 'application/octet-stream');
218218
if (!wb) return false;
219219
220220
try {
221+
console.log('Fetching GeoParquet export:', url, options);
221222
const response = await fetch(url, {
222223
method: 'POST',
223224
body: options.body,

web-client/src/utils/fetchUtils.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,41 @@ import { Buffer } from 'buffer/';
66
// System Configuration
77
//
88
const sysConfigStore = useSysConfigStore();
9-
const jwtStore = useJwtStore();
109
export function forceGeoParquet(inputReqParms: any): any {
11-
console.log('forceGeoParquet:', inputReqParms, 'inputReqParms.parms.output:', inputReqParms.parms.output);
12-
if (
13-
inputReqParms &&
14-
typeof inputReqParms === 'object' &&
15-
inputReqParms.parms &&
16-
typeof inputReqParms.parms === 'object' &&
17-
inputReqParms.parms.output &&
18-
typeof inputReqParms.parms.output === 'object'
19-
) {
20-
inputReqParms.parms.output.as_geo = true;
10+
//There are different shapes for legacy atl06 and atl03x-surface
11+
console.log('forceGeoParquet:', inputReqParms, 'inputReqParms:', inputReqParms);
12+
13+
if(inputReqParms.as_geo !== undefined){
14+
inputReqParms.as_geo = true;
2115
} else {
22-
console.error('Invalid inputReqParms structure?:', inputReqParms);
16+
if (inputReqParms.parms){
17+
if(inputReqParms.parms.output){
18+
inputReqParms.parms.output.as_geo = true;
19+
} else {
20+
console.warn('forceGeoParquet: unrecognized shape for inputReqParms:', inputReqParms);
21+
}
22+
} else {
23+
console.warn('forceGeoParquet: unrecognized shape for inputReqParms:', inputReqParms);
24+
}
2325
}
24-
console.log('forceGeoParquet:', inputReqParms, 'as_geo:', inputReqParms.parms.output.as_geo);
26+
console.log('forceGeoParquet:', inputReqParms);
2527
return inputReqParms;
2628
}
2729

2830
export async function getFetchUrlAndOptions(
2931
reqid: number,
30-
isArrowFetch: boolean = false,
3132
forceAsGeo: boolean = false
3233
): Promise<{ url: string; options: RequestInit }> {
33-
const api = await db.getFunc(reqid);
34+
let api = await db.getFunc(reqid);
35+
if((api === 'atl03x-surface') || (api === 'atl03x-phoreal')){
36+
api = 'atl03x';
37+
}
3438
let parm = await db.getReqParams(reqid);
3539
if(forceAsGeo){
3640
parm = forceGeoParquet(parm);
3741
}
3842
const host = sysConfigStore.getOrganization() && (sysConfigStore.getOrganization() + '.' + sysConfigStore.getDomain()) || sysConfigStore.getDomain();
39-
const api_path = isArrowFetch ? 'arrow/' + api : 'source/api';
43+
const api_path = `source/${api}`;
4044
const url = 'https://' + host + '/' + api_path;
4145
//console.log('source url:', url);
4246
// Setup Request Options

0 commit comments

Comments
 (0)