[GRASS-dev] [GRASS GIS] #82: new module: v.to.3d

#82: new module: v.to.3d
-------------------------+--------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
     Type: enhancement | Status: new
Priority: minor | Milestone: 6.4.0
Component: default | Version: svn-trunk
Keywords: |
-------------------------+--------------------------------------------------
Hi,

as discussed on the -dev list
   http://thread.gmane.org/gmane.comp.gis.grass.devel/25394/

there is need for a simple way of transforming 2D vectors to 3D vectors.

v.transform will do it, so perhaps the module could be a wrapper function
to that?

it should have:

  * 2D points + [numeric attr column or value= command line option] -> 3D
points
  * 2D lines -> 3D lines in a similar way (i.e. labeled contour lines ->
3D)

  * a -r flag to reverse the process. If done in a shell script this might
be as simple as v.out.ascii | v.in.ascii [without -z]

'v.transform --script' will create the template, and then just a few lines
for the wrapper. There is movement to start writing new scripts in Python
instead of /bin/sh to aid future portability, but I think the script is
simple enough that we could make an initial shell script version which
could be considered "disposable with minimal loss of effort."

[Python is problematic as it is not yet a mandatory dependency]

To me it seems the important tasks are collecting the correct command line
options needed and getting the module's options and flags out into the
users' mind-space. Once that is in place we could rewrite the wrapper as a
python script later without much work and without any user visible change.

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: task | Status: new
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by hamish):

  * component: default => Vector
  * priority: minor => major
  * platform: => Unspecified
  * version: svn-trunk => svn-develbranch6
  * type: enhancement => task
  * cpu: => Unspecified

Comment:

bumping importance to improve chances it gets done for the 6.4.0 release.

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/82#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):

  * status: new => assigned
  * owner: grass-dev@lists.osgeo.org => martinl
* cc: grass-dev@lists.osgeo.org (added)

Comment:

Initial version of module
[source:grass/branches/develbranch_6/scripts/v.to.3d].

TODO: Implement Python version in GRASS7.

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

I am not sure which module to use for reverse transformation (3D->2D).
Implementation would be easy. I was thinking about v.edit tool=to2d.
v.edit is not designed for global operation (like v.clean). Basically it's
not problem, just 'selection' parameters (type, cats, ids, where, ...)
will be ignored. Any suggestions?

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:2 martinl]:
> TODO: Implement Python version in GRASS7.

done [source:grass/trunk/scripts/v.to.3d]

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by hamish):

Replying to [comment:3 martinl]:
> I am not sure which module to use for reverse transformation
> (3D->2D).

points, centroids: v.out.ascii | v.in.ascii (without -z or z=). then you'd
need to copy+merge tables adding in the new z column.

polyfeatures: v.out.ascii format=standard | awk to strip away the third
column | v.in.ascii format=standard. I think layer/cat setting at end of
each feature is ok as it is always like "1 1", never a third column.
AFAICT there's no way to keep the data in that 3rd column, as a line can
only hold a single attribute/cat. the user can summarize with v.univar if
they want that...?

?
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/82#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

On Sun, Dec 14, 2008 at 6:33 PM, GRASS GIS <trac@osgeo.org> wrote:

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
Reporter: hamish | Owner: martinl
     Type: task | Status: assigned
Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by hamish):

I am wondering-- would it be simpler to add a flag to v.drape for
converting vectors to 3D, with all z-values set to some constant? Or
is that not what v.to.3d does?

Dylan

Replying to [comment:3 martinl]:
> I am not sure which module to use for reverse transformation
> (3D->2D).

points, centroids: v.out.ascii | v.in.ascii (without -z or z=). then you'd
need to copy+merge tables adding in the new z column.

polyfeatures: v.out.ascii format=standard | awk to strip away the third
column | v.in.ascii format=standard. I think layer/cat setting at end of
each feature is ok as it is always like "1 1", never a third column.
AFAICT there's no way to keep the data in that 3rd column, as a line can
only hold a single attribute/cat. the user can summarize with v.univar if
they want that...?

?
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/82#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:5 hamish]:
> Replying to [comment:3 martinl]:
> > I am not sure which module to use for reverse transformation
> > (3D->2D).
>
> points, centroids: v.out.ascii | v.in.ascii (without -z or z=). then
you'd need to copy+merge tables adding in the new z column.
>
> polyfeatures: v.out.ascii format=standard | awk to strip away the third
column | v.in.ascii format=standard. I think layer/cat setting at end of
each feature is ok as it is always like "1 1", never a third column.
> AFAICT there's no way to keep the data in that 3rd column, as a line can
only hold a single attribute/cat. the user can summarize with v.univar if
they want that...?

this approach will be very slow for large vector maps... That's reason why
I would prefer to implement it in GRASS C module.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/82#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:6 martinl]:
> Replying to [comment:5 hamish]:
> > Replying to [comment:3 martinl]:
> > > I am not sure which module to use for reverse transformation
> > > (3D->2D).
> >
> > points, centroids: v.out.ascii | v.in.ascii (without -z or z=). then
you'd need to copy+merge tables adding in the new z column.
> >
> > polyfeatures: v.out.ascii format=standard | awk to strip away the
third column | v.in.ascii format=standard. I think layer/cat setting at
end of each feature is ok as it is always like "1 1", never a third
column.
> > AFAICT there's no way to keep the data in that 3rd column, as a line
can only hold a single attribute/cat. the user can summarize with v.univar
if they want that...?
>
> this approach will be very slow for large vector maps... That's reason
why I would prefer to implement it in GRASS C module.

Another option would be to rewrite v.to.3d in C.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:7 martinl]:

> Another option would be to rewrite v.to.3d in C.

Done in r35052 (devbr6) and r35053 (trunk). Not backported to relbr64,
should be:

  * now
  * after final 6.4.0
  * never

?

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by martinl):

Replying to [comment:8 martinl]:
> Replying to [comment:7 martinl]:
> > Another option would be to rewrite v.to.3d in C.
>
> Done in r35052 (devbr6) and r35053 (trunk). Not backported to relbr64,
should be:
>
> * now
> * after final 6.4.0
> * never

I would suggest to replace Bash script with C module also in
releasebranch_6_4. Any objections?

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#82: new module: v.to.3d
--------------------------+-------------------------------------------------
  Reporter: hamish | Owner: martinl
      Type: task | Status: closed
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: fixed | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):

  * status: assigned => closed
  * resolution: => fixed

Comment:

Replying to [comment:9 martinl]:
> I would suggest to replace Bash script with C module also in
releasebranch_6_4. Any objections?

done in r35304.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/82#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>