From ab6ea0a219bee005f556f00c60751912b1ce72d5 Mon Sep 17 00:00:00 2001 From: Edward Gilbert Date: Wed, 7 Apr 2021 16:05:13 -0400 Subject: [PATCH] Occurrence Batch Georeferencing - Exclude trimmed empty strings that were not filtered out by NULL values within the SQL query --- classes/OccurrenceGeorefTools.php | 42 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/classes/OccurrenceGeorefTools.php b/classes/OccurrenceGeorefTools.php index 83694f6631..3ee8d00d5d 100644 --- a/classes/OccurrenceGeorefTools.php +++ b/classes/OccurrenceGeorefTools.php @@ -85,26 +85,28 @@ public function getLocalityArr(){ if($countryStr != trim($r->country) || $stateStr != trim($r->stateprovince) || $countyStr != trim($r->county) || $municipalityStr != trim($r->municipality) || $localityStr != trim($r->locality," .,;") || $verbCoordStr != trim($r->verbatimcoordinates) || $decLatStr != $r->decimallatitude || $decLngStr != $r->decimallongitude){ - $countryStr = trim($r->country); - $stateStr = trim($r->stateprovince); - $countyStr = trim($r->county); - $municipalityStr = trim($r->municipality); - $localityStr = trim($r->locality," .,;"); - $verbCoordStr = trim($r->verbatimcoordinates); - $decLatStr = $r->decimallatitude; - $decLngStr = $r->decimallongitude; - $totalCnt++; - $retArr[$totalCnt]['occid'] = $r->occid; - $retArr[$totalCnt]['country'] = $countryStr; - $retArr[$totalCnt]['stateprovince'] = $stateStr; - $retArr[$totalCnt]['county'] = $countyStr; - $retArr[$totalCnt]['municipality'] = $municipalityStr; - $retArr[$totalCnt]['locality'] = $localityStr; - $retArr[$totalCnt]['verbatimcoordinates'] = $verbCoordStr; - $retArr[$totalCnt]['decimallatitude'] = $decLatStr; - $retArr[$totalCnt]['decimallongitude'] = $decLngStr; - $retArr[$totalCnt]['cnt'] = 1; - $locCnt = 1; + $localityStr = trim($r->locality,' .,;'); + $verbCoordStr = trim($r->verbatimcoordinates,' .,;'); + if($localityStr && $verbCoordStr){ + $countryStr = trim($r->country); + $stateStr = trim($r->stateprovince); + $countyStr = trim($r->county); + $municipalityStr = trim($r->municipality); + $decLatStr = $r->decimallatitude; + $decLngStr = $r->decimallongitude; + $totalCnt++; + $retArr[$totalCnt]['occid'] = $r->occid; + $retArr[$totalCnt]['country'] = $countryStr; + $retArr[$totalCnt]['stateprovince'] = $stateStr; + $retArr[$totalCnt]['county'] = $countyStr; + $retArr[$totalCnt]['municipality'] = $municipalityStr; + $retArr[$totalCnt]['locality'] = $localityStr; + $retArr[$totalCnt]['verbatimcoordinates'] = $verbCoordStr; + $retArr[$totalCnt]['decimallatitude'] = $decLatStr; + $retArr[$totalCnt]['decimallongitude'] = $decLngStr; + $retArr[$totalCnt]['cnt'] = 1; + $locCnt = 1; + } } else{ $locCnt++;