I can't get SetAGNBuildingHeight to work with buildings and landuse shape files

Hi,

I have the following code and log where AddAttributeIfInside generates around 47k features.
I know that many building polygons are within the landuse polygons indicated by fclass.
I understand SetAGNBuildingHeight applies to each cell and there must be at least one building polygon within a landuse polygon wholly within a cell, for the height to be set.
Yet SetAGNBuildingHeight doesn't set the height of any.

What am I missing?

Just in case it's relevant, fclass exists in both shp (ESRI Shape) files but has different values in each.

Code:
ImportOGR|buildings.shp|*|*|NOREPROJ
ImportOGR|landuse.shp|*|*|NOREPROJ
SplitGrid|AGN|*|FROMFILE="buildings.shp"
AddAttributeIfInside|FROMFILE="buildings.shp"|FROMFILE="landuse.shp" and (fclass="farm" or fclass="forest" or fclass="heath" or fclass="nature_reserve" or fclass="meadow" or fclass="orchard")|String;area|rural
SetAGNBuildingHeight|area="rural"|0.8;0.2;0.0;0.0
Code:
19:58    ImportOGR    Information    Reading file buildings.shp
19:58    ImportOGR    Information    Read 69720 features from file
19:58    ImportOGR    Information    Reading file landuse.shp
19:58    ImportOGR    Information    Read 21092 features from file
19:58    SplitGrid    Information    Splitting features in 0.0146484375 x 0.010986328125 grid...
19:58    SplitGrid    Information    Features divided in 5925 cells
19:58    AddAttributeIfInside    Information    Adding attribute area with value urban to features FROMFILE="buildings.shp" that are inside FTYPE="POLYGON" AND (FROMFILE="landuse.shp" and (fclass="allotment" or fclass="cemetary" or fclass="grass" or fclass="park" or fclass="recreation_ground" or fclass="residential"))
19:58    AddAttributeIfInside    Information    Added attribute to 46932 features
19:58    SetAGNBuildingHeight    Information    Setting autogen building height...
19:58    SetAGNBuildingHeight    Information    Set autogen building height for 0 cells
19:58    SceneryProcessor    Information    scenProc finished processing
19:58    SceneryProcessor    Information        5.44 seconds for IMPORTOGR
19:58    SceneryProcessor    Information        8.50 seconds for SPLITGRID
19:58    SceneryProcessor    Information       20.81 seconds for ADDATTRIBUTEIFINSIDE
19:58    SceneryProcessor    Information        6.66 seconds for SETAGNBUILDINGHEIGHT
19:58    SceneryProcessor    Information       41.42 seconds total
Any example scripts or any other help you can provide will be greatly appreciated :)

PS - thanks Arno for creating such a great autogen manipulation tool.

Regards,

Stuart
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi Stuart,

The SetAGNBuildingHeight step uses cell attributes (so that are attributes set on the entire cell, not on a single feature). So the area="rural" attribute you added to the features is not seen when you try to select the cells.

What you need to do is use the SetCellAttributeIfInside step. With that step you can test if the center of the cell is inside a polygon or not. And it will add a cell attribute if that is true. Then you can use that cell attribute to set the building height differently per cell.
 
Hi Arno,

Wow thanks for a such a quick response.

I can see that I need to learn to read AND comprehend, as your answer is already plainly stated in section 5.7 of the manual.
I now have :-

Code:
AddCellAttributeIfInside|*|FROMFILE="landuse.shp" and (fclass="allotment" or fclass="cemetary" or fclass="grass" or fclass="park" or fclass="recreation_ground" or fclass="residential")|String;area|urban
The SetAGNBuildingHeight now sets the height on 202 cells.

Thanks again.

Regards,

Stuart
 
Top