/** * Search for physical features * * @param string $name * @param float $tolerance (tolerance for polygon simplification in degrees) */ private function getPhysical($name, $tolerance = 0) { $keyword = $this->context->dictionary->getKeyword($name, RestoDictionary::getPhysicals()); $query = 'SELECT name, featurecla as type, normalize(name) as normalized, ' . $this->getFormatFunction() . '(' . $this->simplify('geom', $tolerance, true) . ') as geometry FROM datasources.physical WHERE normalize(name)=normalize(\'' . $keyword['keyword'] . '\') order by name'; $output = array(); if (isset($keyword)) { $results = pg_query($this->dbh, $query); while ($row = pg_fetch_assoc($results)) { $output[] = array('name' => $this->context->dictionary->getKeywordFromValue($row['normalized'], $row['type']), 'type' => $row['type'], 'searchTerms' => $row['type'] . ':' . $row['normalized'], 'geo:geometry' => $this->outputAsWKT ? $row['geometry'] : json_decode($row['geometry'], true)); } } return $output; }
/** * Constructor * * @param RestoDatabaseDriver $dbDriver * @throws Exception */ public function __construct($dbDriver) { parent::__construct($dbDriver); }