Geo-referenced Geometry File Formats

Classic geometry file formats as .obj, .off, .ply, .stl or .dae do not support the utilization of coordinate systems besides from a local system, that can not be defined more precisely. This feature is a major requirement for global applications, exchanging geo-referenced models e.g. in the context of outdoor augmented reality applications.

For this reason, the present project evaluates different possibilities of geo-referenced geometry files.

Next to wide-spread standards as GeoVRML, X3D, CityJSON, GeoJSON, GML or KML, we introduce four geo-referenced extensions called .geoobj, .geooff, .geoply and .geostl. While, the named standard formats allow defining objects with multiple additional features, they also come with an overhead according to the file size and an increased structural complexity with disadvantages to the read performance. This overhead has to be minimized in many use cases and for this reason, some file formats are more suitable than others. For completeness: the overhead can be further reduced using binary representations (like binary obj or stl) instead of textual ones, but since not all named formats support a binary mode, this is ignored in favor of human-readability within this project and comparison.

Geo-referenced Extensions

In this chapter you can find multiple extensions of classic geometry file formats. All of these extensions support two major features:

  1. Defining the coordinate reference system (CRS) of the used vertices' coordinates
  2. Defining an optional origin, which represents an absolute geo-referenced location and an implicit local Cartesian coordinate frame for the models with a metric unic.

Geoobj

The .geoobj file format extends the classic .obj file format with two line-types:

  1. The crs line type is used to define the coordinate system which is used within the file
  2. The o line type is used to define the optional origin of the vertices

Example:

crs urn:ogc:def:crs:EPSG::4326
o 48.3028533074941 14.2842865755919 279.307006835938

Addons

Next to the geo-referencing features, the .geoobj extension also supports exchanging scale, rotation, as well as translation information in the origin-based variant using the following line prefixes:

  1. sc for adding scale information (s is already defined in .obj for smoothing groups)
  2. t for translation information
  3. r for rotation angular information

Example:

sc 1.5 2 5
t 10 -5 4
r 90 45 10

Next to that it also supports the optional geographical extent meta information, containing the minimal (first three values) and maximal (remaining three values) coordinate value expressions using the line prefix e. This information can be useful for filtering geo-referenced files without any need to iterate all vertices.

e -0.5 -0.5 -0.5 0.5 0.5 0.5

GeoOFF

The .geooff file format extends the classic .off file. For this we introduce a new file header using the GeoOFF prefix instead of OFF. The next non-empty line after this header is used to define the crs as well as the origin in a whitespace-separated style.

Example:

GeoOFF
urn:ogc:def:crs:EPSG::4326 48.3028533074941 14.2842865755919 279.307006835938

Geoply

The .geoply file format extends the classic .ply file format with two header-line-types:

  1. The crs line type is used to define the coordinate system which is used within the file
  2. The origin line type is used to define the optional origin of the vertices

In addition to those types it also changes the header from ply to geoply.

geoply
crs urn:ogc:def:crs:EPSG::4326
o 48.3028533074941 14.2842865755919 279.307006835938
...
end_header

Addons

Next to the geo-referencing features, the .geply extension also supports exchanging scale, rotation, as well as translation information using the following line prefixes:

  1. scale for adding scale information
  2. translate for translation information
  3. rotate for rotation angular information

Example:

geoply
...
scale 1.5 2 5
translate 10 -5 4
rotate 90 45 10
...
end_header

Next to that it also supports the optional geographical extent meta information, containing the minimal (first three values) and maximal (remaining three values) coordinate value expressions using the extent header. This information can be useful for filtering geo-referenced files without any need to iterate all vertices.

geoply
...
extent -0.5 -0.5 -0.5 0.5 0.5 0.5
...
end_header

Geostl

The .geostl file format extends the classic .stl file using the geosolid root element. Followed by the geosolid prefix of the file format a meta-data tuple is introduced. This tuple consists of the crs at the first position, followed by the optional origin coordinates and finally the optional stl name.

geosolid urn:ogc:def:crs:OGC:2:84 48.3028533074941 14.2842865755919 279.307006835938 fileName

File format comparison

The different named file formats come with a variable amount of features according to e.g. the supported CRS, an origin for specifying a local coordinate system, the meta information of the minimal and maximal coordinates (geographical extent), multi-object support or also differ in the representation of vertices. To take up the last point, some formats use e.g. central vertex lists with referencing indices in the face definition and others re-define the vertices within every indiviudal face. Next to that there are many different other features (e.g. smoothing groups in .obj, geographicalExtent in CityJSON or exact property definitions in .ply), which vary between the file formats and lead to a diverse semantic expressiveness.

FormatBase formatEncodingCoordinate Reference SystemMultiple ObjectsVertex ReferencesOrigin SupportTransformation InformationGeographical ExtentSemantic Expressiveness
CityJSONJSONTextAnyYesYesNoNoYes++
GeoJSONJSONTextWGS 84YesNoNoNoNo+
GeoObjOBJText *AnyYesYesYesYesYes~
GeoOFFOFFText *AnyNoYesYesNoNo-
GeoPlyPlyText *AnyNoYesYesYesYes~
GeoStlStlText *AnyNoNoYesNoNo--
GMLXMLTextAnyYesNoNoNoNo++
KMLXMLText or compressed (KMZ)WGS 84YesNoNoNoNo++
GeoVRMLVRMLText or BinaryWGS84 / EPSG4326 / UTMYesYesYesYesYes+
X3DXML, VRMLText or BinaryMultiple supported CRSYesYesYesYesYes++

* Currently, only text support, but the base format would support binary, so a binary extension would be possible.

Size comparison

The following file comparison uses the minimal required sub-set of the specific file formats to represent geo-referenced 3D models. Additional features (e.g. GeographicalExtent in CityJSON) are not considered as far as possible, to avoid a negative bias of the comparison. Next to that also the used reader does not support all features of the input files (e.g. .mtb material information) and may use different line-ending symbols (Windows vs Linux). This would lead to the situation that in some cases the input file size is greater than the geo-referenced version. For this reason we have decided to do a normalization first by reading the input files with our custom reader and exporting the normalized representation using our custom obj writer. The exported and normalized files are used as basis of comparison.

You can find the used obj files here. Also note that, X3D is currently not explicitly supported by the present framework since it can be encoded using XML or VRML. Next to that it is the successor of VRML and supports many features of GeoVRML within the geospatial extension with only minor differences. For this reason it would result in a comparable size when using the VRML encoding and is left out in the following comparison.

fileoriginalcityjsongeojsongeoobjgeoobj-origingeooffgeooff-origingeoplygeoply-origingeostlgeostl-origingeovrmlgeovrml-origingmlkml
alligator.obj184.07308.531402.25278.69184.16272.42177.89272.57178.041396.25877.531298.15779.872202.642237.52
armadillo.obj3608.545279.4323622.394791.053608.624693.413510.984693.563511.1423476.9216381.7422142.5415047.7936998.2737583.91
beast.obj3332.122850.399550.494087.923332.202566.041810.322566.191810.489686.466660.989516.066491.0013723.1513944.12
beetle-alt.obj1364.182037.859120.801847.801364.261808.951325.411809.101325.579067.756249.008517.675699.3514292.7414519.08
beetle.obj125.25105.10485.01155.55125.3392.3862.1692.5362.32599.52437.23444.46282.61759.87771.74
cheburashka.obj420.93667.263148.23601.94421.01588.91407.98589.06408.143129.512044.292914.981830.204932.365010.33
cow.obj182.93286.761369.35258.21183.01252.53177.33252.68177.491361.40909.951264.59813.572146.052179.90
fandisk.obj391.15646.643047.66583.21391.23570.56378.58570.71378.733031.651879.892823.321671.994779.884855.58
happy.obj3443.425200.3023271.054718.753443.504622.543347.304622.693347.4523134.5915475.1721818.1814159.1936462.9837040.56
homer.obj378.70600.332832.50541.53378.78529.80367.05529.95367.212815.801839.432622.711646.774438.164508.31
horse.obj4847.435161.5923251.474687.924847.514593.214752.804593.364752.9623025.4623982.4721729.7422687.1836224.6536792.65
igea.obj9716.5014490.7563413.2213178.609716.5812916.199454.1812916.349454.3363040.7642268.4559765.4138993.5399360.66100934.83
lucy.obj3728.415310.7223867.914822.383728.494724.743630.854724.893631.0123660.9117097.4422327.2115764.1737242.9937828.60
max-planck.obj3628.485296.9923729.974808.403628.574710.583530.754710.733530.9123558.6516499.0422223.0615163.8837107.8637693.59
nefertiti.obj3621.605288.2723695.484800.083621.684702.473524.074702.623524.2323529.7316459.2622196.3515126.3137066.2937651.70
ogre.obj3820.096569.3929260.925963.303820.175841.823698.695841.973698.8529090.9216271.9127450.4014631.8245852.0346578.48
rocker-arm.obj666.931008.574742.64910.28667.02890.65647.39890.80647.554714.263254.514394.582935.257430.397547.93
spot.obj334.84289.431380.09409.11334.92254.89180.70255.04180.861372.51927.391275.06830.382163.752197.91
stanford-bunny.obj2442.783719.0016390.433377.292442.863307.082372.643307.232372.8016294.3910877.7115350.559934.3125682.4126089.19
suzanne.obj48.6241.65149.1962.8948.7037.0422.8537.1923.01175.03119.80144.3789.58213.99217.22
teapot.obj202.44341.201489.62309.19202.52302.07195.40302.22195.551481.45937.851377.36834.202335.362372.23
woody.obj36.3363.44297.2456.9236.4255.5635.0655.7135.22295.92186.12272.52163.16466.95474.21
xyzrgb_dragon.obj9283.4913455.4759107.6912234.459283.5711990.179039.2911990.329039.4458735.0441041.1955643.1737949.7692555.0194019.69

Note: Sizes are in KiloByte (KB)

An interactive visualization of the size comparison can be found here.

Getting started

To set up and use the project have a look at the detailed description here

You can install the framework via pip:

pip install geofiles

Importing files

The present project supports multiple reader implementations for importing (geo-referenced) geometry files (.obj, .geoobj, .ply, .geoply, .off, .geooff, .stl, .geostl). Using one of these readers is the entrypoint to the framework and allows to create an in-memory geometry model using the GeoObjectFile class. Note that only a subset of the features of the named files are currently supported. So reading files with non-supported features may result in a loss of information (e.g. smoothing groups in .obj, or exact property definitions of .ply)

reader = GeoObjReader() path = "mygreatfile.geoobj"with open(path) as file: geoObjFile: GeoObjectFile = reader.read(file)

Converting

The present framework supports different conversion methodologies as converting from one to another coordinate reference system. Next to the CRS-conversion the framework also supports to transform between origin and non-origin based representations, as well as between geo-referenced and local representations. Finally, there is also basic support for transforming (scale, rotation, translation) a model's vertices.

# 1. Change coordinate systemconverter = CrsConverter() converted = converter.convert(geoObjFile, "urn:ogc:def:crs:OGC:2:84") # 2. Change to origin-based representationoriginconverter = OriginConverter() origin_based = originconverter.to_origin(converted) # 3. Apply transformationtransformer = Transformer() origin_based.scaling = [2, 2, 2] origin_based.translation = [5, 10, -5] origin_based.rotation = [45, 30, 90] transformed = transformer.transform(origin_based)

Exporting files

Finally, the in-memory model representations can be re-written to your hard drive using one of the writer implementations. Note:

  1. That you can find more writers than readers in this project for evaluation purposes. The additional writers only use a minimal subset of the specific file format's features as base for comparison and are not complete.
  2. That some file formats presuppose a specific CRS (e.g. .kml requires vertices in Wgs84 representation)
  3. Most file formats do not support transformation (scale, rotation, translation) meta-information. A model's vertices have to be transformed first before exported to such a file format.
  4. The writers will automatically append the specific file type (unless you set append_file_type to False)

writer = GeoPlyWriter() writer.write("mygreatfile.geoply", transformed, append_file_type=False)

FAQ

  • Why yet another 3D geometry file format like .geoobj?
  • During our research in the context of outdoor augmented reality applications, we were looking for a possibility for exchanging geo-referenced geometry models. In this context, the other named file formats come with a too high overhead (e.g. XML tags or not required meta information as object types like in CityJson) in our opinion and are for this reason not ideal.
  • You describe multiple geo-referenced file formats. Which one should I use for geo-referenced 3D models?
  • This depends on the use case. If you have to exchange the models with as little overhead as possible we recommend using the proposed .geoply, .geoobj or .geooff format extensions. If you require semantic expressiveness, you should prefer other formats like CityJson or GML.
  • How are vertices defined, if I use the origin-based approach of .geoobj, .geoply, .geooff or .geostl?
  • In the origin-based version, vertices are represented within a local Cartesian coordinate system with the defined origin as coordinate system origin (0, 0, 0). The units used in this type of coordinate system are assumed to be in meters.

GitHub

GitHub - FHOOEAIST/geofiles: Evaluation of file formats in the context of geo-referenced 3D geometries.
Evaluation of file formats in the context of geo-referenced 3D geometries. - GitHub - FHOOEAIST/geofiles: Evaluation of file formats in the context of geo-referenced 3D geometries.