]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 27 Feb 2015 19:02:23 +0000 (20:02 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 27 Feb 2015 19:02:23 +0000 (20:02 +0100)
.gitignore
lib/PlaceLookup.php
settings/settings.php
sql/indices.src.sql
sql/words.sql [new file with mode: 0644]
tests/scenes/bin/Makefile [new file with mode: 0644]
tests/scenes/bin/make_scenes.sh
tests/scenes/bin/osm2wkt.cc

index 54af2ad328a3a163d6106e65fd7df86ba659dde1..a13320648766586b8e3b8050fa1d4582437b2bb6 100644 (file)
@@ -16,6 +16,7 @@ autom4te.cache/
 config.*
 configure
 Makefile
+!tests/scenes/bin/Makefile
 Makefile.in
 stamp-h1
 missing
index f013fe176183422a6fbe49ed2630fad009cc40df..6da82fd8225bd9cdb31366f22f8724262926fe61 100644 (file)
                        $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)
index 3da42133a4fd6ab769198a0203df8756346c0d5a..598ce86e7fe823d9f83c51434ba97df510d5e24d 100644 (file)
@@ -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);
index 52bfbe35fb53c29d136089a05766209b96a51d5d..9a9c379356fc08f9512e4a93ba84a818c08374e8 100644 (file)
@@ -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 (file)
index 0000000..9c2f306
--- /dev/null
@@ -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 (file)
index 0000000..c65f52b
--- /dev/null
@@ -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
index 4ad31f31fcbae466c0b1253239487f08e39f5d20..71de870354d077c62eee042f3aff8813c0ed1d12 100755 (executable)
@@ -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
index 9cf9b578539ae0644039568bd65ea734ddbc3c15..56210892e18b2841698f73fb48727a584f18862f 100644 (file)
@@ -7,23 +7,23 @@
 #include <unordered_map>
 
 #include <osmium/area/assembler.hpp>
-#include <osmium/area/collector.hpp>
+#include <osmium/area/multipolygon_collector.hpp>
 #include <osmium/area/problem_reporter_exception.hpp>
 #include <osmium/geom/wkt.hpp>
 #include <osmium/handler.hpp>
 #include <osmium/handler/node_locations_for_ways.hpp>
 #include <osmium/io/any_input.hpp>
 #include <osmium/visitor.hpp>
-#include <osmium/index/map/stl_map.hpp>
+#include <osmium/index/map/sparse_mem_array.hpp>
 
-typedef osmium::index::map::StlMap<osmium::unsigned_object_id_type, osmium::Location> index_type;
+typedef osmium::index::map::SparseMemArray<osmium::unsigned_object_id_type, osmium::Location> index_type;
 
 typedef osmium::handler::NodeLocationsForWays<index_type, index_type> location_handler_type;
 
 
 class ExportToWKTHandler : public osmium::handler::Handler {
 
-    osmium::geom::WKTFactory m_factory;
+    osmium::geom::WKTFactory<> m_factory;
     std::unordered_map<std::string, std::ofstream>  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<area_assembler_type> collector(assembler);
+    osmium::area::Assembler::config_type assembler_config(&problem_reporter);
+    osmium::area::MultipolygonCollector<osmium::area::Assembler> 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";