From: Sarah Hoffmann Date: Fri, 27 Feb 2015 19:02:23 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~479 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/1f951e863a870854188603b29c8a98e3897dccdd?hp=86b95a946b6ce73a54defd5ea09c5e4c1303bb43 Merge remote-tracking branch 'upstream/master' --- diff --git a/.gitignore b/.gitignore index 54af2ad3..a1332064 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ autom4te.cache/ config.* configure Makefile +!tests/scenes/bin/Makefile Makefile.in stamp-h1 missing diff --git a/lib/PlaceLookup.php b/lib/PlaceLookup.php index f013fe17..6da82fd8 100644 --- a/lib/PlaceLookup.php +++ b/lib/PlaceLookup.php @@ -51,6 +51,10 @@ $sSQL .= " from placex where place_id = ".(int)$this->iPlaceID; $aPlace = $this->oDB->getRow($sSQL); + if (PEAR::IsError($aPlace)) + { + failInternalError("Could not lookup place.", $sSQL, $aPlace); + } if (!$aPlace['place_id']) return null; if ($this->bAddressDetails) diff --git a/settings/settings.php b/settings/settings.php index 3da42133..598ce86e 100644 --- a/settings/settings.php +++ b/settings/settings.php @@ -92,7 +92,7 @@ @define('CONST_Search_BatchMode', false); @define('CONST_Search_TryDroppedAddressTerms', false); - @define('CONST_Search_NameOnlySearchFrequencyThreshold', false); + @define('CONST_Search_NameOnlySearchFrequencyThreshold', 500); // Set to zero to disable polygon output @define('CONST_PolygonOutput_MaximumTypes', 1); diff --git a/sql/indices.src.sql b/sql/indices.src.sql index 52bfbe35..9a9c3793 100644 --- a/sql/indices.src.sql +++ b/sql/indices.src.sql @@ -14,7 +14,6 @@ CREATE INDEX idx_placex_rank_search ON placex USING BTREE (rank_search) {ts:sear CREATE INDEX idx_placex_rank_address ON placex USING BTREE (rank_address) {ts:search-index}; CREATE INDEX idx_placex_pendingsector ON placex USING BTREE (rank_search,geometry_sector) {ts:address-index} where indexed_status > 0; CREATE INDEX idx_placex_parent_place_id ON placex USING BTREE (parent_place_id) {ts:search-index} where parent_place_id IS NOT NULL; -CREATE INDEX idx_placex_interpolation ON placex USING BTREE (geometry_sector) {ts:address-index} where indexed_status > 0 and class='place' and type='houses'; CREATE INDEX idx_placex_reverse_geometry ON placex USING gist (geometry) {ts:search-index} where rank_search != 28 and (name is not null or housenumber is not null) and class not in ('waterway','railway','tunnel','bridge'); CREATE INDEX idx_location_area_country_place_id ON location_area_country USING BTREE (place_id) {ts:address-index}; @@ -24,6 +23,7 @@ CREATE INDEX idx_search_name_country_centroid ON search_name_country USING GIST CREATE INDEX idx_location_property_-partition-_centroid ON location_property_-partition- USING GIST (centroid) {ts:address-index}; -- end +DROP INDEX IF EXISTS place_id_idx; CREATE UNIQUE INDEX idx_place_osm_unique on place using btree(osm_id,osm_type,class,type) {ts:address-index}; diff --git a/sql/words.sql b/sql/words.sql new file mode 100644 index 00000000..9c2f3068 --- /dev/null +++ b/sql/words.sql @@ -0,0 +1,14 @@ +CREATE TABLE word_frequencies AS + (SELECT unnest(make_keywords(v)) as id, sum(count) as count + FROM (select svals(name) as v, count(*)from place group by v) cnt + WHERE v is not null + GROUP BY id); + +select count(make_keywords(v)) from (select distinct postcode as v from place) as w where v is not null; +select count(getorcreate_housenumber_id(make_standard_name(v))) from (select distinct housenumber as v from place where housenumber is not null) as w; + +-- copy the word frequencies +update word set search_name_count = count from word_frequencies wf where wf.id = word.word_id; + +-- and drop the temporary frequency table again +drop table word_frequencies; diff --git a/tests/scenes/bin/Makefile b/tests/scenes/bin/Makefile new file mode 100644 index 00000000..c65f52b8 --- /dev/null +++ b/tests/scenes/bin/Makefile @@ -0,0 +1,26 @@ +CXXFLAGS += -O3 +#CXXFLAGS += -g +CXXFLAGS += -std=c++11 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CXXFLAGS += -I../../../../libosmium/include + +OS:=$(shell uname -s) +ifeq ($(OS),Darwin) +CXXFLAGS += -stdlib=libc++ +LDFLAGS += -stdlib=libc++ +endif + +CXXFLAGS_WARNINGS := -Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wold-style-cast + +LIB_EXPAT := -lexpat +LIB_PBF := -pthread -lz -lprotobuf-lite -losmpbf +LIB_GZIP := -lz +LIB_BZIP2 := -lbz2 + +LIB_IO := $(LIB_EXPAT) $(LIB_PBF) $(LIB_GZIP) $(LIB_BZIP2) + +all: + +osm2wkt: osm2wkt.cc + $(CXX) $(CXXFLAGS) $(CXXFLAGS_WARNINGS) -o $@ $< $(LDFLAGS) $(LIB_IO) + +scenarios: osm2wkt diff --git a/tests/scenes/bin/make_scenes.sh b/tests/scenes/bin/make_scenes.sh index 4ad31f31..71de8703 100755 --- a/tests/scenes/bin/make_scenes.sh +++ b/tests/scenes/bin/make_scenes.sh @@ -5,7 +5,7 @@ datadir="$( cd "$( dirname "$0" )" && cd ../data && pwd )" -if [! -d "$datadir" ]; then +if [ ! -d "$datadir" ]; then echo "Cannot find data dir."; exit -1; fi diff --git a/tests/scenes/bin/osm2wkt.cc b/tests/scenes/bin/osm2wkt.cc index 9cf9b578..56210892 100644 --- a/tests/scenes/bin/osm2wkt.cc +++ b/tests/scenes/bin/osm2wkt.cc @@ -7,23 +7,23 @@ #include #include -#include +#include #include #include #include #include #include #include -#include +#include -typedef osmium::index::map::StlMap index_type; +typedef osmium::index::map::SparseMemArray index_type; typedef osmium::handler::NodeLocationsForWays location_handler_type; class ExportToWKTHandler : public osmium::handler::Handler { - osmium::geom::WKTFactory m_factory; + osmium::geom::WKTFactory<> m_factory; std::unordered_map m_files; public: @@ -70,13 +70,12 @@ int main(int argc, char* argv[]) { std::string input_filename {argv[1]}; - typedef osmium::area::Assembler area_assembler_type; osmium::area::ProblemReporterException problem_reporter; - area_assembler_type assembler(&problem_reporter); - osmium::area::Collector collector(assembler); + osmium::area::Assembler::config_type assembler_config(&problem_reporter); + osmium::area::MultipolygonCollector collector(assembler_config); std::cerr << "Pass 1...\n"; - osmium::io::Reader reader1(input_filename); + osmium::io::Reader reader1(input_filename, osmium::osm_entity_bits::relation); collector.read_relations(reader1); std::cerr << "Pass 1 done\n"; @@ -87,9 +86,10 @@ int main(int argc, char* argv[]) { std::cerr << "Pass 2...\n"; ExportToWKTHandler export_handler; osmium::io::Reader reader2(input_filename); - osmium::apply(reader2, location_handler, export_handler, collector.handler()); + osmium::apply(reader2, location_handler, export_handler, collector.handler([&export_handler](osmium::memory::Buffer&& buffer) { + osmium::apply(buffer, export_handler); + })); reader2.close(); - osmium::apply(collector, export_handler); export_handler.close(); std::cerr << "Pass 2 done\n";