A cool python script has been created that allows you to easily convert your google location (Takeout) data into a shapefile.
You can get your data from: Google Takeout
And you only need the “Location History – JSON format”
The conversion python script can be downloaded from: GitHub
The python script requires GDAL and its python bindings, but can be easily run if you installed QGIS using the OSGeo4W installer. From the advanced installer, under the Lib section.
Had to open data source read-only.
INFO: Open of 'os-mastermap-topography-layer-sample-data.gml'
using driver 'GML' successful.
1: TopographicArea (Polygon)
2: CartographicText (Point)
3: CartographicSymbol (Point)
4: BoundaryLine (Line String)
5: TopographicPoint (Point)
6: TopographicLine (Line String)
So we have 6 layers in total.
For MasterMap in CAD we will be mainly interested in CartographicText, TopographicPoint, and TopographicLine.
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.
layer names ignored in combination with -sql.
ERROR 1: No known way to write feature with geometry 'None'.
ERROR 1: Unable to write feature 0 from layer SELECT.
ERROR 1: Terminating translation prematurely after failed
translation from sql statement.
Not quite. Seems to be missing geometry, perhaps a SQL select issue.
This can be tested with:
ogrinfo os-mastermap-topography-layer-sample-data.gml TopographicLine -sql "select descriptiveGroup || ' - ' || descriptiveTerm as Layer from TopographicLine" -dialect SQLITE
Result:
OGRFeature(SELECT):14634
Layer (String) = Building - Outline
OGRFeature(SELECT):14635
Layer (String) = Building - Outline
So we do not have any geometry. Lets bring that in.
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:
ogr2ogr -f DXF TopographicLine2.dxf os-mastermap-topography-layer-sample-data.gml TopographicLine -sql "select descriptiveGroup ||' - '|| coalesce(descriptiveTerm,'') as Layer, * from TopographicLine" -dialect SQLITE
Looking better:
But it won’t open in AutoCAD DWG TrueView. Lets try running it through a ShapeFile format first before the DXF conversion.
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.