You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've been using FillBurn with a streams shapefile without any fields. You can create a shapefile with no fields by creating a dataset with a temporary field, and then deleting it. I've mocked up a script that will do this. I don't know if it's a great idea to be creating these kinds of shapefiles, but the error message that was produced wasn't helpful in figuring out what was wrong.
OS: Ubuntu 22.04
WhiteboxTools Open Core: v2.4.0
GDAL: v3.8.2
Create one vector with fields and one without using the script below.
#! /usr/bin/env python3"""create_vectors.py"""fromosgeoimportgdal, ogr, osrsrs=osr.SpatialReference()
srs.ImportFromEPSG(4326)
drv=gdal.GetDriverByName("ESRI Shapefile")
geom=ogr.CreateGeometryFromWkt("LINESTRING (0 0,0 1)")
# Create a dataset without any fields.ds_1=drv.Create("no_fields.shp", 0, 0, 0, gdal.GDT_Unknown)
lyr_1=ds_1.CreateLayer("no_fields", srs, ogr.wkbLineString)
field_defn=ogr.FieldDefn("tmp_field", ogr.OFTInteger)
# If no field is created, an FID field will be created instead.lyr_1.CreateField(field_defn)
feat_1=ogr.Feature(lyr_1.GetLayerDefn())
feat_1.SetGeometry(geom)
feat_1.SetField("tmp_field", 1)
lyr_1.CreateFeature(feat_1)
# Delete the only field.lyr_1.DeleteField(0)
# Create a dataset with a field.ds_2=drv.Create("with_fields.shp", 0, 0, 0, gdal.GDT_Unknown)
lyr_2=ds_2.CreateLayer("with_fields", srs, ogr.wkbLineString)
field_defn=ogr.FieldDefn("ID", ogr.OFTInteger)
lyr_2.CreateField(field_defn)
feat_2=ogr.Feature(lyr_2.GetLayerDefn())
feat_2.SetField("ID", 1)
feat_2.SetGeometry(geom)
lyr_2.CreateFeature(feat_2)
The text was updated successfully, but these errors were encountered:
Hi, I've been using FillBurn with a streams shapefile without any fields. You can create a shapefile with no fields by creating a dataset with a temporary field, and then deleting it. I've mocked up a script that will do this. I don't know if it's a great idea to be creating these kinds of shapefiles, but the error message that was produced wasn't helpful in figuring out what was wrong.
OS: Ubuntu 22.04
WhiteboxTools Open Core: v2.4.0
GDAL: v3.8.2
Create one vector with fields and one without using the script below.
Create a DEM.
Running FillBurn with the streams with fields works fine.
Running FillBurn on streams without fields produces this unhelpful back trace.
create_vectors.py
The text was updated successfully, but these errors were encountered: