Hi! This is half an issue and half a reminder to myself that I / we should improve the documentation on how to write vector data. Just struggled to come up with code to write a dumb file containing points. Had to read the tests to do it and even then it didn't work without tweaking. Here's what I came up with for reference:
function write_result_sqlite(filename, points)
AG.create(filename; driver=AG.getdriver("SQLite")) do ds
AG.createlayer(name = "geom",
dataset = ds,
geom = AG.wkbPoint,
spatialref = AG.importEPSG(25832)) do layer
AG.addfielddefn!(layer, "point_id", AG.OFTInteger)
id_idx = AG.findfieldindex(AG.layerdefn(layer), "point_id")
i = 0
for chunk in Iterators.partition(points, 20000)
GDAL.ogr_l_starttransaction(layer)
for pt in chunk
AG.addfeature(layer) do feature
AG.setfid!(feature, i)
AG.setfield!(feature, id_idx, i)
AG.setgeom!(feature, 0, AG.createpoint(pt...))
return nothing
end
i += 1
end
GDAL.ogr_l_committransaction(layer)
end
end
end
return nothing
end
Speed is good, but it's a bit clunky. A higher level API for this kind of tasks would be really nice as well.
Hi! This is half an issue and half a reminder to myself that I / we should improve the documentation on how to write vector data. Just struggled to come up with code to write a dumb file containing points. Had to read the tests to do it and even then it didn't work without tweaking. Here's what I came up with for reference:
Speed is good, but it's a bit clunky. A higher level API for this kind of tasks would be really nice as well.