ogr2ifc converts GIS data to BIM models using GDAL/OGR (read) and IfcOpenShell-python (write).
This allows the import or visualisation of GIS data in a BIM project.
All GIS vector data formats supported by GDAL/OGR can be converted.
GIS features are converted to IfcProduct/IfcWall elements. GIS attributes are also added to the IFC element as custom property sets.
GIS geometries can be converted to multiple IfcShapeRepresentations.
Coordinates can be transformed to match the BIM project coordinate system using simple transformation and rotation, or a custom coordinate transformation can be applied by passing a transformation function.
Depending on the source and destination representation geometry types, GIS geometries are extruded vertically to produce lines, surfaces or volumes.
Extrusion boundaries can be defined using fixed elevations, or using attribute values from each GIS feature
(eg: 'floor-slab_elevation'
and 'roof_apex'
) data attributes.
This tool is currently in development, but is useable in it's current state.
- Polygon implemented (swept solid extrusion)
- Inner holes supported
- Multipolygons supported
- Attributes added as custom property set
- Coordinate transformation from GIS to BIM coordinate system
- Points, lines, footprints
- Curved geometry
- Surfaces
- Create features as part of IfcSpace instead of IfcBuilding
- use of IFC4 HasCoordinateOperation/IfcMapConversion as alternative to transformation
Dependencies:
- Python 3
Copy file ogr2ifc.py
to the script folder or to a folder on the python module search path.
Type python ogr2ifc.py -h
for help with the command line use.
Example use in command line:
python ogr2ifc.py gis2bim.ifc polygons.shp -top 520 -bottom 450
The python classes offer more flexibility and functionality, including coordinate transformations.
See the main conversion class Ogr2Ifc
for details.
Example use in python scripts:
o2i = Ogr2Ifc('gis_files/complex.gpkg', bottom_elevation='bottom', top_elevation='top')
o2i.add_vector_layers('multipolies')
o2i.save_ifc('test.ifc')
Multiple IfcShapeRepresentations can be created for each feature, as shown in the table below.
Ogr2Ifc Attribute (IFC shape representation identifier) |
Description | Implemented for OGRGeometry Class | |||
---|---|---|---|---|---|
Point | Line | Polygon | Triangle/Polyhedral/TIN | ||
CoG |
Center of gravity 3D IfcCartesianPoint |
(Y) | (Y) | (Y) | |
Box |
Bounding box | (Y*) | |||
Axis |
Line representation of an element | (Y*) | |||
FootPrint |
Foot print projected to ground view | (Y) | |||
Surface |
3D Surface representation | (Y*) | (Y) | ||
Body |
3D Body representation | Y* | |||
* Extruded to elevation bounds (Y) planned functionality |
If an IfcShapeRepresentation is not desired, this can be prevented
by setting the relevant Ogr2Ifc
attribute to False
prior to conversion.
For example:
o2i = Ogr2Ifc('gis_files/complex.gpkg')
o2i.Box = False
...
To convert coordinates from a GIS WorldCoordinateSystem to the IFC project coordinate system, a function can be created and passed to the converter as follows:
from ogr2ifc import Ogr2Ifc, transformer
# Create coordinate transformation function
coord_tran = transformer(eastings=2719310, northings=1225070,
orthogonal_height=410.10, rotation=44.2939)
# Convert
o2i = Ogr2Ifc('gis_files/poly.shp', coord_transformer=coord_tran)
Custom transformations can also be provided, for example any shapely transformation, including map reprojections.