ImportOGR introduces uncommanded split polygons in source data

I'm working testing my buildings categorisation only, without splitting complex polys using ReplacePolygonByBuildingRectangles yet.

The attached image shows just one building polygon, in red is the source data poly, in colour below that is the polygon exported back to shp file AFTER only running multiple AddAttribute commands to categorise the building polygons. (The different colours represent different building categories applied using AddAttribute.) I was expecting the whole poly to come back as a single poly with a single BUILDTYPE attribute.

It appears that something (I believe the internal courtyard areas?) is causing the complex poly to be split up in an uncommanded fashion. Closer inspection of more data shows that ANY building poly with an internal courtyard area exhibits these splits being made from two vertices belonging to each internal courtyard, each going to an apparently random point on a poly line.

The splits DO NOT go to the nearest vertex on a nearby poly side, nor do they take the shortest distance between an internal courtyard vertex and an external poly line. It looks to me from their positioning as though there is some logic behind their placement in that a number follow the same 'radial' and are definitely not random.

It doesn't appear to me that I can exert any control over where or how these splits take place. The positioning of these splits makes a complete dogs breakfast of any attempts to split sub-elements of complex buildings using ReplacePolygonByBuildingRectangles and categorise the resulting parts though!

I deduce from the fact that different split components of the poly have different BUILDTYPE attributes, that the splits in the polygons must have been introduced prior to the AddAttribute commands in my script. The only process before that is the ImportOGR step, hence these splits must be introduced somehow during that step. So...

Q:Has anyone encountered this before?
Q:Is this introduced by Scenproc?
Q:If so, is this intentional?
Q:If so, why?
Q:If not, does anyone know a way it can be prevented/avoided please? :p

Thanks Kevin :)



Staff member
FSDevConf team
Resource contributor

Yes, this is by design. Since FS doesn't support holes in polygons scenproc removes the holes on import. And this can split the polygon.

There is an option to not process holes, in that case only the outer ring is read.

I have an update in development with better support for holes. In that case they are only removed just before writing the agn files.
Thanks Arno,
I have read that part of the manual repeatedly :banghead: Advice to self... RTFM again!
I wanted to use the holes if at all possible, so don't want to not process them unless its unavoidable. I suppose cleaner building splits (sans courtyards) are a better solution than weird splits that cause unrepresentative autogen in FS. Thanks again for Scenproc, it's a fascinating utility once you start nosing around in it :)
Cheers K


Staff member
FSDevConf team
Resource contributor
The autogen buildings can't handle such holes very well, since they always have to be rectangular. So I guess you get better results if you leave them out.

But I'm sure there will be polygons that look unrealistic without the holes as well :)