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! 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:
functionwrite_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 =0for 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...))
returnnothingend
i +=1end
GDAL.ogr_l_committransaction(layer)
endendendreturnnothingend
Speed is good, but it's a bit clunky. A higher level API for this kind of tasks would be really nice as well.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: