- IF (startnumber > endnumber) THEN
- housenum := endnumber;
- endnumber := startnumber;
- startnumber := housenum;
- sectiongeo := ST_Reverse(sectiongeo);
- END IF;
- orginalstartnumber := startnumber;
- originalnumberrange := endnumber - startnumber;
-
- startnumber := startnumber + stepsize;
- -- correct for odd/even
- IF (interpolationtype = 'odd' AND startnumber%2 = 0)
- OR (interpolationtype = 'even' AND startnumber%2 = 1) THEN
- startnumber := startnumber - 1;
- END IF;
- endnumber := endnumber - 1;
-
- -- keep for compatibility with previous versions
- delete from placex where osm_type = 'N' and osm_id = prevnode.osm_id
- and place_id != prevnode.place_id and class = 'place'
- and type = 'house';
- FOR housenum IN startnumber..endnumber BY stepsize LOOP
- pointgeo := ST_LineInterpolatePoint(sectiongeo, (housenum::float-orginalstartnumber::float)/originalnumberrange::float);
- insert into placex (place_id, partition, osm_type, osm_id,
- class, type, admin_level, housenumber,
- postcode,
- country_code, parent_place_id, rank_address, rank_search,
- indexed_status, indexed_date, geometry_sector,
- calculated_country_code, centroid, geometry)
- values (nextval('seq_place'), partition, 'W', wayid,
- 'place', 'address', prevnode.admin_level, housenum,
- coalesce(prevnode.postcode, defpostalcode),
- prevnode.country_code, parent_id, 30, 30,
- 0, now(), geometry_sector, country_code,
- pointgeo, pointgeo);
- newpoints := newpoints + 1;
---RAISE WARNING 'interpolation number % % ',prevnode.place_id,housenum;
- END LOOP;