Hi,
because there was no response how to solve this in code, i would like
to apply the following patch to main.c to fix the overwrite/append
issue in v.out.ogr:

Index: main.c
===================================================================
--- main.c      (Revision 45168)
+++ main.c      (Arbeitskopie)
@@ -408,9 +408,8 @@
        G_fatal_error(_("OGR driver <%s> not found"), options.format->answer);
     Ogr_driver = OGRGetDriver(drn);

-    overwrite = G_check_overwrite(argc, argv);
-    if (overwrite || flags.append->answer) {
-       G_verbose_message(_("Overwrite/Append existing layer requires "
+    if (flags.append->answer) {
+       G_verbose_message(_("Append existing layer requires "
                            "opening data source in update mode,
forcing '-%c' flag"),
                          flags.update->key);
        flags.update->answer = TRUE;
@@ -433,6 +432,7 @@
                      options.dsn->answer);

     /* check if OGR layer exists */
+    overwrite = G_check_overwrite(argc, argv);
     if (flags.append->answer || overwrite) {
        if (OGR_DS_GetLayerByName(Ogr_ds, options.layer->answer)) {
            if (!overwrite && !flags.append->answer) {


Best regards
Soeren

2011/1/13 Benjamin Ducke <benjamin.du...@oxfordarch.co.uk>:
> Yes, that would be a problem.
> I think here the semantics of the GRASS --overwrite flag
> collide with the separate OGR concepts of "datasource"
> and "layer". In the case of GRASS maps, the meaning is
> always clear: overwrite existing map. But OGR output
> formats can be more complex. E.g. the user might want
> to overwrite one of many spatial tables (OGR layers)
> in an existing Spatialite DBMS (OGR datasource). For this to
> work, the datasource must of course exist.
> So I think we may need two different "overwrite" operations
> in the special case of v.out.ogr:
> one for OGR layers and one for OGR datasources?
>
> Ben
>
> On 12/18/2010 07:52 PM, Soeren Gebbert wrote:
>> Hi,
>> i am facing a problem with v.out.ogr which was introduced in revision
>> r44484 implementing the
>> ability of v.out.ogr to update existing files.
>>
>> I have a python script which sets the overwrite flag as default to
>> True for all modules it calls (in
>> gisrc), to avoid overwrite errors when working in temporally created
>> grass locations. This works fine for all grass modules.
>> Unfortunately the last changes in v.out.ogr switches from overwrite
>> mode to update mode (main.c line 285) and expects an existing file.
>> Therefor v.out.ogr dies with the error message: ERROR: Unable to open
>> OGR data source '/tmp/voronoi_diagram.kml'  in case there is no file.
>>
>> IMHO using the overwrite flag should not fail in case there is no file
>> to overwrite. Updating files should be managed with a special flag and
>> should not depend on the overwrite flag.
>>
>> I am open for suggestions and discussion. :)
>>
>> Best regards
>> Soeren
>> _______________________________________________
>> grass-dev mailing list
>> grass-dev@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev
>>
>>
>
>
>
> ------
> Files attached to this email may be in ISO 26300 format (OASIS Open Document 
> Format). If you have difficulty opening them, please visit 
> http://iso26300.info for more information.
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to