Packages intended to assist in the preprocessing of SpaceNet satellite imagery data corpus to a format that is consumable by machine learning algorithms.
Other
248
stars
97
forks
source link
NULL Pointer error when trying to process a geojson file with no building footprints #85
On buildings_AOI_5_Khartoum_img3.geojson the script crashed and I got the traceback below indicating a NULL pointer.
Traceback (most recent call last):
File "createDataSpaceNet.py", line 317, in <module>
bboxResize= args.boundingBoxResize
File "createDataSpaceNet.py", line 110, in processChipSummaryList
entry = lT.geoJsonToSBD(annotationName_cls, annotationName_inst, chipSummary['geoVectorName'], chipSummary['rasterSource'])
File "/path/spacenet_utilities/python/spaceNetUtilities/labelTools.py", line 1066, in geoJsonToSBD
my_inst_segmentation = createInstanceSegmentation(my_raster_source, my_vector_source)
File "/path/spacenet_utilities/python/spaceNetUtilities/labelTools.py", line 1016, in createInstanceSegmentation
cell_array[i] = createSegmentationByFeatureIndex(i, rasterSrc, vectorSrc, npDistFileName='', units='pixels')
File "/path/spacenet_utilities/python/spaceNetUtilities/labelTools.py", line 1004, in createSegmentationByFeatureIndex
dist_trans_by_feature = createDistanceTransformByFeatureIndex(feature_index, rasterSrc, vectorSrc, npDistFileName='', units='pixels')
File "/path/spacenet_utilities/python/spaceNetUtilities/labelTools.py", line 950, in createDistanceTransformByFeatureIndex
Feature_Layer.CreateFeature(my_feature)
File "/path/python2.7/site-packages/osgeo/ogr.py", line 1727, in CreateFeature
return _ogr.Layer_CreateFeature(self, *args)
ValueError: Received a NULL pointer.
The error seems to be caused by the geojson file having no building footprints in it. So the script passes this empty set of footprints to OGR and OGR interprets that as a NULL. I think the solution would be to check for an empty value before passing the value to OGR.
I ran the code below to convert the Spacenet 2 Khartoum dataset to SBD format.
On
buildings_AOI_5_Khartoum_img3.geojson
the script crashed and I got the traceback below indicating a NULL pointer.The error seems to be caused by the geojson file having no building footprints in it. So the script passes this empty set of footprints to OGR and OGR interprets that as a NULL. I think the solution would be to check for an empty value before passing the value to OGR.