Trying to import Dutch Infrastructure GML using OGR GMLAS driver, but no geometries?

It turns out the secret is to list all the schemas on the command line rather than just the root one. So after fetching the schemas (look for a list of imports in the top of imkl2015-wion.xsd) you can run:

ogr2ogr -f PostgreSQL -s_srs epsg:28992 -t_srs epsg:4326 PG:'host=localhost user=ian dbname=gml_test schemas=test2' \
 GMLAS:19G000603_1/GI_gebiedsinformatielevering_19G000603_1.xml \
 -nlt CONVERT_TO_LINEAR -skipfailures  \
 -oo XSD=ElectricityNetwork.xsd,imkl2015-wion.xsd,Leveringsinformatie-2.1.xsd,OilGasChemicalsNetwork.xsd,SewerNetwork.xsd,TelecommunicationsNetwork.xsd,ThermalNetwork.xsd,UtilityNetworksCommon.xsd,WaterNetwork.xsd \
 -oo CONFIG_FILE=./gmlasconf.xml \
 -oo REMOVE_UNUSED_LAYERS=YES -oo REMOVE_UNUSED_FIELDS=YES -lco LAUNDER=NO

And you will get 82 (or so) tables in your schema and can then tie them together using a view like:

CREATE OR REPLACE VIEW test.v_OlieGasChemicalienPijpleiding AS                  
 SELECT r.*,                                                                    
    replace(u."thema_href"::text, 'http://definities.geostandaarden.nl/imkl2015/id/waarde/Thema/'::text, ''::text) as thema,
    replace(r."currentStatus_href"::text, 'http://inspire.ec.europa.eu/codelist/ConditionOfFacilityValue/'::text, ''::text) AS "currentStatus",
    replace(u."utilityNetworkType_href"::text, 'http://inspire.ec.europa.eu/codelist/UtilityNetworkTypeValue/'::text, ''::text) AS "UtilityNetworkTypeValue",
    g."centrelineGeometry"                                                      
   FROM test."OlieGasChemicalienPijpleiding" r                                  
     JOIN test."OlieGasChemicalienPijpleiding_inNetwork" i ON r.ogr_pkid::text = i.parent_ogr_pkid::text
     JOIN test."OlieGasChemicalienPijpleiding_link" l ON r.ogr_pkid::text = l.parent_ogr_pkid::text
     JOIN test."Utiliteitsnet" u ON i.href::text = u.id::text                   
     JOIN test."UtilityLink" g ON l.href::text = g.id::text;                    

ALTER TABLE test.v_OlieGasChemicalienPijpleiding                                
  OWNER TO ian; 

Ideally, I'd like to avoid the replace functions but that would seem to involve rewriting the SLD files instead, unless there is another option to the GMLAS driver I'm missing.

Tags:

Gml

Ogr2Ogr