Commit Graph

479 Commits

Author SHA1 Message Date
Sarah Hoffmann
32f6ddf6db only allow either postcode or special search
Fixes #804.
2017-10-04 20:15:06 +02:00
Sarah Hoffmann
1220ff5da6 use correct source for radius column in debug view 2017-10-04 20:14:35 +02:00
Sarah Hoffmann
89c576fbe1 tests: more coverage for all API endpoints 2017-10-04 00:05:34 +02:00
Sarah Hoffmann
8e2ef2842e move psqlRunScript implementation into cmd lib
Function needed for update.php as well.
2017-10-03 14:26:59 +02:00
Sarah Hoffmann
e3323e8888 fix search for postcode via structured query
Results from the artifical postcode table were dropped
when reevaluating rank of results.
2017-10-03 12:10:27 +02:00
Sarah Hoffmann
2deac34648 remove unnecessary size check 2017-10-02 22:31:52 +02:00
Sarah Hoffmann
e8c52c6780 be more strict with searches involving house numbers
Housenumber searches without a name cannot exist per
definition. Searches with only a name but no address
should not fall back on a search without house number.
This should improve postcode only search.
2017-10-02 22:22:50 +02:00
Sarah Hoffmann
e7e7ae0104 avoid unnecessary SQL when rechecking rank restrictions 2017-10-02 20:42:37 +02:00
Sarah Hoffmann
749091bf3a order of viewbox coordinates does not matter 2017-10-01 22:48:57 +02:00
Sarah Hoffmann
28810e6ce0 Merge pull request #802 from mtmail/coordinate-extract-missing-first-minus-sign
NearPoint::extractFromQuery - greedy-match optional quote sign
2017-10-01 22:42:24 +02:00
Sarah Hoffmann
f2c15b73ad skip output of lat/lon in debug when no near point given 2017-09-30 12:24:37 +02:00
Sarah Hoffmann
a88527b2a0 fix index when rechecking postcode name 2017-09-30 12:19:16 +02:00
Sarah Hoffmann
b1e8db7ca7 return unchanged term if normalizer was not found 2017-09-30 09:39:47 +02:00
marc tobias
06657b3e10 NearPoint::extractFromQuery - greedy-match optional quote sign 2017-09-21 19:13:50 +02:00
marc tobias
e67a6dc321 fix to NearPoint::extractFromQuery handling first minus sign 2017-09-19 12:40:10 +01:00
Sarah Hoffmann
15a215729e fix handling of near queries with special search
Make sure to use the classtype tables with near search and
allow to search for arbitrary key/values (forbidding it
for viewbox searches).

Add tests for near queries.
2017-09-19 00:07:11 +02:00
Sarah Hoffmann
ce95c55d65 fix display of nearpoint in debug view 2017-09-18 23:06:30 +02:00
Sarah Hoffmann
8eb066c692 reinstate key-value amenity search
Reenable search by the secret special term [key=value]
matching against the given main tag. Note that for most
cases that works only for tags that also have a special
search table.
2017-09-18 22:09:06 +02:00
Sarah Hoffmann
a0de20e9bc more API tests for code coverage
Also fixes two minor issues related to structured queries.
2017-09-17 23:30:08 +02:00
Sarah Hoffmann
3546b30473 timestamp info message and repeat warnings at end 2017-09-17 11:06:52 +02:00
Sarah Hoffmann
88610b1b74 further restrict results for <postcode>, <term>
Disallow postcode operator together with housenumbers
and force results around a postcode when no address is
given.
2017-08-21 22:29:51 +02:00
Sarah Hoffmann
86a8900e21 fix subqueries when getting details for postcodes 2017-08-19 19:37:06 +02:00
Sarah Hoffmann
67bb885900 throw away searches with two postcodes 2017-08-19 19:37:06 +02:00
Sarah Hoffmann
50c5abf6bb fix API tests wrt postcodes 2017-08-19 19:37:06 +02:00
Sarah Hoffmann
5237f44c4a remove lat/lon check for search terms
Was only used with GB postcodes which were removed.
2017-08-19 19:37:06 +02:00
Sarah Hoffmann
99e9abe843 require postcodes to match exactly in normalised form 2017-08-19 19:37:06 +02:00
Sarah Hoffmann
5b4bbab9be include GB CodePoint data into location_postcode table 2017-08-19 19:37:06 +02:00
Sarah Hoffmann
3714b7ea7d take postcode into account for other searches
Existence of postcode is still optional but if a matching
result is found, then non-matching ones will be discarded.
2017-08-19 19:37:05 +02:00
Sarah Hoffmann
0ecb920866 immediately drop searches where requested country code does not match 2017-08-19 19:37:05 +02:00
Sarah Hoffmann
563099f7fa take address part into account in postcode search 2017-08-19 19:37:05 +02:00
Sarah Hoffmann
57dc0304b5 add search for postcode
Implements the 'postcode' operator.
2017-08-19 19:37:05 +02:00
Sarah Hoffmann
872e73314e move postcodes into special operation for Searches
Introduces postcode field in searches and sorts out any marked
postcodes.
2017-08-19 19:37:05 +02:00
Sarah Hoffmann
16053e81bf show address tags and postcode in details 2017-08-19 19:37:05 +02:00
Sarah Hoffmann
4e6c75040e Guard against network failures in getDatabaseDate()
When updating use the date from the diff file instead
as we are guaranteed to get this if the file has been
successfully loaded.
2017-06-09 21:49:31 +02:00
Sarah Hoffmann
c13094acfd limit number of considered places in POI queries
When searching for POIs in place_classtype_ tables limit the number
of objects considered to 300. The distinct and order by clauses
forced until now to retrive all matching objects and order them
first which can cause long running queries when retriving them
for large areas like the US.

Fixes #735.
2017-06-05 22:40:42 +02:00
Sarah Hoffmann
54393addd3 disregard special phrases that do not match fully
Compare the normalized terms imported with the special
terms script with the normalized version of the query string.
Disregard them if they cannot be found. This avoids a significant
number of mismatches due to transliteration issues.

The match will only be done when a normalized word has been set
making this change backwards compatible with older databases.
2017-06-04 23:12:09 +02:00
Sarah Hoffmann
d88c484fa1 remove PHP version check
5.4 is the minimum supported version now.
2017-06-01 20:10:10 +02:00
big-o
bdd90e890b Parameter to enable JSON pretty-printing 2017-06-01 20:10:10 +02:00
Sarah Hoffmann
bd4b1b2d08 switch from osmosis to pyosmium for updates
Pyosmium comes with convenient functions for finding the
right state and does not require external files for
rembering the state. Updates can now conveniently
set up by simply running ./utils/update.php --init-updates
and state is kept directly in the import_status table.

This change requires an update in the database schema.
Run the following to update:

ALTER TABLE import_status ADD COLUMN sequence_id integer;
ALTER TABLE import_status ADD COLUMN indexed boolean;
ALTER TABLE import_osmosis_log ADD COLUMN batchseq integer;
2017-05-25 16:26:09 +02:00
Sarah Hoffmann
050b0a2ced remove street and addr_place columns in placex
The information is onyl needed for parenting,
so no need to store it permanently.
2017-04-08 19:58:10 +02:00
Sarah Hoffmann
c8e79397f5 introduce address column for place tables
The column is a hstore containing the full OSM tag with key and
value.
2017-04-08 18:58:26 +02:00
Sarah Hoffmann
09f1661638 move moreURL computation into Geocode and include all params
Fixes #678.
2017-03-23 00:16:58 +01:00
Sarah Hoffmann
e841422b1f remove unused code 2017-03-22 23:02:19 +01:00
Marc Tobias Metten
1e3bf9729e for search,details in format=HTML return geometry in geojson, not wkt. No longer need leaflet-omnivore plugin 2017-03-19 17:31:00 +01:00
Sarah Hoffmann
57b35654e7 fix style 2017-03-17 22:36:22 +01:00
Sarah Hoffmann
20a4cab57e add tests for nearpoint sql functions 2017-03-16 22:12:20 +01:00
Sarah Hoffmann
ab3b556144 use NearPoint class in Search array 2017-03-16 22:04:30 +01:00
Sarah Hoffmann
41fce277cd make NearPoint its own class 2017-03-15 23:47:35 +01:00
marc tobias
a52455f160 github.com/twain47 => github.com/openstreetmap 2017-03-12 13:06:25 +01:00
Sarah Hoffmann
450a12c6be include housenumbers and postcodes when rechecking for exact matches 2017-02-28 21:40:05 +01:00
Ludovic Delauné
2c3317f582 extra headers for compatibility on IE7 2017-02-28 17:08:34 +01:00
Sarah Hoffmann
c48fb88e6b move interpolaton computation into indexing step
The interpolaton computation needs information from the osm2pgsql
slim tables which may not be available when the data is inserted.

Insertion now only adds a line with basic address information to
location_property_osmline. The line is then split during the
indexing, leading to more lines (which are complete in that case)
being inserted.

Fixes #598.
2017-02-26 16:46:41 +01:00
Sarah Hoffmann
a84a7a70f3 reverse: choose interpolation only when further than point
The ST_DWithin check also includes objects that are the same distance.

Another attempt at #545.
2017-02-05 23:02:21 +01:00
Sarah Hoffmann
dcab7a19e5 reverse: disable interpolation when going up the address hierarchy
Fixes #621.
2017-02-05 13:08:51 +01:00
Sarah Hoffmann
b8db8301df reverse: reduce search radius for interpolations
Interpolations should have the same maximum search radius as
address points. Change search strategy and only search for
interpolations either before decreasing the maxRank to road
or when a POI was found and we need to check that there isn't
an interpolation that is closer.
2017-01-09 20:51:16 +01:00
Marc Tobias Metten
adb6ea546f sMoreURL now includes countrycodes values 2016-12-22 02:06:08 +01:00
marc tobias
b27926fd4d fix PHP warnings when reverse search was called without parameters
... or empty results
2016-11-17 22:55:05 +01:00
Sarah Hoffmann
cfb0f3f94c Merge pull request #548 from lonvia/query-ckeck-utf8
check if query is valid unicode string
2016-11-02 19:21:29 +01:00
Sarah Hoffmann
032f24bfef Merge branch 'ui-easy-switch-coords' of https://github.com/mtmail/Nominatim 2016-11-01 23:49:02 +01:00
marc tobias
d93209ee48 Tiger: set osmtype=way and correct osm_id 2016-11-01 23:34:29 +01:00
marc tobias
eb79e655e6 cleanup of SQL for readability. No logic change 2016-11-01 23:33:47 +01:00
marc tobias
4f3074e538 cleanup of SQL for readability. No logic change 2016-11-01 23:33:47 +01:00
marc tobias
8312e8f539 UI: keep map position when switch to reverse. Easy switching of lat,lon to lon,lat 2016-10-30 17:45:45 +01:00
Sarah Hoffmann
1542a006cb Merge pull request #550 from lonvia/decrease-line-length
Reduce maximum line length to 199
2016-10-16 09:55:13 +02:00
Sarah Hoffmann
bb1c3f23ab reduce maximum line length to 199 for all php files 2016-10-14 00:01:16 +02:00
Sarah Hoffmann
8650e0fedd slightly relax viewbox parameter check
Allow out of bounds parameters as long as the resulting box
covers some legal coodinates.
2016-10-13 08:03:28 +02:00
Sarah Hoffmann
abac5d8ebd split long lines in Geocode.php 2016-10-13 00:27:17 +02:00
Sarah Hoffmann
e69115fd8f remove debug output 2016-10-12 22:27:46 +02:00
Sarah Hoffmann
7b1f35426d check if query is valid unicode string 2016-10-12 22:25:04 +02:00
Sarah Hoffmann
6757e1b865 properly check format of viewbox parameter 2016-10-12 22:13:07 +02:00
Sarah Hoffmann
c72e6a93dc fix typo in error message 2016-10-12 20:21:12 +02:00
Sarah Hoffmann
c0b4411337 reduce search depth when splitting word sets
Too many out-of-memory conditions with the current algorithm.
2016-10-12 20:09:20 +02:00
Sarah Hoffmann
fb51d51582 fix syntax error for route boxes 2016-10-09 21:41:23 +02:00
Sarah Hoffmann
f5641037cf avoid passing temporary array by reference
PHP7 complains: Only variables should be passed by reference.
2016-10-09 21:14:59 +02:00
Sarah Hoffmann
a855ffe58e replace deprecated postgis functions
ST_Line_Locate_Point and ST_Distance_Spheroid have changed
spelling in newer version and throw a deprecation warning.
2016-10-09 20:09:59 +02:00
Sarah Hoffmann
42d473968f check for correct array for country codes
fixes trac ticket 5427
2016-10-04 20:32:22 +02:00
Sarah Hoffmann
8b896f37f3 fill interpolation array for reverse lookups via search endpoint
Fixes #540
2016-10-01 13:03:31 +02:00
Sarah Hoffmann
6bf90eb22f fix namespace use 2016-09-30 22:43:11 +02:00
Marc Tobias Metten
6238ae6032 add namespaces, method visibility according to PSR2 standard 2016-09-16 02:27:36 +02:00
Marc Tobias Metten
4a321487f3 fix indentation and misc errors according to PSR2 coding style guide 2016-09-14 03:16:46 +02:00
Marc Tobias Metten
775fdeb8e4 UI: viewbox parameter was set in wrong parameter order 2016-09-13 14:41:56 +02:00
Marc Tobias Metten
2a784fa3d4 fix function declaration errors according to PSR2 coding style guide 2016-09-11 05:22:51 +02:00
marc tobias
3887423381 fix array-related errors according to PSR2 coding style guide 2016-09-10 21:10:52 +02:00
marc tobias
f05ea577f4 bracket spacing for if/else/for/foreach/while/switch according to PSR2 standard 2016-09-08 02:16:22 +01:00
Marc Tobias Metten
832547f192 tabs-to-spaces 2016-09-04 03:19:48 +02:00
Marc Tobias Metten
87b6810eba HTML map: new button -show map bounds- in top right corner 2016-08-24 04:21:28 +02:00
Marc Tobias Metten
797c2d1e74 Merge remote-tracking branch 'upstream/master' into move-mouse-position-info-on-map 2016-08-24 00:03:40 +02:00
Sarah Hoffmann
5464dec057 factor out parameter parsing into its own class
Allows to use the parsing functions in website/search.php and
utils/query.php as well.
2016-08-20 13:43:50 +02:00
Marc Tobias Metten
bb403e2e58 HTML map: new button -show map bounds- 2016-08-01 01:34:03 +02:00
Sarah Hoffmann
0a95bdc5f5 remove unused functions in Geocode 2016-07-26 23:10:50 +02:00
Sarah Hoffmann
d594bb238b cleanup interface of PlaceLookup
Move lookup parameters (place id, type, frac etc.) from members
to parameters for lookup().
2016-07-26 20:54:14 +02:00
Sarah Hoffmann
0d179b8c97 remove unnecessary local variable 2016-07-26 20:54:14 +02:00
Sarah Hoffmann
1b33999f10 refactor ReverseGeocode
- remove unused functions and members
- move coordinates from being members to being parameters of lookup()
2016-07-26 20:54:14 +02:00
Sarah Hoffmann
a766240c06 remove duplicate reverse geocoding code
Geocode now uses ReverseGeocode directly. Note that it currently
cannot support any interpolations, neither OSM nor Tiger. But
neither did the previous version.
2016-07-24 23:58:39 +02:00
Sarah Hoffmann
4f75f4cb6e remove IP blocking and rate-limiting code
Closes #472.
2016-07-18 21:33:09 +02:00
Sarah Hoffmann
665de339e5 allow coordinates in query only with name or classtype
Coordinates with country or housenumber only do not make much
sense. Currently these combination result in queries that
require a sequential scan of search_name and normally time
out before yielding any results.

fixes #462
2016-06-15 22:41:48 +02:00
Sarah Hoffmann
2ab43f6367 reverse do not downgrade tiger and interpolation results
Also fix the type that is returned for Tiger data.

Fixes #470
2016-06-14 21:38:03 +02:00
Sarah Hoffmann
10c5d7f6f6 fix more syntax errors in error functions 2016-06-12 23:25:47 +02:00
Sarah Hoffmann
e842d8793c allow parameters to be empty
Consider empty parameters as unset and use the default. Simplifies
use in forms.
2016-06-12 23:22:14 +02:00
Sarah Hoffmann
348a3082c9 fix syntax errors and update tests
Some of the tests with bad parameters now return a HTTP 400.
2016-06-12 22:51:13 +02:00
Sarah Hoffmann
033b9590bd use chksql everywhere in lib/
Replaces manual PEAR error checks and adds the chksql wrapper
where the error checks were still missing.
2016-06-12 14:58:05 +02:00
Sarah Hoffmann
95961d098d introduce chksql function for website code and move other fail functions
The default error screen now reports the full SQL even when not
in debug mode as this message is often more helpful than our
custom error message.
2016-06-12 14:34:57 +02:00
Sarah Hoffmann
7a50d2f996 factor out link formatting function and osm type translation 2016-06-12 12:39:09 +02:00
Sarah Hoffmann
6fef943e49 update links to OSM objects
/browse/ is no longer necesary in the URL
2016-06-12 09:26:58 +02:00
Sarah Hoffmann
76b9eb8098 remove now unused bAsPoints in reverse API 2016-06-11 23:27:21 +02:00
Sarah Hoffmann
d45524cbfb introduce accessor function for URL parameter
These functions take care of type conversion and check that
the parameters contain legal values. The API now returns a
Bad Request error if the format is wrong.
2016-06-11 23:07:06 +02:00
Sarah Hoffmann
cf4a44aaf7 introduce chksql function for phpscripts
Checks SQL query results for errors and bails out if it finds one.
Avoids some heavy code duplication all over the place.
2016-06-09 20:37:51 +02:00
markigail
98e5ba6b61 use place_id instead of parent_place_id for excluded place_ids in interpolation lines query 2016-06-04 23:54:17 +02:00
Sarah Hoffmann
2156fb1ad7 remove reference assignment where unnecessary
Avoids a number of warnings on PHP7.
2016-06-04 23:46:19 +02:00
Sarah Hoffmann
f0d962f8a0 fix variable name in search xml output 2016-05-27 23:35:24 +02:00
Sarah Hoffmann
234b1b0293 Merge remote-tracking branch 'markus/master' into master 2016-05-14 21:09:57 +02:00
markigail
190a72cab5 Fix bug in index.c and remove column admin_level from location_property_osmline. 2016-05-08 16:46:42 +02:00
Sarah Hoffmann
4e0e0c1797 replace new-style [] expression with old-style array()
Also removes some unused code.

fixes #444
2016-05-01 11:22:53 +02:00
Markus Gail
2ba9c11dd0 fix bug in Geocode.php 2016-04-29 10:24:30 +02:00
Markus Gail
db719d489f index on geometry of interpolation lines, and more improvements. 2016-04-27 17:42:59 +02:00
Markus Gail
a10f537131 Correct merge error in Geocode.php. 2016-04-25 17:44:34 +02:00
Markus Gail
89c556d163 Coding style adaptions and correcting small errors from merge. 2016-04-25 13:58:28 +02:00
Markus Gail
b03be15442 Merge remote-tracking branch 'origin/master' into osmline
Conflicts:
	lib/Geocode.php
	lib/PlaceLookup.php
	sql/functions.sql
	sql/tables.sql
	utils/setup.php
2016-04-25 11:01:04 +02:00
Markus Gail
7879ad44cd Remove interpolation lines from placex and save them in an extra table. 2016-04-25 09:44:01 +02:00
Sarah Hoffmann
af06d31d21 remove duplicate CORS header
fixes #427
2016-04-12 23:04:38 +02:00
Sarah Hoffmann
d01d0c13f4 Merge pull request #425 from lonvia/disable-aux-tables
make tables for external data (Tiger and aux) configurable
2016-04-12 23:00:24 +02:00
Sarah Hoffmann
a86563cfb1 make tables for external data (Tiger and aux) configurable
Introduces two new settings CONST_Use_US_Tiger_Data and
CONST_Use_Aux_Location_data, which are disabled by default.
When false the corresponding tables are ignored in queries
and updates.

Aux and tiger tables are no longer created by default. This
has to be done by the corresponding import scripts. The former
aux table creation can be found in sql/aux_tables.sql for
reference.
2016-04-07 21:47:51 +02:00
Sarah Hoffmann
009882999f clean up query logging
- remove query_log table, keeping only new_query_log
- drop unused import_npi_log table
- disable DB logging per default
- use file logging structure from osm.org
2016-04-07 20:37:27 +02:00
Sarah Hoffmann
f9a488cd5a remove 'closed for indexing' feature
Simultanous updates are fine these days.
2016-03-30 22:53:19 +02:00
Sarah Hoffmann
02bd322c1d remove explicitly set postgres/postgis version
Get the version from the database where necessary or simply
probe for existence of features. Fake hstore_to_json when
necessary.

Bumps the minimum required versions fro postgres to 9.1 and
for postgis to 2.0.
2016-03-30 22:48:18 +02:00
Sarah Hoffmann
6f442b6617 remove unused functions in php library 2016-03-28 22:55:21 +02:00
Sarah Hoffmann
83cca343c3 Fix fixing of coding style 2016-03-28 22:04:08 +02:00
Sarah Hoffmann
53eb9a5f14 fix syntax errors in tiger code and adapt format of dummy tables 2016-03-27 23:45:20 +02:00
Sarah Hoffmann
443bfec035 Merge branch 'tigerlines' of https://github.com/markigail/Nominatim 2016-03-27 20:00:15 +02:00
Sarah Hoffmann
7090604de7 reinstate NOMINATIM_SETTINGS variable
Move sourcing of this script to settings.php so that
it is loaded before anything else.
2016-03-24 22:06:54 +01:00
Markus Gail
7dd0a63b68 Fix coding style. 2016-03-23 09:34:36 +01:00
Markus Gail
a4ecd9d73e Merge branch 'tigerlines' of /home/markus/Nominatim into tiger
Conflicts:
	lib/Geocode.php
	lib/ReverseGeocode.php
	lib/lib.php
2016-03-22 11:26:39 +01:00
Markus Gail
e94b667e16 adapt to code style conventions 2016-03-21 14:15:22 +01:00
Markus Gail
f6127df15d add osm_type='tiger' to json, jsonv2 and xml output 2016-03-21 14:14:01 +01:00
Markus Gail
291fdd1894 Tested Version of new Tiger line storage format. 2016-03-21 14:14:01 +01:00
Markus Gail
46cef36184 Implement geocoding and reverse geocoding with tiger interpolation lines instead of points. 2016-03-21 14:14:01 +01:00
Markus Gail
bc449e10be change tiger housenumber format to save as lines instead of points and thus new interpolation 2016-03-21 14:07:12 +01:00
Markus Gail
d8703c223b adapt to code style conventions 2016-03-21 13:32:44 +01:00
Markus Gail
28166c5bb1 add osm_type='tiger' to json, jsonv2 and xml output 2016-03-21 13:32:44 +01:00
Markus Gail
df6b433066 Tested Version of new Tiger line storage format. 2016-03-21 13:32:44 +01:00
Markus Gail
26e30bf8e1 Implement geocoding and reverse geocoding with tiger interpolation lines instead of points. 2016-03-21 13:32:44 +01:00
Markus Gail
49d0ce1de4 change tiger housenumber format to save as lines instead of points and thus new interpolation 2016-03-21 13:32:44 +01:00
marc tobias
d020e05f5b query the last updated timestamp only if output format is HTML 2016-03-21 13:32:44 +01:00
marc tobias
c346c57341 corrected layout of keywords on HTML details page 2016-03-21 13:32:44 +01:00
Marc Tobias Metten
607fef2d8f moved bIncludePolygonAsPoints related logic into lib.php, added tests 2016-03-21 13:32:44 +01:00
Sarah Hoffmann
6fc32d9645 Merge branch 'cmake-port' into master
Conflicts:
	CMakeLists.txt
	lib/init.php
	settings/settings.php
2016-03-16 19:45:18 +01:00
Sarah Hoffmann
279ea25e7d Merge pull request #381 from lonvia/cmake-port
Replace autotools with cmake and update osm2pgsql
2016-03-13 21:40:38 +01:00
Marc Tobias Metten
22ebd1c7a9 second argument of array_merge can be empty 2016-03-13 03:01:19 +01:00
Sarah Hoffmann
5ccb499a6f install executables and call settings.php explicitly
Executables (including websites) need to be installed in the
build directory, so that they can find the right settings.php.
settings now defines build and source dir.
2016-03-12 09:40:43 +01:00
Sarah Hoffmann
5d7bd37ab2 introduce InstallPath, so that stuff can be executed from build dir 2016-03-12 09:40:43 +01:00