AstunTechnology / Loader

GML & KML loader written in Python using OGR
MIT License
56 stars 35 forks source link

Support for OSMM Highways Network #60

Open walkermatt opened 6 years ago

walkermatt commented 6 years ago

This issue is to track progress on adding support for OSMM Highways Network.

WIP config notes can be found on the wiki: Ordnance Survey OSMM Highways Network to PostgreSQL/PostGIS.

Note: 016624f or later is currently required to use the --config GML_GFS_TEMPLATE $gfs_file option within the ogr_cmd.

/cc @archaeogeek

archaeogeek commented 6 years ago

I think we can generate a more complete gfs by including the configuration parameter GML_ATTRIBUTES_TO_OGR_FIELDS YES in the ogrinfo command that we're using to generate it.

cf the results of:

ogrinfo --config GML_ATTRIBUTES_TO_OGR_FIELDS YES -ro -so -al Highways_Rrami_RoadLink_INITIAL_001.gml

with:

ogrinfo -ro -so -al Highways_Rrami_RoadLink_INITIAL_001.gml

The latter adds the following to the gfs, amongst other things:

<PropertyDefn>
      <Name>directionality_title</Name>
      <ElementPath>directionality@title</ElementPath>
      <Type>String</Type>
      <Width>21</Width>
</PropertyDefn>
<PropertyDefn>
      <Name>directionality_href</Name>
      <ElementPath>directionality_href</ElementPath>
      <Type>String</Type>
      <Width>75</Width>
</PropertyDefn>
walkermatt commented 6 years ago

To have ogrinfo create a set of gfs files try:

# Extract gml files
find -type f -iname '*.gz' -exec gunzip --force --keep '{}' \;

# Update gml so ogr can read it
find -type f -iname '*.gml' -exec sed -i -e 's/os:Transaction/os:FeatureCollection/' -e 's/os:insert/os:featureMember/' '{}' \;

# Have ogr create default .gfs files for each gml
find -type f -iname '*.gml' -exec ogrinfo -ro -so '{}' \;