ArchGDAL.jl icon indicating copy to clipboard operation
ArchGDAL.jl copied to clipboard

createfeature on feature definition doesn't write out any data?

Open cchderrick opened this issue 7 years ago • 3 comments

I was following the test/test_gdal_tutorials.jl script, the tutorial lead to shapefiles without any data.

AG.create("$pointshapefile.shp", "ESRI Shapefile") do dataset
            ...
            featuredefn = AG.getlayerdefn(layer)
            @test AG.getname(featuredefn) == "point_out"
            AG.createfeature(featuredefn) do feature # This doesn't write any data out
            #AG.createfeature(layer) do feature # I ended with this, which works
                AG.setfield!(feature, AG.getfieldindex(feature, "Name"), "myname")
            ...
end

It doesn't error out because it is defined in context.jl line 52. So I am not sure if this is a bug or user error.

References: https://github.com/yeesian/ArchGDAL.jl/blob/0dbf3f71dfe347069d2bfeb969f4953ce71008b2/src/context.jl#L52-L61

https://github.com/yeesian/ArchGDAL.jl/blob/0dbf3f71dfe347069d2bfeb969f4953ce71008b2/test/test_gdal_tutorials.jl#L110-L116

cchderrick avatar Oct 18 '18 19:10 cchderrick

Yeah I believe it should be called on layers. See also https://github.com/JuliaGeo/GDAL.jl/pull/59. We should probably add the feature count test here as well.

visr avatar Oct 18 '18 20:10 visr

  1. yeah it should have been called on the layer in that test. Hence the bug label
  2. More generally, I can see how it will be confusing to users, and we should add documentation to distinguish between creating "floating" features, versus features that are "owned" by layers.

yeesian avatar Oct 18 '18 21:10 yeesian

Test bug has been fixed in #67

yeesian avatar Nov 19 '18 22:11 yeesian