/** Function for processing findspot * @access protected * @param array $data * @return array */ protected function _processFindspot(array $data) { if (is_array($data)) { $conversion = new Pas_Geo_Gridcalc($data['gridref']); $results = $conversion->convert(); $data['longitude'] = $results['decimalLatLon']['decimalLongitude']; $data['latitude'] = $results['decimalLatLon']['decimalLatitude']; $data['easting'] = $results['easting']; $data['northing'] = $results['northing']; $data['map10k'] = $results['10kmap']; $data['map25k'] = $results['25kmap']; $data['fourFigure'] = $results['fourFigureGridRef']; return $data; } else { return $data; } }
/** Function for processing findspot * * @param array $data */ protected function _processFindspot($data) { if (is_array($data)) { $conversion = new Pas_Geo_Gridcalc($data['gridref']); $results = $conversion->convert(); $place = new Pas_Service_Geo_Geoplanet($this->_appid); $geoHash = new Pas_Geo_Hash(); $hash = $geoHash->encode($results['decimalLatLon']['decimalLatitude'], $results['decimalLatLon']['decimalLongitude']); $data['declong'] = $results['decimalLatLon']['decimalLongitude']; $data['declat'] = $results['decimalLatLon']['decimalLatitude']; $data['easting'] = $results['easting']; $data['northing'] = $results['northing']; $data['map10k'] = $results['10kmap']; $data['map25k'] = $results['25kmap']; $data['fourFigure'] = $results['fourFigureGridRef']; $data['accuracy'] = $results['accuracy']['precision']; $data['gridlen'] = $results['gridrefLength']; $data['geohash'] = $hash; $yahoo = $place->reverseGeoCode($results['decimalLatLon']['decimalLatitude'], $results['decimalLatLon']['decimalLongitude']); $data['woeid'] = $yahoo['woeid']; return $data; } else { return $data; } }
/** Function for processing findspot * @access public * @param array $data * @return array The final data array * @throw Zend_Exception */ protected function _processFindspot(array $data) { if (is_array($data)) { $conversion = new Pas_Geo_Gridcalc($data['gridref']); $results = $conversion->convert(); $fourFigure = new Pas_Geo_Gridcalc($results['fourFigureGridRef']); $fourFigureData = $fourFigure->convert(); //$place = new Pas_Service_Geo_GeoPlanet($this->_appid); $geoHash = new Pas_Geo_Hash(); $hash = $geoHash->encode($results['decimalLatLon']['decimalLatitude'], $results['decimalLatLon']['decimalLongitude']); $data['declong'] = $results['decimalLatLon']['decimalLongitude']; $data['declat'] = $results['decimalLatLon']['decimalLatitude']; $data['easting'] = $results['easting']; $data['northing'] = $results['northing']; $data['map10k'] = $results['10kmap']; $data['map25k'] = $results['25kmap']; $data['fourFigure'] = $results['fourFigureGridRef']; $data['accuracy'] = $results['accuracy']['precision']; $data['gridlen'] = $results['gridrefLength']; $data['geohash'] = $hash; $data['fourFigureLat'] = $fourFigureData['decimalLatLon']['decimalLatitude']; $data['fourFigureLon'] = $fourFigureData['decimalLatLon']['decimalLongitude']; //$yahoo = $place->reverseGeoCode($results['decimalLatLon']['decimalLatitude'], // $results['decimalLatLon']['decimalLongitude']); //$data['woeid'] = $yahoo['woeid']; $elevate = new Pas_Service_Geo_Elevation($this->_gmaps); $data['elevation'] = $elevate->getElevation($data['declong'], $data['declat']); $words = new Pas_Service_What3words(); $words->setApiKey($this->_config->webservice->what3words->apikey); $threewords = $words->positionToWords(array($data['fourFigureLat'], $data['fourFigureLon'])); $data['what3words'] = $threewords->words; } else { throw new Zend_Exception('Data is not an array', 500); } return $data; }