You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError(`Invalid coordinate in ${context}: latitude is ${latRaw}. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
275
+
}
276
+
if(lngRaw===undefined||lngRaw===null){
277
+
thrownewError(`Invalid coordinate in ${context}: longitude is ${lngRaw}. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
278
+
}
279
+
280
+
constlatNum=Number(latRaw);
281
+
constlngNum=Number(lngRaw);
282
+
283
+
if(isNaN(latNum)){
284
+
thrownewError(`Invalid coordinate in ${context}: latitude "${latRaw}" cannot be parsed as number. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
285
+
}
286
+
if(isNaN(lngNum)){
287
+
thrownewError(`Invalid coordinate in ${context}: longitude "${lngRaw}" cannot be parsed as number. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
288
+
}
289
+
290
+
if(!isFinite(latNum)){
291
+
thrownewError(`Invalid coordinate in ${context}: latitude ${latNum} is not finite. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
292
+
}
293
+
if(!isFinite(lngNum)){
294
+
thrownewError(`Invalid coordinate in ${context}: longitude ${lngNum} is not finite. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
295
+
}
296
+
297
+
if(latNum<-90||latNum>90){
298
+
thrownewError(`Invalid coordinate in ${context}: latitude ${latNum} is outside valid range [-90, 90]. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
299
+
}
300
+
if(lngNum<-180||lngNum>180){
301
+
thrownewError(`Invalid coordinate in ${context}: longitude ${lngNum} is outside valid range [-180, 180]. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
302
+
}
303
+
304
+
if(latNum===0&&lngNum===0){
305
+
thrownewError(`Invalid coordinate in ${context}: coordinates (0, 0) are likely invalid. Source: ${JSON.stringify({lat: latRaw,lng: lngRaw})}`);
306
+
}
307
+
308
+
return{lat: latNum,lng: lngNum};
309
+
}
310
+
268
311
asyncfunctionlogJSONData(){
269
312
// Get map data from global variable injected by Go template
0 commit comments