File tree 3 files changed +33
-9
lines changed
packages/spatial-uploads-handler/src
3 files changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ export async function geostatsForVectorLayers(
68
68
hasZ : false ,
69
69
} as GeostatsLayer ;
70
70
const dataset = await gdal . openAsync ( filepath ) ;
71
+ if ( dataset . srs === null ) {
72
+ throw new Error ( "No spatial reference system found in dataset." ) ;
73
+ }
71
74
dataset . layers . forEach ( ( lyr , lidx ) => {
72
75
const extent = lyr . getExtent ( ) ;
73
76
if ( extent ) {
Original file line number Diff line number Diff line change @@ -232,7 +232,6 @@ export default async function handleUpload(
232
232
}
233
233
}
234
234
if ( ! sourceUrl ) {
235
- console . log ( outputs ) ;
236
235
throw new Error ( "No sourceUrl found" ) ;
237
236
}
238
237
@@ -242,14 +241,6 @@ export default async function handleUpload(
242
241
await putObject ( logPath , s3LogPath , logger ) ;
243
242
const geostats = Array . isArray ( stats ) ? stats [ 0 ] : stats ;
244
243
245
- console . log (
246
- "buliding response" ,
247
- outputs . map ( ( o ) => ( {
248
- ...o ,
249
- local : undefined ,
250
- filename : o . filename ,
251
- } ) )
252
- ) ;
253
244
const response : { layers : ProcessedUploadLayer [ ] ; logfile : string } = {
254
245
layers : [
255
246
{
Original file line number Diff line number Diff line change @@ -94,6 +94,36 @@ export async function processVectorUpload(options: {
94
94
"Problem finding shapefile in zip archive" ,
95
95
1 / 30
96
96
) ;
97
+
98
+ // Make sure there is also a .prj projection file
99
+ const projFile = await logger . exec (
100
+ [
101
+ "find" ,
102
+ [
103
+ workingDirectory ,
104
+ "-type" ,
105
+ "f" ,
106
+ "-not" ,
107
+ "-path" ,
108
+ "*/.*" ,
109
+ "-not" ,
110
+ "-path" ,
111
+ "*/__" ,
112
+ "-name" ,
113
+ "*.prj" ,
114
+ ] ,
115
+ ] ,
116
+ "Problem finding projection file (.prj) in zip archive" ,
117
+ 1 / 30
118
+ ) ;
119
+
120
+ if ( ! projFile ) {
121
+ throw new Error ( "No projection file found (.prj) in zip archive" ) ;
122
+ }
123
+ if ( ! shapefile ) {
124
+ throw new Error ( "No shape-file (.shp) found in zip archive" ) ;
125
+ }
126
+
97
127
// Consider that there may be multiple shapefiles in the zip archive
98
128
// and choose the first one
99
129
workingFilePath = shapefile . split ( "\n" ) [ 0 ] . trim ( ) ;
You can’t perform that action at this time.
0 commit comments