[GRASS5] New dig 5.0 format with categories and z-coordinate

Markus Neteler neteler at geog.uni-hannover.de
Thu Sep 7 13:55:26 EDT 2000


On Thu, Sep 07, 2000 at 03:25:20PM +0200, Radim Blazek wrote:
> Proposal for new dig 5.0 format with categories and z-coordinate.

Dear Radim and David,

many thanks for the long awaited proposal! I am shure that an
updated vector format would increase the acceptance of GRASS.

If you allow, a question concerning the Z-coordinate support:
Do you think of tilted vectors (maybe 2.5D vectors) or even
of full 3D vectors to construct geometric volumes like houses
or whatever? The latter would require a format which allows to
stack vectors and have vertical vectors etc.

Please don't feel bothered of my question, I just want to 
understand your proposal.

Yours

 Markus
 
> General:
> Each element may have none, 1 or more categories (cats).
> More cats are distinguished by category numbers (cat_num).
> Only one cat with cat_num=1 will be used at this stage
> and multi-category support on modules level will be added in
> future.
> Z-coordinate will be optional and both 2d and 3d files may
> be written.
> 
> Implementation steps:
> 
> 1. Define new dig format:
>     like 4.x but in:
>     - head : Add type field for 2d/3d 
>     - body : - between element type and number of coordinates is inserted:
>                  - number of categories 0-255        (1 byte)
>                  - category number(s)   1-65535      (n_cats * 2 bytes)
>                  - category(s)          1-4294967295 (n_cats * 4 bytes)
>              - for 3d files z coordinate is written in the same style as x,y
> 
> 2. Define new structures and write functions:
>     #define CENTROID        0x08
>     #define FILE_CENTROID      3
>     typedef unsigned char   VCNCATS;
>     typedef unsigned short  VCCATNUM;
>     typedef unsigned int    VCCAT;
>  
>     struct line_cats {
>        VCNCATS  n_cats;      /* number of vector categories on one element */
>        int      alloc_cats;  /* size of allocated space */
>        VCCATNUM *cat_num;    /* pointer to field of category numbers */
>        VCCAT    *cat;        /* pointer to field of categories */
>     };
> 
>     struct line_pnts {
>        double *x;
>        double *y;
>        double *z;             /* null for 2d */
>        int     n_points;
>        int     alloc_points;
>     };
> 
>     struct line_cats *Vect__new_cats_struct (void);
>     int Vect_append_cat ( struct line_cats *, VCCATNUM, VCCAT);
>     int Vect_read_next_cats_line ( struct Map_info *, struct line_cats *,struct line_pnts *);
>     long Vect_write_cats_line ( struct Map_info *, int type, struct line_cats *, struct ine_pnts );
>           ( for backward compatibility this function duplicates cats to dig_att file
>            so that old modules can work with new dig files )
>  
>     Vect_read_next_line( ) - rewrite to read both 4.x and 5.0 2d/3d
>          and of course all functions called by these and some others.
> 
> 3. Rewrite v.build to support both dig 4.0 and 5.0.
>    Write v.dig module for conversion from built dig_plus to dig5.0.
>  
> 4. Request for testing on other platforms. Result of v.dig and v.support
>    should be the same as original dig_plus and all modules should work
>    with dig in 5.0 correctly.
>  
> 5. Rewrite all modules which read from dig_plus (level2) or from
>    other sources (v.in.*) to new dig format.
>  
> 6. Rewrite remaining modules which read from dig file. Here is the problem
>    because if module writes dig5.0, it must also read in dig5.0 format and
>    so imput file must be converted by v.support and v.dig first.
> 
> 
> David D Gray, Radim Blazek

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list