[GRASS-user] Re: export 3d vector line map to shp
Martin Landa
landa.martin at gmail.com
Tue Sep 11 14:03:26 EDT 2007
... sorry, forgot to attach the patch...
2007/9/11, Martin Landa <landa.martin at gmail.com>:
> OK,
>
> this ugly patch enables to export 3d shapefile using v.out.ogr
> lco="SHPT=ARCZ" ...
>
> Martin
>
> 2007/9/11, Martin Landa <landa.martin at gmail.com>:
> > Hi,
> >
> > I got problem exporting 3d GRASS vector map to Shapefile. I have a
> > vector map with 3d lines (contours).
> >
> > $ .out.ascii isolines_reggio format=standard | head -n 20
> > ORGANIZATION:
> > DIGIT DATE:
> > DIGIT NAME: martin
> > MAP NAME: Output from v.overlay
> > MAP DATE: Tue Sep 11 00:50:19 2007
> > MAP SCALE: 1
> > OTHER INFO:
> > ZONE: 0
> > MAP THRESH: 0.000000
> > VERTI:
> > L 20 1
> > 618866 949571.5625 100
> > 618824.8125 949549.6875 100
> > 618815.8125 949537.1875 100
> > 618820.8125 949524.6875 100
> > 618810.8125 949486.3125 100
> > 618774.5625 949423.6875 100
> > 618767.0625 949372.8125 100
> > 618746.375 949349.8125 100
> > 618728.8125 949360.3125 100
> >
> > I tried to export the map using
> >
> > $ v.out.ogr in=isolines_reggio dsn=./ olay=isolines_reggio
> >
> > For testing...
> > $ v.in.ogr dsn=isolines_reggio.shp out=test -z
> >
> > v.out.ascii test format=standard | head -n 20
> > ORGANIZATION:
> > DIGIT DATE:
> > DIGIT NAME: martin
> > MAP NAME:
> > MAP DATE: Tue Sep 11 19:46:07 2007
> > MAP SCALE: 1
> > OTHER INFO:
> > ZONE: 0
> > MAP THRESH: 0.000000
> > VERTI:
> > L 20 1
> > 618866 949571.5625 0
> > 618824.8125 949549.6875 0
> > 618815.8125 949537.1875 0
> > 618820.8125 949524.6875 0
> > 618810.8125 949486.3125 0
> > 618774.5625 949423.6875 0
> > 618767.0625 949372.8125 0
> > 618746.375 949349.8125 0
> > 618728.8125 949360.3125 0
> >
> > The Z coordinate is lost...
> >
> > According
> >
> > http://gdal.org/ogr/drv_shapefile.html
> >
> > I tried
> >
> > v.out.ogr in=isolines_reggio dsn=./ olay=isolines_reggio lco=SHPT=ARCZ
> > ERROR 6: Unknown SHPT value of `ARCZ=YES' passed to Shapefile layer
> > creation. Creation aborted.
> >
> > ERROR: Cannot create layer
> >
> > Thanks for any tip...
> >
> > Martin
> >
> > --
> > Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
> >
>
>
> --
> Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
>
--
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
? OBJ.i686-pc-linux-gnu
? isolines_reggio.dbf
? isolines_reggio.shp
? isolines_reggio.shx
? main.c.diff
Index: main.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/vector/v.out.ogr/main.c,v
retrieving revision 1.45
diff -u -r1.45 main.c
--- main.c 10 Aug 2007 14:31:12 -0000 1.45
+++ main.c 11 Sep 2007 18:01:30 -0000
@@ -124,7 +124,7 @@
dsco->key = "dsco";
dsco->type = TYPE_STRING;
dsco->required = NO;
- dsco->multiple = NO;
+ dsco->multiple = YES;
dsco->answer = "";
dsco->description = _("OGR dataset creation option (format specific, NAME=VALUE)");
@@ -132,7 +132,7 @@
lco->key = "lco";
lco->type = TYPE_STRING;
lco->required = NO;
- lco->multiple = NO;
+ lco->multiple = YES;
lco->answer = "";
lco->description = _("OGR layer creation option (format specific, NAME=VALUE)");
@@ -223,12 +223,14 @@
}
if ( drn == -1 ) G_fatal_error ( _("Driver %s not found"), frmt_opt->answer );
Ogr_driver = OGRGetDriver( drn );
- papszDSCO = CSLSetNameValue( papszDSCO, dsco->answer,"YES");
+ /* papszDSCO = CSLSetNameValue( papszDSCO, dsco->answer,"YES"); */
+ papszDSCO = dsco->answers;
Ogr_ds = OGR_Dr_CreateDataSource( Ogr_driver, dsn_opt->answer, papszDSCO );
CSLDestroy( papszDSCO );
if ( Ogr_ds == NULL ) G_fatal_error (_("Cannot open OGR data source '%s'"), dsn_opt->answer);
- papszLCO = CSLSetNameValue( papszLCO, lco->answer,"YES");
+ /* papszLCO = CSLSetNameValue( papszLCO, lco->answer,""); */
+ papszLCO = lco->answers;
Ogr_layer = OGR_DS_CreateLayer( Ogr_ds, layer_opt->answer, Ogr_projection, wkbtype, papszLCO );
CSLDestroy( papszLCO );
if ( Ogr_layer == NULL ) G_fatal_error (_("Cannot create layer"));
More information about the grass-user
mailing list