protected function makeFromJSON($_json) { GeoProxy::log(LOG_DEBUG, __CLASS__, __FUNCTION__, "entering"); $gdat = new GeoGdat(); $geomfactory = new GeoGeomFactory(); $gadcfactory = new GeoGadcFactory(); $gdat->geometry = $geomfactory->make(new JSONGeoGeomFactoryData($_json['geometry'])); $gdat->formatted_address = $_json['formatted_address']; $gdat->types = $_json['types']; $gdat->lang = $_json['lang']; $gdat->ext = 0; foreach ($_json['address_components'] as $ad) { $gdat->address_components[] = $gadcfactory->make(new JSONGeoGadcFactoryData($ad)); } return $gdat; }
public function geomInRedis($_geom) { $index = 'idx:geomBySerial'; $serial = $_geom->computeSerial(); $key = $index . ':' . $serial; if (!$this->readConn->exists($key)) { return false; } // serial exists, deep comparison needed $ids = $this->readConn->sMembers($key); $geomfactory = new GeoGeomFactory(); foreach ($ids as $id) { $geomRedis = $geomfactory->make(new RedisGeoGeomFactoryData($this->readConn, $id)); if ($geomRedis->equals($_geom)) { return $id; } } return false; }