Env2CSV
Env2CSV converts X-Plane .env files (scenery files) into .csv text files
(comma-separated value files) and back. This allows you to edit your
scenery files with a text editor or a spread sheet.
Some of the things you can do with a scenery file once it is in text form:
- Cut and paste objects or vector roads from one file into another.
- Search-and-replace textures or objects.
- Add new objects or roads.
- Process elevations with a spreadsheet program.
Using Env2CSV
To convert an .env file to .csv form, drag the .env file into the Env2CSV
window. A new file with the same name but .csv extension will be created.
To convert a .csv file back to an .env file, drag the .csv file into the
Env2CSV window. A new file with the same name but the extension _NEW.csv
will be created.
Env2CSV will read any X-Plane 6 or 7 .env file, but will always create the
latest X-Plane .env files, which are compatible with XP 6.50, 6.60, 6.70
and all 7.xx X-planes.
The CSV Format
The .csv format for env files is a text file. Each line must contain
either a line of data, a blank line, or a comment starting with #. Comments
can be anywhere; when an .env file is converted to a .csv, Env2CSV inserts
comments between the sections to help you locate them, but these comments
do not affect parsing. You may put a comment anywhere in the file.
The .csv file is made up of several sections. Some sections are defined
by the number of active (non comment, non blank) lines, while others require
a special line to end the section.
The Mesh Section
The first part of your .csv file is the mesh. The mesh describes the
elevation and land use of the .env file, as well as custom textures. There
are 30351 elevation points in a single .env file (201 points north-south
and 151 points east-west). You must have exactly this many active lines
for the CSV line format to work. The Mesh section ends after 30351
active lines. Each line contains one point, starting in the southwest
corner of the file, moving east, then moving to the west edge and slightly
north. The format of a line is 10 numbers, separated by commas. Values
that describe quads (and not points) describe the quad to the northeast of
the point. In order those values are:
- Latitude of the point in degrees.
- Longitude of the point in degrees.
- Elevation of the point in meters above mean sea level.
- Either a GLOS land use number of a custom texture index number
for the land use for the northeast adjoining quad.
- 1 for a custom texture, 0 for a land use code.
- For custom textures: Rotation of a custom texture in degrees or 0 for
land uses.
- For custom textures: Fraction of the custom texture to use (0 = use
all, 1 = use half, 2 = use one third, etc.)
- For custom textures: Offset into the texture horizontally in units
from above (e.g. if above is 1, 0 here means use first half, 1 means use
second half).
- For custom textures: Offset into the texture vertically in units from
above.
- For land uses: a join code describing how water bridges this quad.
Values that are not needed (e.g join codes for custom texture are 0). For
more info on how the mesh is described, see this link for a description of
the .env file format; the .csv format is a verbatim translation.
The Objects Section
The object section specifies the placement of objects within the file. Each
object is on a separate line. The single word END on a line specifies
the end of the section. Each object on the line consists of the following
values specified by a comma:
- Latitude
- Longitude
- Height of a default object in meters or rotation of a custom object
in degrees
- The type of object
- The name of a custom object (no .obj extension) if the object is custom.
For more info on the codes for default and custom objects, see this link.
The Vectors Section
The vectors section consists of six lists of vectors, each ending with a
single line END. Each vector line contains three numbers: a latitude,
a longitude, and 0 if the line continues or 1 if it terminates. In
order the vectors in the file are: roads, walking trails, railways, power
lines, taxiway centerlines, and thin rivers.
Each vector is essentially a chain of points; four lines of vectors (three
ending in zero and the last ending in one) defines a chain with three connected
segments.
The Custom Textures Section
The custom textures section consists of the names of the custom textures
used in the .env file, without the .bmp or .png extension, one texture to
a line. The line END indicates the end of this section. Custom
textures in the mesh are referred to by number, based on this table; the
first listed texture will be number zero, the second number one, etc.