I'm attempting to import a GML file containing 3D building models into PostGIS using ogr2ogr.

ogr2ogr -f PostgreSQL PG:"host=${hostname} port=${port} dbname=${db} \
    user=${user} password=${password}" ${gml_fp} \
    -progress -overwrite -oo GML_ATTRIBUTES_TO_OGR_FIELDS=YES

but when I perform the import none of the building geometry is imported. Running ogrinfo gives the following result:

$ ogrinfo ./DA_WISE_GMLs/DA10_3D_Buildings_Merged.gml -GEOM=YES -al -so -oo GML_ATTRIBUTES_TO_OGR_FIELDS=YES
INFO: Open of `./DA_WISE_GMLs/DA10_3D_Buildings_Merged.gml'
      using driver `GML' successful.

Layer name: Building
Geometry: None
Feature Count: 49847
Layer SRS WKT:
gml_id: String (0.0) NOT NULL
name: String (16.0)
BIN: Integer (0.0)
DOITT_ID: Integer (0.0)
SOURCE_ID: Integer64 (0.0)

My Postgres database has the PostGIS extensions installed, and I've tried setting the GML_ATTRIBUTES_TO_OGR_FIELDS parameter to yes. I've also tried importing the GML file into QGIS, but the layer properties show No geometry (WKB type: "NoGeometry").

The GML files I'm working with are too large to include here, but can be downloaded at NYC DOITT: https://www1.nyc.gov/site/doitt/initiatives/3d-building.page.

If it's relevant, the GML I downloaded came with the following files:


Can these files be passed to ogr2ogr during the conversion process? If so, how?

  • The DeliveryArea.* files are collectively a shapefile, probably describing the geographic extent of the other products in the archive. – vpipkt Feb 5 '19 at 18:19
  • OK @vpipkt, so I take it those aren't relevant to my problem here? – Jonathan Cox Feb 5 '19 at 18:31
  • You haven't shown the ogr2ogr command you are using, so it is a bit hard to tell where it is going wrong. I have downloaded the gml and it looks fine to me in a text editor. You might try using this code to load them: github.com/Oslandia/citygml2pgsql – John Powell Feb 6 '19 at 7:18
  • Added the ogr2ogr command per your request @JohnPowell – Jonathan Cox Feb 6 '19 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.