shapefile with holes (islands) in it

#1
Hello Arno,

I want to convert shapes of woodland to AGN but the shapefiles have lots of holes (clearances in the wood) which results in strange overlapping parts in the resulting AGN file.
Is it possible from your side to convert these kind of shapefiles correctly or is it neccessary to split (unhole) the polygons before feeding them to ScenProc?
Do you have any idea which program can do such splitting?

Is there any limitation in number of shapes or size (vertex count)?

Best Regards from Austria
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#2
Hi,

At the moment scenproc can not handle shapefiles with holes correctly, it's on my todo list to see if I can fix that. So for now you'd better process the files first.

I am not aware of a limit to the amount of vertices.
 
#3
Luckily GlobalMapper can "unhole" shapes very easy. I attached a screenshot where you can see that ScenProc has still problems with such cut-out polygons.
Some "holes" seems to be rendered properly but some others are not.

ScenProc is such a really great tool for converting my vegetation files to autogen, maybe you could take a peek look on this issue.
I can provide you all the source files if you need for testing.

Best Regards,
Heinrich
 

Attachments

rhumbaflappy

Moderator
Staff member
Resource contributor
#4
Hi Heinrich.

A bit off topic, but how do you use Global Mapper to unhole? That would be a very useful thing for FS9 as well as for scenproc.

Dick
 
#5
This information comes directly from the user manual (sometimes reading really helps :) )
--------------------------------------------------------------------------------
Converting Areas with Islands to Single Vertex List
If one or more area features with separate islands/holes within them are selected, the Create Single Vertex List Area From Selected Area(s) With Islands option will appear in the Advanced Feature Creation sub-menu of the right-click menu. When selected, this option will connect all of the islands/holes within the selected parent areas into a single vertex list and replace the original parent/island area with a new area that contains just that single vertex list. This is useful for converting areas with islands into a form that software that cannot handle areas with holes can make use of.


--------------------------------------------------------------------------------

Best Regards,
Heinrich
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#7
Hi,

It is on my todo list for scenproc, but I haven't had much time recently to work on it. I am also not sure how easy it will be to implement, since the internal representation of polygons in scenproc does not know about holes either.
 
#8
Arno,
there are no holes in my shape file anymore, I removed them with GlobalMapper by cutting the holes and connect them with the polygon but as you can see on the comparision screenshot of GlobalMapper and TmfViewer, converting convex shapes seems to be an issue in some cases.
_______
Heinrich
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#9
Hi,

Ah sorry, I missed that other question.

I think that is a limitation of fsx. To work around it the complex polygons would have to be split I think.
 
#10
Hello Arno,

I did some investigation on the issue with the mixed up AGN files produced by ScenProc and it seems that the splitting algorythm is a little buggy in some special cases.
First I attached two screenshots of a tiny shapefile. As you can see on the first image from GlobalMapper the shapefile is not that complicated and has only one inner part. On the second image, showing the resulting AGN-file in TMF-Viewer, the inner part is simply ignored and still filled with vegetation, eventually the vertex leading to the cut-out are too close to each other.

I attached another screenshot where you can see another issue with one tile completely ignored. Maybe both issues comes from the same bug.

I also attached the shapefile from the first example, I hope you can help.

Regards,
Heinrich
 

Attachments

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#11
Hi,

Thanks for the sample, I'll use it while debugging the issue with the holes.
 

Horst18519

Moderator
Staff member
Resource contributor
#13
On another note, Heinrich, did you find that the results in FSX fit your annotations in the Annotator? I wasn't happy with that for my current project, so I did some more SDK reading and found something interesting on this:
You need to increase the image_pixels value:
(default is 16, but the line is missing in the default fsx.cfg, so if you want another value, you need to add the line)

Code:
[TERRAIN]
...
IMAGE_PIXELS_FOR_AUTOGEN_POLYGONS=256
Explanation:
FSX does not use vectors to place vegetation polys, it processes those vectors into 1-bit images. Obviously, a 16x16 pixels image will not show a precise result of complex vegetations polys on a 1024x1024 landclass texture.
The higher the image_pixels value, the more precise the result, but of course this will hit your framerate. I found 256 to be a good compromise between precision and performance.

Maybe you already know this, just wanted to share this with others interested in that kind of AGN development.

EDIT: Make sure you also include this in the user manual. The user has to include that line in his FSX.cfg as well to get the same results.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#15
Hi Heinrich,

Not yet, I have been away for business in the last two weeks. But during that period I had a first look at reading OSM files with holes. From what I learned there adding support for shapefiles with holes should be possible later as well. I still have to test the issue you had with annotator not showing the right polygon. I expect to run into that as well.
 
#16
Hello Arno,

I did some more investigation on the issue with wrong decoding of shapefiles (img 1). It seems that scenProc is optimising or reducing vertex when decoding.

When I manually shift the vertexes (img 2) which are on the same position away from each other, your algorythm works correctly (img 3).

Regards,
Heinrich
 

Attachments

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#18
Hi,

I don't have your photo scenery here of course, so I can't test it in Annotator or FSX. But what I did is load your SHP file in scenProc, then use the splitgrid step and then export the result as SHP again.

What I see then is that there are two polygons and the hole is still represented correctly. Based on these polygons the autogen files would be written. So it might be that FSX / Annotator does not like polygons that have touching edges. That is often considered to be a faulty polygon.

Not sure how I can test that further now. But I might be able to widen the gap in the tool to work around it.
 
#19
Hello Arno,

I did the same and you are right, sorry but I had no idea that scenProc would be able to export shapefiles.
So maybe it would be possible for you to work around this problem by widen the gap as you mentioned.

Regards,
Heinrich
 
Last edited:
#20
Arno,
I did the same now with a bigger shapefile and there are still some glitches in the resulting shapefiles. If you export the shapes with scenProc you will notice some wrong or doubled polygons, mostly when they are not touching the surrounding AGN border. I attached the source shapefile.

Regards,
Heinrich
 

Attachments

Top