Skip to content

Commit

Permalink
Upgrade to iTag v3.0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrom committed Apr 19, 2018
1 parent a7ef168 commit f973475
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/iTag/Taggers/Tagger_Always.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,4 @@ private function hasResults($query) {
}
return true;
}
}
}
7 changes: 7 additions & 0 deletions lib/iTag/Taggers/Tagger_Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public function tag($metadata, $options = array()) {
protected function process($footprint, $options) {

$result = array();

/*
* Superseed areaLimit
*/
if (isset($options['areaLimit']) && $this->area > $options['areaLimit']) {
return $result;
}

/*
* Process required classes
Expand Down
14 changes: 12 additions & 2 deletions lib/iTag/Taggers/Tagger_LandCover.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,27 @@ public function __construct($dbh, $config) {
*/
public function tag($metadata, $options = array()) {
parent::tag($metadata, $options);
return $this->process($metadata['footprint']);
return $this->process($metadata['footprint'], $options);
}

/**
*
* Compute land cover from input WKT footprint
*
* @param string $footprint
* @param array $options
*
*/
private function process($footprint) {
private function process($footprint, $options) {

/*
* Superseed areaLimit
*/
if (isset($options['areaLimit']) && $this->area > $options['areaLimit']) {
return array(
'landCover' => array()
);
}

/*
* Do not process if footprint area is greater
Expand Down
16 changes: 13 additions & 3 deletions lib/iTag/Taggers/Tagger_LandCover2009.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,27 @@ public function __construct($dbh, $config) {
*/
public function tag($metadata, $options = array()) {
parent::tag($metadata, $options);
return $this->process($metadata['footprint']);
return $this->process($metadata['footprint'], $options);
}

/**
*
* Compute land cover from input WKT footprint
*
* @param string $footprint
*
* @param array $options
*
*/
private function process($footprint) {
private function process($footprint, $options) {

/*
* Superseed areaLimit
*/
if (isset($options['areaLimit']) && $this->area > $options['areaLimit']) {
return array(
'landCover' => array()
);
}

/*
* Do not process if footprint area is greater
Expand Down
9 changes: 9 additions & 0 deletions lib/iTag/Taggers/Tagger_Political.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ public function tag($metadata, $options = array()) {
*/
private function process($footprint, $options) {

/*
* Superseed areaLimit
*/
if (isset($options['areaLimit']) && $this->area > $options['areaLimit']) {
return array(
'political' => array()
);
}

/*
* Toponyms
*/
Expand Down
15 changes: 13 additions & 2 deletions lib/iTag/Taggers/Tagger_Population.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,27 @@ public function __construct($dbh, $config) {
*/
public function tag($metadata, $options = array()) {
parent::tag($metadata, $options);
return $this->process($metadata['footprint']);
return $this->process($metadata['footprint'], $options);
}

/**
* Return the estimated population for a given footprint
*
* @param string $footprint
* @param array $options
* @return integer
*/
public function process($footprint) {
public function process($footprint, $options) {

/*
* Superseed areaLimit
*/
if (isset($options['areaLimit']) && $this->area > $options['areaLimit']) {
return array(
'population' => array()
);
}

$prequery = 'WITH prequery AS (SELECT ' . $this->postgisGeomFromText($footprint) . ' AS corrected_geometry)';
$query = $prequery . ' SELECT pcount FROM prequery, gpw.' . $this->getTableName() . ' WHERE ST_intersects(footprint, corrected_geometry)';
$results = $this->query($query);
Expand Down

0 comments on commit f973475

Please sign in to comment.