- AND NEW.admin_level <= 4 AND NEW.osm_type = 'W' THEN
- return NULL;
- ELSEIF NEW.osm_type = 'N' AND NEW.class = 'highway' THEN
- NEW.rank_search = 30;
- NEW.rank_address = 0;
- ELSEIF NEW.class = 'landuse' AND NOT is_area THEN
- NEW.rank_search = 30;
- NEW.rank_address = 0;
- ELSE
- -- do table lookup stuff
- IF NEW.class = 'boundary' and NEW.type = 'administrative' THEN
- classtype = NEW.type || NEW.admin_level::TEXT;
- ELSE
- classtype = NEW.type;
- END IF;
- SELECT l.rank_search, l.rank_address FROM address_levels l
- WHERE (l.country_code = NEW.country_code or l.country_code is NULL)
- AND l.class = NEW.class AND (l.type = classtype or l.type is NULL)
- ORDER BY l.country_code, l.class, l.type LIMIT 1
- INTO NEW.rank_search, NEW.rank_address;
-
- IF NEW.rank_search is NULL THEN
- NEW.rank_search := 30;
- END IF;
-
- IF NEW.rank_address is NULL THEN
- NEW.rank_address := 30;
- END IF;