I have a road network with StreetName and min/max address ranges for each segment (ie- StreetName = 'Main St', Min = 100, Max = 199). I also have individual address points with similar information (ie- StreetName = 'Main St', HouseNumber = 115).
I would like to assign the featureid (gid) of road segments to each address point that has matching StreetName and falls within the min/max range of the road segment. In ArcGIS I would probably write a searchcursor for the roads and that would look cycle through each road segment, get the gid, name, min, & max values, and then do a query statement to find all address points with HouseNumbers that fall within the given segment range (ie- select AddressPoints where StreetName = 'Main St' and min >=100 and max <=199), calculate the gid of the road segment into a field for the selected points in the Address Point layer, then move on to the next road segment and repeat.
1) How would I write a similar cursor in postgres/postgis or 2) Is there a more efficient way of doing this?