• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

GIS data to .agn using Rhino 5 and python script

Hi Gary,
The code example you are asking about is the part splitting large polygons. It is a process where I calculate the size of the polygon (by generating a bounding box and measuring it). If the polygon is definitely present in less than two by two (4) cells (<800x1200m), the code draws the four relevant LOD 13 cells. If the polygon is wide enough to span more than two LOD cells, the same calculation is done but on the basis of three by three (9) cells.
This is done to optimize performance, since most polygons are never spanning more than two by two cells.

The generation of the LOD rectangles is done by calling a function (def Lod13Location). This calculates the precise corners of the LOD cell.

Here is a part of that code:
<CODE>
while i < 15:
#Get the lat/long values for centre of the current lat/long bounds
centerLong = ( leftLong + rightLong ) / 2
centerLat = ( topLat + bottomLat ) / 2
</CODE>

This defines the LOD corners very precise, by evaluating in which lodquadrant a point is and from that returning the four corners. This is done in 15 iterations, from LOD -2 down to LOD 13. The function also generate the name of the LOD cell. (the quad number, 0,1,2 or 3, is returned for each iteration)

Then, in SplitByLodCells, the polygon is intersected with these cells, creating between one and four new polygons, each inside one cell only.

Here is a little test i did that might better explain what is going on:
I made some points across Denmark, some 600 meters apart, in an UTM coordinate system.
Then i made a small script that draws the LOD13 cells, of which each point is part.

Here is the code:

<CODE>
import rhinoscriptsyntax as rs
import math as m

#get a number of points
points = rs.GetObjects("points for which you want to draw the LOD13, they are part of: ", rs.filter.point)

#run the LOD13 cell calculation
for point in points:
Lod13Location(GetLatLon(rs.PointCoordinates(point)))
</CODE>

Note that each point is converted to LatLon, then fed to the Lod13Location-function. It happens in this line: Lod13Location(GetLatLon(rs.PointCoordinates(point)))
I used three functions in the script: GetUtm(lat, lon), GetLatLon(point), and Lod13Location(latLon). I did not put the functions in this code example, as they would make it hard to read this forum entry.

and here are four pictures showing the process. The pictures show:
a) the area
b) the points
c) the generated LOD cells after the script has run. Note how the rotation of the LOD cells increases as the points are more and more to the east.
d) a zoom in showing the cells and the points.

vhvji8.jpg


Unfortunately Rhino does not handle .shp files, but deals with a wide range of file formats, here is a list:
iyh9jt.jpg


regards, Ole
 
Last edited:
Hi Gary,

I was just curious if you might add further info to it as you gain additional insights.

Yes, when I learn new things I will also update the document.
 
Thanks to all for an interesting exploration of these new approaches for autogen scenery creation. :)


It will be interesting to see how this process evolves over time to accommodate both prepared / down-loadable, and custom / end-user created vector data for use in FS scenery creation from ex: SHP files and/or MapInfo files etc.


Hopefully, we will see a GUI-based platform to make autogen scenery creation more accessible to FS developers who, due to:

* Lack of sufficiently detailed data
* Total lack of data
* A preference to avoid expenses / complexities / constraints of licensing commercially available data for geographic areas of interest

... are compelled to create some (or all) required source data for a project. :idea:

Regards,

GaryGB
 
I have now released forest autogen definitions for the whole of Denmark. The file is found by searching for 'danvfr' in the www.flightsim.com file library. The trees must be placed on top of a photoscenery, so I am afraid the only available photoscenery available (DanVfr) needs to be installed in order to check it out. This post is not to advertise, have no connection with that product, but rather to tell that the technique is now available and working, should anyone find it useful in another context. I am attaching the three python scripts I have used to process the GIS data.
-Ole

GIS_forestData_RhinoToAgn.zip

FSXautogentreestsDanVfr10_DKtrees1.jpg
 
Last edited:
Back
Top