This is an automated email from the git hooks/post-receive script. sebastic-guest pushed a commit to branch upstream-master in repository pktools.
commit 232189d00cc5dd0cbc7f168e941465b2f9bca0d9 Author: Pieter Kempeneers <kempe...@gmail.com> Date: Sat Sep 13 22:34:28 2014 +0200 trying overwrite in createLayer in ImgWriterOgr.cc --- src/imageclasses/ImgWriterOgr.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/imageclasses/ImgWriterOgr.cc b/src/imageclasses/ImgWriterOgr.cc index 4f040cf..226fff3 100644 --- a/src/imageclasses/ImgWriterOgr.cc +++ b/src/imageclasses/ImgWriterOgr.cc @@ -176,6 +176,29 @@ OGRLayer* ImgWriterOgr::createLayer(const std::string& layername, const std::str //if points: use wkbPoint //if no constraints on the types geometry to be written: use wkbUnknown OGRLayer* poLayer; + + //always overwrite... + //todo: test if overwrite works... + //check if layername already exists for this dataset + int iLayer = -1; + poLayer=m_datasource->GetLayerByName(layername.c_str()); + if(poLayer!=NULL){ + int nLayerCount = m_datasource->GetLayerCount(); + for(iLayer = 0; iLayer < nLayerCount; iLayer++ ){ + OGRLayer *tmpLayer = m_datasource->GetLayer(iLayer); + if (tmpLayer == poLayer) + break; + } + if (iLayer == nLayerCount){ + // shouldn't happen with an ideal driver + poLayer = NULL; + } + if(m_datasource->DeleteLayer(iLayer)!=OGRERR_NONE){ + std::string errorstring="DeleteLayer() failed when overwrite requested"; + throw(errorstring); + } + } + OGRSpatialReference oSRS; if(theProjection!=""){ -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel