Comments (5)
I suspect QGIS is crashing because the file is too large. As @chris mentioned, you can split the geojson files into smaller chunks and work with it that way. Here's a python snippet that will look for individual polygon features and write line-delimited geojson (geojsonl) that QGIS can work with. This doesn't require additional modules over python's standard library. Hope that helps!
import json
# decompressed geojson file.
with open("Minnesota.geojson") as inf:
counter = 0
batch = 0
# adjust this value to change the number of features per file.
buildings_per_file = 500_000
file_template = "Minnesota-{}.geojsonl"
target_file = open(file_template.format(batch), 'w')
line = inf.readline()
while line:
# filter to look for polygon features
if 'Polygon' in line:
line = line.strip().strip(",")
parsed_line = json.loads(line)
geom = parsed_line['geometry']
target_file.write(f"{json.dumps(geom)}\n")
counter += 1
if (counter > 0 ) and ((counter % buildings_per_file) == 0):
target_file.close()
print(f"completing batch {batch:,}. total lines extracted: {counter:,}")
batch += 1
target_file = open(file_template.format(batch), 'w')
line = inf.readline()
target_file.close()
print(f"completing batch {batch:,}. total lines converted: {counter:,}")
from usbuildingfootprints.
Since you're using an ArcGIS product, maybe a shapefile will import better? If you have the GDAL command line tools, you could convert the GeoJSON file to a Shapefile with something like:
ogr2ogr -f "ESRI Shapefile" Minnesota.shp Minnesota.geojson
In general, most of these are quite large files, so opening the entire state in QGIS or similar may not be very workable. There are a variety of different ways you can do this, but I'd boil this down to two basic categories:
- Load the data into PostGIS and then do queries on it for what you're after. You can also query for the geometries within an area you're studying and then export that back out to GeoJSON.
- Write a program that reads in the GeoJSON and filters it similarly to PostGIS mentions above.
I've also seen some GeoJSON "splitting" utilities out there. I haven't used any, so don't know much about them, but they may be a way to simply break the single state file up into say 10 smaller files.
from usbuildingfootprints.
If anyone's looking for files that will load into QGIS (or similar software) quickly then I have a set I batch converted to GeoPackage (gpkg) with gdal - here they are: https://automaticknowledge.co.uk/us-building-footprints/
(note that they are not the very latest iteration of the files)
This is what I used to batch convert the files didn't take too long do do the whole set, maybe a few hours, and now I can load single states into QGIS much more quickly
for %f in (*.geojson) do ogr2ogr -f "GPKG" %~nf.gpkg %f
from usbuildingfootprints.
For anyone looking for files that load into QGIS (or other GIS software) much faster than the original geojson files, then we have produced an updated set of geopackage files for each state, available here:
https://automaticknowledge.co.uk/resources/#USBuildings
These were converted to gpkg from geojson and we also added in county codes and names so that users can filter by county if they need to.
from usbuildingfootprints.
Thank you!
from usbuildingfootprints.
Related Issues (20)
- 2018 buildings disappearing from 2021 edition
- Question: What % of all US buildings are estimated to be covered? HOT 1
- More details about polygonization algorithm? HOT 2
- Footprints for Ukraine HOT 1
- Extract polygons for a specific city from State GeoJson HOT 1
- which version of EfficientNet?
- FootPrint of Nepal
- Satellite Image of Kathmandu in 2015 (Pre and Post Earthquake)
- Alaska missing a lot of areas/buildings?
- Unable To Download Data HOT 3
- Update has fewer buildings for US
- Footprints less accurate than they were before. HOT 2
- Wrong shape files showing up for Aberdeen Proving Grounds, Harford County, Maryland, US
- Tall buildings not showing up correctly in Chicago HOT 1
- This repo is missing a LICENSE file
- This repo is missing important files HOT 1
- Delta in QGIS
- I need to get my Microsoft points back. Help me please. HOT 1
- Building Heights HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from usbuildingfootprints.