I'm working with a new OS dataset, Highways Network, trying to get it loaded into Postgres and set up in some kind of usable state.

I've loaded all the data already, but it seems some elements of what is contained in the GML files have not been included.

Here is a section of the GML:

<ram:Maintenance gml:id="id_1770MA01526959">
  <gml:identifier codeSpace="http://inspire.jrc.ec.europa.eu/ids">http://data.os.uk/id/1770MA01526959</gml:identifier>
      <net:element xlink:href="#usrn44302253"/>

The element that has not loaded is: xlink:href="#usrn44302253"

If I run ogrinfo on the GML, it does not even pick up the #usrn:

gml_id (String) = id_1050MA01364874
identifier (String) = http://data.os.uk/id/1050MA01364874
localId (String) = 1050MA01364874
namespace (String) = http://data.os.uk/
beginLifespanVersion (String) = 2016-03-15T00:00:00.000
maintenanceResponsibility (String) = Maintainable At Public Expense
maintenanceAuthority|ResponsibleAuthority|identifier (Integer) = 1050
authorityName (String) = Derbyshire
partialReference (String) = false
highwayAuthority|ResponsibleAuthority|identifier (Integer) = 1050
highwayAuthority|ResponsibleAuthority|authorityName (String) = Derbyshire
reasonForChange (String) = New
locationDescription (String) = (null)

Everything else listed above has been loaded successfully into postgres.

Can anyone tell me why this is, and how I can persuade ogr2ogr to load the #usrn as well as everything else?

  • Can you provide the ogr command that you used to load it?
    – artwork21
    Commented May 17, 2016 at 12:41
  • @artwork21, it was a few days ago and I didn't note down the exact command, but it would have been something straightforward, along the lines of: ogr2ogr "PostgreSQL" PG:"host= dbname= user= password=" -t_srs EPSG:27700
    – Matt
    Commented May 17, 2016 at 13:15
  • Inspire datasets can't be easily translated into the GDAL data model that is based on simple features. Your issue seems to be with xlink resolving. There is something about that in GDAL driver page gdal.org/drv_gml.html. Have you set the configuration option GML_SKIP_RESOLVE_ELEMS to NONE to enable resolution?
    – user30184
    Commented May 17, 2016 at 13:29
  • @user30184, I did not try GML_SKIP_RESOLVE_ELEMS to NONE. Do I simply add this into the ogr command?
    – Matt
    Commented May 18, 2016 at 6:26
  • Add --config GML_SKIP_RESOLVE_ELEMS NONE. This is documented in gdal.org/ogr_utilities.html.
    – user30184
    Commented May 18, 2016 at 7:19

1 Answer 1


So the answer seems to be; it's not possible.

ogr2ogr does not pick up on xlinks in GML files.

My solution was to use Safe FME to load the data instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.