4

I am relatively inexperienced with QGIS. I seeking to access building footprints in a 20km radius from the centre of Melbourne city, Australia.

The dataset I am hoping to use is Bing's 2020 Australia Building Footprint collection that is located here and can be downloaded here.

The problem I'm encountering is that the unzipped file is a 6+ gb large GeoJSON file, with from what I understand that has no layers, just polygon data. The file covers all of Australia and is too large clearly to large to open straight up in QGIS.

How can I view, filter or trim the data down to access the selection I would like.

1

2 Answers 2

8

Building :) on BERA's answer, you could use ogr2ogr to select just buildings within a 20km buffer of Melbourne using a sqlite sql query.

I would still load all buildings to a geopackage first to take advantage of the spatial indexing, then select out Melbourne buildings.

The below SQL statement assumes Melbourne lon, lat is 144.9631,-37.8136, makes a point, reprojects to VicGrid 94 (EPSG:3111), buffers by 20km, projects the buffer back to WGS84 (EPSG:4326) and uses that buffer to select any building polys that intersect it.

ogr2ogr Australia.gpkg Australia.geojson Australia
ogr2ogr -update -dialect sqlite -sql "select * from Australia a where Intersects(a.geom, Transform(Buffer(Transform(MakePoint(144.9631,-37.8136, 4326), 3111),  20000), 4326))" -nln Melbourne Australia.gpkg Australia.gpkg

enter image description here

1
  • This and the answer below has both helped me to get it to work. Thank you!
    – J.Watt
    Commented Sep 13, 2023 at 8:04
6

Large geojson files can be extremly slow to open and display in QGIS. You can convert it to a geopackage using ogr2ogr which will open alot quicker.

My environmental variables are broken so I specify full path to the executable but for you it might be enough with just ogr2ogr.

C:\OSGeo4W\bin\ogr2ogr.exe C:\GIS\GIStest\buildings_sweden.gpkg C:\GIS\GIStest\buildings_sweden.geojson -lco SPATIAL_INDEX=YES

enter image description here

I believe spatial index creation is default, I just added it to be sure.

When you've opened the geopackage in QGIS you can Select the features you want to keep, right-click and export selected features to a new file.

2
  • 4
    It is also possible to convert just a subset of data with ogr2ogr. Study the parameters gdal.org/programs/ogr2ogr.html. For example -spat can be used for trimming by a bounding box. The conversion is not much faster because GeoJSON is unindexed and ogr2ogr must still read the whole input file.
    – user30184
    Commented Aug 24, 2023 at 5:51
  • 1
    This and the other answer has both helped me to get it to work. Thank you!
    – J.Watt
    Commented Sep 13, 2023 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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