Permalink
Browse files

add second approach

It tests “AG.createfeature(layer) do feature; … end” instead of
“AG.createfeature(featuredefn) do feature; … AG.createfeature!(layer,
feature) end”
  • Loading branch information...
yeesian authored and visr committed Nov 4, 2018
1 parent c6d2f47 commit d24249dd197de449a3e57a983e73094cd7265788
Showing with 21 additions and 0 deletions.
  1. +21 −0 test/test_gdal_tutorials.jl
@@ -121,5 +121,26 @@ AG.registerdrivers() do
rm("$pointshapefile.shp")
rm("$pointshapefile.shx")
end

@testset "Approach 2" begin
pointshapefile = "tmp/point_out"
AG.create("$pointshapefile.shp", "ESRI Shapefile") do dataset
layer = AG.createlayer(dataset, "point_out", geom=GDAL.wkbPoint)
AG.createfielddefn("Name", GDAL.OFTString) do fielddefn
AG.setwidth!(fielddefn, 32)
AG.createfield!(layer, fielddefn, true)
end
featuredefn = AG.getlayerdefn(layer)
@test AG.getname(featuredefn) == "point_out"
AG.createfeature(layer) do feature
AG.setfield!(feature, AG.getfieldindex(feature, "Name"), "myname")
AG.setgeomdirectly!(feature, AG.unsafe_createpoint(100.123, 0.123))
end
end

rm("$pointshapefile.dbf")
rm("$pointshapefile.shp")
rm("$pointshapefile.shx")
end
end
end

0 comments on commit d24249d

Please sign in to comment.