I am trying to use the Microsoft Footprint data (available as GeoJSON) for spatial analysis to roughly identify buildings over a certain size within a specific range of major railroads and highways. I am confident that I know how to perform the analysis, but I can not find a way to use a GeoJSON file as large as these (e.g. Alabama approx. 500 mb of txt) for spatial analysis.
I can very slowly load the GeoJSON into QGIS, but I cannot export as a shapefile or run any search-by-locations without the whole system crashing.
I have tried to use ArcMap's JSON to Feature, but it will not read a GeoJSON of that size.
I have also tried to create individual shapefiles from each feature within the GeoJSON to avoid having a shapefile over the size limit. My intention was to then include these all in a GDB for analysis, but this process too constantly crashed my Python instance and even unmounted a disk.
from osgeo import ogr
import fiona
import json
text = open('Alabama.txt', 'r')
text = text.read()
search = re.findall('{"type":"Polygon","coordinates"[^}]+', text)
i = 0
for line in search:
i += 1
poly = line + '}'
polyogr = ogr.CreateGeometryFromJson(poly)
schema = {'geometry': 'Polygon','properties': {'fld_a': 'str:50'}}
with fiona.open('%s.shp' % i, 'w', 'ESRI Shapefile', schema) as layer:
layer.write({'geometry': json.loads(poly), 'properties': {'fld_a': 'test'}})
Can I use GeoJSON files this large for analyst work in GDAL?