@@ -535,35 +535,39 @@ class ParatooService {
535
535
// used by protocols like bird survey where a point represents a sight a bird has been observed in a
536
536
// bird survey plot
537
537
def location = output[model. name]
538
- if (location instanceof Map ) {
539
- output[model. name] = [
540
- type : ' Feature' ,
541
- geometry : [
542
- type : ' Point' ,
543
- coordinates : [location. lng, location. lat]
544
- ],
545
- properties : [
546
- name : " Point ${ formName} -${ featureId} " ,
547
- externalId : location. id,
548
- id : " ${ formName} -${ featureId} "
549
- ]
550
- ]
551
- }
552
- else if (location instanceof List ) {
553
- String name
554
- switch (config?. geometryType) {
555
- case " LineString" :
556
- name = " LineString ${ formName} -${ featureId} "
557
- output[model. name] = ParatooProtocolConfig . createLineStringFeatureFromGeoJSON (location, name, null , name)
558
- break
559
- default :
560
- name = " Polygon ${ formName} -${ featureId} "
561
- output[model. name] = ParatooProtocolConfig . createFeatureFromGeoJSON (location, name, null , name)
562
- break
538
+ if (location) {
539
+ if (location instanceof Map ) {
540
+ output[model. name] = [
541
+ type : ' Feature' ,
542
+ geometry : [
543
+ type : ' Point' ,
544
+ coordinates : [location. lng, location. lat]
545
+ ],
546
+ properties : [
547
+ name : " Point ${ formName} -${ featureId} " ,
548
+ externalId : location. id,
549
+ id : " ${ formName} -${ featureId} "
550
+ ]
551
+ ]
552
+ } else if (location instanceof List ) {
553
+ String name
554
+ switch (config?. geometryType) {
555
+ case " LineString" :
556
+ name = " LineString ${ formName} -${ featureId} "
557
+ output[model. name] = ParatooProtocolConfig . createLineStringFeatureFromGeoJSON(location, name, null , name)
558
+ break
559
+ default :
560
+ name = " Polygon ${ formName} -${ featureId} "
561
+ output[model. name] = ParatooProtocolConfig . createFeatureFromGeoJSON(location, name, null , name)
562
+ break
563
+ }
563
564
}
564
- }
565
565
566
- featureId ++
566
+ featureId ++
567
+ }
568
+ else {
569
+ output[model. name] = null
570
+ }
567
571
break
568
572
case " image" :
569
573
case " document" :
0 commit comments