GIS to CAD using ogr2ogr – Part 2 – GML to DXF with OS MasterMap

GIS to CAD using ogr2ogr – Part 1 – Shp to DXF with Contour Data
GIS to CAD using ogr2ogr – Part 3 – Point Annotation to Text in CAD

For this example we are using Ordnance Survey MasterMap Topology Layer data.

MasterMap Topo Sample Data:

https://www.ordnancesurvey.co.uk/business-and-government/licensing/sample-data/discover-data.html

Now we know that we can maintain an attribute through layers, as we saw in the shp to DXF example, the export of MasterMap should be straightforward.

Let’s first see what the GML file contains.

So we have 6 layers in total.

For MasterMap in CAD we will be mainly interested in CartographicText, TopographicPoint, and TopographicLine.

Lets start with TopographicLine.

Nothing too useful.

A bit more details:

Sample:

For this feature the “descriptiveGroup”” seems the most useful, and from reading the os-mastermap-topography-layer-user-guide.pdf the best would be either a combination of descriptiveGroup and descriptiveTerm or using the featureCode. Since this is a simple conversion we will just use a combo of descriptiveGroup and descriptiveTerm to create our DXF layers.

I will be using || for concatenation, which works with the SQlite SQL dialect.

Result:

Not quite. Seems to be missing geometry, perhaps a SQL select issue.

This can be tested with:

Result:

So we do not have any geometry. Lets bring that in.

Geometry looks good:

Screenshot[6]

But if we check the attributes in QGIS:

Screenshot[7]

We can see that all of the attributes that are not 0 have both a descriptiveGroup and a descriptiveTerm, which was not what we can see in the ogrinfo summary. So our SQL statement is cutting some out.

Try again:

!!remove the !! and the space from the word after, the word in question breaks WordPress.

Looking better:

Screenshot[8]

But it won’t open in AutoCAD DWG TrueView. Lets try running it through a ShapeFile format first before the DXF conversion.

!!remove the !! and the space from the word after, the word in question breaks WordPress.

Success:

Screenshot[9]

No indication of why a direct GML to DXF conversion would hang TrueView, and your mileage with other CAD software may vary. But ShapeFile is a very simplified geometry format, so perhaps running through that helps with some more complex geometry in the GML. Hard to say with no errors from TrueView, just a stuck program.

Repeat for point:

!!remove the !! and the space from the word after, the word in question breaks WordPress.

3 thoughts on “GIS to CAD using ogr2ogr – Part 2 – GML to DXF with OS MasterMap

  1. Pingback: GIS to CAD using ogr2ogr – Part 2 – GML to DXF with OS MasterMap | GeoNe.ws

  2. Pingback: GIS to CAD using ogr2ogr – Part 1 – Shp to DXF with Contour Data | GIS for Thought

  3. Pingback: GIS to CAD using ogr2ogr – Part 3 – Point Annotation to Text in CAD | GIS for Thought

Leave a Reply

Your email address will not be published.