mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-26 06:22:13 +03:00
Merge branch 'feature/polygon-simplification' of https://github.com/a1exsh/Nominatim
This commit is contained in:
commit
a7e1b3b1ee
@ -12,6 +12,7 @@
|
|||||||
protected $bIncludePolygonAsGeoJSON = false;
|
protected $bIncludePolygonAsGeoJSON = false;
|
||||||
protected $bIncludePolygonAsKML = false;
|
protected $bIncludePolygonAsKML = false;
|
||||||
protected $bIncludePolygonAsSVG = false;
|
protected $bIncludePolygonAsSVG = false;
|
||||||
|
protected $fPolygonSimplificationThreshold = 0.0;
|
||||||
|
|
||||||
protected $aExcludePlaceIDs = array();
|
protected $aExcludePlaceIDs = array();
|
||||||
protected $bDeDupe = true;
|
protected $bDeDupe = true;
|
||||||
@ -102,6 +103,11 @@
|
|||||||
$this->bIncludePolygonAsSVG = $b;
|
$this->bIncludePolygonAsSVG = $b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setPolygonSimplificationThreshold($f)
|
||||||
|
{
|
||||||
|
$this->fPolygonSimplificationThreshold = $f;
|
||||||
|
}
|
||||||
|
|
||||||
function setDeDupe($bDeDupe = true)
|
function setDeDupe($bDeDupe = true)
|
||||||
{
|
{
|
||||||
$this->bDeDupe = (bool)$bDeDupe;
|
$this->bDeDupe = (bool)$bDeDupe;
|
||||||
@ -1599,7 +1605,16 @@
|
|||||||
if ($this->bIncludePolygonAsKML) $sSQL .= ",ST_AsKML(geometry) as askml";
|
if ($this->bIncludePolygonAsKML) $sSQL .= ",ST_AsKML(geometry) as askml";
|
||||||
if ($this->bIncludePolygonAsSVG) $sSQL .= ",ST_AsSVG(geometry) as assvg";
|
if ($this->bIncludePolygonAsSVG) $sSQL .= ",ST_AsSVG(geometry) as assvg";
|
||||||
if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ",ST_AsText(geometry) as astext";
|
if ($this->bIncludePolygonAsText || $this->bIncludePolygonAsPoints) $sSQL .= ",ST_AsText(geometry) as astext";
|
||||||
$sSQL .= " from placex where place_id = ".$aResult['place_id'];
|
$sFrom = " from placex where place_id = ".$aResult['place_id'];
|
||||||
|
if ($this->fPolygonSimplificationThreshold > 0)
|
||||||
|
{
|
||||||
|
$sSQL .= " from (select place_id,centroid,ST_SimplifyPreserveTopology(geometry,".$this->fPolygonSimplificationThreshold.") as geometry".$sFrom.") as plx";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sSQL .= $sFrom;
|
||||||
|
}
|
||||||
|
|
||||||
$aPointPolygon = $this->oDB->getRow($sSQL);
|
$aPointPolygon = $this->oDB->getRow($sSQL);
|
||||||
if (PEAR::IsError($aPointPolygon))
|
if (PEAR::IsError($aPointPolygon))
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,11 @@
|
|||||||
$oGeocode->setIncludePolygonAsSVG($bAsSVG);
|
$oGeocode->setIncludePolygonAsSVG($bAsSVG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Polygon simplification threshold (optional)
|
||||||
|
$fThreshold = 0.0;
|
||||||
|
if (isset($_GET['polygon_threshold'])) $fThreshold = (float)$_GET['polygon_threshold'];
|
||||||
|
$oGeocode->setPolygonSimplificationThreshold($fThreshold);
|
||||||
|
|
||||||
$oGeocode->loadParamArray($_GET);
|
$oGeocode->loadParamArray($_GET);
|
||||||
|
|
||||||
if (CONST_Search_BatchMode && isset($_GET['batch']))
|
if (CONST_Search_BatchMode && isset($_GET['batch']))
|
||||||
|
Loading…
Reference in New Issue
Block a user