1

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:networkRef>
    <net:NetworkReference>
      <net:element xlink:href="#usrn44302253"/>
    </net:NetworkReference>
  </net:networkRef>
  <net:inspireId>

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:

OGRFeature(Maintenance):131433
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 May 17 '16 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 May 17 '16 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 May 17 '16 at 13:29
  • @user30184, I did not try GML_SKIP_RESOLVE_ELEMS to NONE. Do I simply add this into the ogr command? – Matt May 18 '16 at 6:26
  • Add --config GML_SKIP_RESOLVE_ELEMS NONE. This is documented in gdal.org/ogr_utilities.html. – user30184 May 18 '16 at 7:19
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, privacy policy and cookie policy

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