mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
Merge branch 'tigerlines' of /home/markus/Nominatim into tiger
Conflicts: lib/Geocode.php lib/ReverseGeocode.php lib/lib.php
This commit is contained in:
@@ -1479,7 +1479,7 @@
|
|||||||
|
|
||||||
if ($aSearch['sClass'] && sizeof($aPlaceIDs))
|
if ($aSearch['sClass'] && sizeof($aPlaceIDs))
|
||||||
{
|
{
|
||||||
$sPlaceIDs = join(',', aPlaceIDs);
|
$sPlaceIDs = join(',', $aPlaceIDs);
|
||||||
$aClassPlaceIDs = array();
|
$aClassPlaceIDs = array();
|
||||||
|
|
||||||
if (!$aSearch['sOperator'] || $aSearch['sOperator'] == 'name')
|
if (!$aSearch['sOperator'] || $aSearch['sOperator'] == 'name')
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
$sSQL = "select place_id,partition, 'T' as osm_type, place_id as osm_id, 'place' as class, 'house' as type, null as admin_level, housenumber, null as street, null as isin, postcode,";
|
$sSQL = "select place_id,partition, 'T' as osm_type, place_id as osm_id, 'place' as class, 'house' as type, null as admin_level, housenumber, null as street, null as isin, postcode,";
|
||||||
$sSQL .= " 'us' as country_code, parent_place_id, null as linked_place_id, 30 as rank_address, 30 as rank_search,";
|
$sSQL .= " 'us' as country_code, parent_place_id, null as linked_place_id, 30 as rank_address, 30 as rank_search,";
|
||||||
$sSQL .= " coalesce(null,0.75-(30::float/40)) as importance, null as indexed_status, null as indexed_date, null as wikipedia, 'us' as calculated_country_code, ";
|
$sSQL .= " coalesce(null,0.75-(30::float/40)) as importance, null as indexed_status, null as indexed_date, null as wikipedia, 'us' as calculated_country_code, ";
|
||||||
$sSQL .= " get_address_by_language(place_id, housenumber,$sLanguagePrefArraySQL) as langaddress,";
|
$sSQL .= " get_address_by_language(place_id, housenumber, $sLanguagePrefArraySQL) as langaddress,";
|
||||||
$sSQL .= " null as placename,";
|
$sSQL .= " null as placename,";
|
||||||
$sSQL .= " null as ref,";
|
$sSQL .= " null as ref,";
|
||||||
if ($this->bExtraTags) $sSQL .= " null as extra,";
|
if ($this->bExtraTags) $sSQL .= " null as extra,";
|
||||||
|
|||||||
@@ -167,9 +167,7 @@
|
|||||||
$sSQL .= ' AND ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')'; //no centroid anymore in Tiger data, now we have lines
|
$sSQL .= ' AND ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')'; //no centroid anymore in Tiger data, now we have lines
|
||||||
$sSQL .= ' ORDER BY ST_distance('.$sPointSQL.', linegeo) ASC limit 1';
|
$sSQL .= ' ORDER BY ST_distance('.$sPointSQL.', linegeo) ASC limit 1';
|
||||||
|
|
||||||
|
if (CONST_Debug)
|
||||||
// print all house numbers in the parent (street)
|
|
||||||
/*if (CONST_Debug)
|
|
||||||
{
|
{
|
||||||
$sSQL = preg_replace('/limit 1/', 'limit 100', $sSQL);
|
$sSQL = preg_replace('/limit 1/', 'limit 100', $sSQL);
|
||||||
var_dump($sSQL);
|
var_dump($sSQL);
|
||||||
@@ -179,7 +177,7 @@
|
|||||||
{
|
{
|
||||||
echo $i['housenumber'] . ' | ' . $i['distance'] * 1000 . ' | ' . $i['lat'] . ' | ' . $i['lon']. ' | '. "<br>\n";
|
echo $i['housenumber'] . ' | ' . $i['distance'] * 1000 . ' | ' . $i['lat'] . ' | ' . $i['lon']. ' | '. "<br>\n";
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
$aPlaceTiger = $this->oDB->getRow($sSQL);
|
$aPlaceTiger = $this->oDB->getRow($sSQL);
|
||||||
if (PEAR::IsError($aPlace))
|
if (PEAR::IsError($aPlace))
|
||||||
@@ -221,7 +219,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return array('place_id' => $iPlaceID,
|
return array('place_id' => $iPlaceID,
|
||||||
'type' => $bPlaceIsTiger ? 'tiger' : 'osm');
|
'type' => $bPlaceIsTiger ? 'tiger' : 'osm',
|
||||||
|
'fraction' => $bPlaceIsTiger ? $iFraction : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// General settings
|
// General settings
|
||||||
@define('CONST_Debug', false);
|
@define('CONST_Debug', false);
|
||||||
@define('CONST_Database_DSN', 'pgsql://@/nominatim'); // <driver>://<username>:<password>@<host>:<port>/<database>
|
@define('CONST_Database_DSN', 'pgsql://@/nominatim'); // <driver>://<username>:<password>@<host>:<port>/<database>
|
||||||
@define('CONST_Database_Web_User', 'www-data');
|
@define('CONST_Database_Web_User', 'www-data');
|
||||||
@define('CONST_Max_Word_Frequency', '50000');
|
@define('CONST_Max_Word_Frequency', '50000');
|
||||||
@define('CONST_Limit_Reindexing', true);
|
@define('CONST_Limit_Reindexing', true);
|
||||||
|
|||||||
@@ -189,6 +189,68 @@ class NominatimTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function test_geometryText2Points()
|
||||||
|
{
|
||||||
|
$fRadius = 1;
|
||||||
|
|
||||||
|
// invalid value
|
||||||
|
$this->assertEquals(
|
||||||
|
NULL,
|
||||||
|
geometryText2Points('', $fRadius)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// POINT
|
||||||
|
$aPoints = geometryText2Points('POINT(10 20)', $fRadius);
|
||||||
|
$this->assertEquals(
|
||||||
|
101,
|
||||||
|
count($aPoints)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
|
||||||
|
array(
|
||||||
|
['', 10, 21],
|
||||||
|
['', 10.062790519529, 20.998026728428],
|
||||||
|
['', 10.125333233564, 20.992114701314]
|
||||||
|
),
|
||||||
|
array_splice($aPoints, 0,3)
|
||||||
|
);
|
||||||
|
|
||||||
|
// POLYGON
|
||||||
|
$this->assertEquals(
|
||||||
|
array(
|
||||||
|
['30 10', '30', '10'],
|
||||||
|
['40 40', '40', '40'],
|
||||||
|
['20 40', '20', '40'],
|
||||||
|
['10 20', '10', '20'],
|
||||||
|
['30 10', '30', '10']
|
||||||
|
),
|
||||||
|
geometryText2Points('POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))', $fRadius)
|
||||||
|
);
|
||||||
|
|
||||||
|
// MULTIPOLYGON
|
||||||
|
// only the first polygon is used
|
||||||
|
$this->assertEquals(
|
||||||
|
array(
|
||||||
|
['30 20', '30', '20'],
|
||||||
|
['45 40', '45', '40'],
|
||||||
|
['10 40', '10', '40'],
|
||||||
|
['30 20', '30', '20'],
|
||||||
|
|
||||||
|
// ['15 5' , '15', '5' ],
|
||||||
|
// ['45 10', '45', '10'],
|
||||||
|
// ['10 20', '10', '20'],
|
||||||
|
// ['5 10' , '5' , '10'],
|
||||||
|
// ['15 5' , '15', '5' ]
|
||||||
|
),
|
||||||
|
geometryText2Points('MULTIPOLYGON(((30 20, 45 40, 10 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5)))', $fRadius)
|
||||||
|
);
|
||||||
|
|
||||||
// you might say we're creating a circle
|
// you might say we're creating a circle
|
||||||
public function test_createPointsAroundCenter()
|
public function test_createPointsAroundCenter()
|
||||||
|
|||||||
Reference in New Issue
Block a user