If you are migrating from a version <3.6, then you still have to follow
the manual migration steps up to 3.6.
+## 4.0.0 -> master
+
+### geocodejson output changed
+
+The `type` field of the geocodejson output has changed. It now contains
+the address class of the object instead of the value of the OSM tag. If
+your client has used the `type` field, switch them to read `osm_value`
+instead.
+
## 3.7.0 -> 4.0.0
### NOMINATIM_PHRASE_CONFIG removed
The following feature attributes are implemented:
* `osm_type`, `osm_id` - reference to the OSM object (unofficial extension, [see notes](#osm-reference))
- * `type` - value of the main tag of the object (e.g. residential, restaurant, ...)
+ * `type` - the 'address level' of the object ('house', 'street', `district`, `city`,
+ `county`, `state`, `country`, `locality`)
+ * `osm_key`- key of the main tag of the OSM object (e.g. boundary, highway, amenity)
+ * `osm_value` - value of the main tag of the OSM object (e.g. residential, restaurant)
* `label` - full comma-separated address
* `name` - localised name of the place
* `housenumber`, `street`, `locality`, `district`, `postcode`, `city`,
return array($sFound, $fQueryLat, $fQueryLon);
}
+function addressRankToGeocodeJsonType($iAddressRank)
+{
+ if ($iAddressRank >= 29 && $iAddressRank <= 30) {
+ return 'house';
+ }
+ if ($iAddressRank >= 26 && $iAddressRank < 28) {
+ return 'street';
+ }
+ if ($iAddressRank >= 22 && $iAddressRank < 26) {
+ return 'locality';
+ }
+ if ($iAddressRank >= 17 && $iAddressRank < 22) {
+ return 'district';
+ }
+ if ($iAddressRank >= 13 && $iAddressRank < 17) {
+ return 'city';
+ }
+ if ($iAddressRank >= 10 && $iAddressRank < 13) {
+ return 'county';
+ }
+ if ($iAddressRank >= 5 && $iAddressRank < 10) {
+ return 'state';
+ }
+ if ($iAddressRank >= 4 && $iAddressRank < 5) {
+ return 'country';
+ }
+
+ return 'locality';
+}
+
if (!function_exists('array_key_last')) {
function array_key_last(array $array)
{
$aPlace['properties']['geocoding']['osm_type'] = $sOSMType;
$aPlace['properties']['geocoding']['osm_id'] = $aPointDetails['osm_id'];
}
+ $aPlace['properties']['geocoding']['osm_key'] = $aPointDetails['class'];
+ $aPlace['properties']['geocoding']['osm_value'] = $aPointDetails['type'];
- $aPlace['properties']['geocoding']['type'] = $aPointDetails['type'];
+ $aPlace['properties']['geocoding']['type'] = addressRankToGeocodeJsonType($aPointDetails['rank_address']);
$aPlace['properties']['geocoding']['label'] = $aPointDetails['langaddress'];
FAIL = 1
FATAL = 2
NOT_APPLICABLE = 3
+ WARN = 4
def _check(hint=None):
""" Decorator for checks. It adds the function to the list of
params = {}
if ret == CheckState.OK:
print('\033[92mOK\033[0m')
+ elif ret == CheckState.WARN:
+ print('\033[93mWARNING\033[0m')
+ if hint:
+ print('')
+ print(dedent(hint.format(**params)))
elif ret == CheckState.NOT_APPLICABLE:
print('not applicable')
else:
return CheckState.FAIL, dict(msg=result)
+@_check(hint="""\
+ Wikipedia/Wikidata importance tables missing.
+ Quality of search results may be degraded. Reverse geocoding is unaffected.
+ See https://nominatim.org/release-docs/latest/admin/Import/#wikipediawikidata-rankings
+ """)
+def check_existance_wikipedia(conn, _):
+ """ Checking for wikipedia/wikidata data
+ """
+ if not conn.table_exists('search_name'):
+ return CheckState.NOT_APPLICABLE
+
+ with conn.cursor() as cur:
+ cnt = cur.scalar('SELECT count(*) FROM wikipedia_article')
+
+ return CheckState.WARN if cnt == 0 else CheckState.OK
+
+
@_check(hint="""\
The indexing didn't finish. {count} entries are not yet indexed.