[GRASS5] g.region, sites and other stuff [WAS: d.zoom / sites boundaries]

Eric G . Miller egm2 at jps.net
Wed Nov 1 10:16:02 EST 2000


(Re: bug in g.region for setting region from sites)

I can confirm the bug.  I haven't looked at it.  On a related note, I
think the Site_head could use some additions and some related library
functions:

Additions that could be very useful for Site_head:

  int count;	/* Number of sites in list */
  double E, W, N, W;  /* Min/Max extents -- Bounding box */

  - possibly implemented in site_list as:

  stats| count=<num> E=<G_format_easting(max_x, G_projection)> ...

  - Possible related library functions:

  char *G_site_make_stats(FILE *);  /* Make the stats line */

  int G_site_get_count(char *site_list); /* Convenience function */

  int G_site_get_count2(FILE *site_list); /* Variant */

  int G_site_get_bbox(char *site_list, double *N, double *S,
  			double *E, double *W);
			/* Other convenience function */
  
  int G_site_get_bbox2(FILE *site_list, ... ) /* variant */
  

Change that would impact alot of programs, but would improve usability:

  Actually use the 'label' line for named fields.  If no labels exist,
  or labels are unspecified, then it could default to:

  label|east north n3 [n4 ...] cat d1 [d2 ...] s1 [s2 ...]

  From a user's standpoint, it is easier to remember field names than to
  give both a field type and an index when specifying a field.  However,
  this would be a significant change from current practices.

  -  possible library functions:

  int G_site_field_by_name(char *site_list, char *name, int *type, int *index);

  int G_site_field_by_name2(FILE *site, char *name, int *type, int *index);

  int G_site_field_by_name3(struct Site_head *head, char *name, 
  			int *type, int *index);

  char * G_site_field_by_type(char *site_list, int type, int index);

  char * G_site_field_by_type2(FILE *site, int type, int index);

  char * G_site_field_by_type3(struct Site_head *head, int type, 
  				int index);


I could see the "stats" being immediately useful while not really
impacting existing programs.  The 'labels' might require a little more
care.

One other thing that might be worth doing is having a high level
function to put a site_list in sorted NW to SE order.

  G_site_sort(char *insite, char *outsite);
  /* If outsite == NULL, the sorted site_list will replace the insite
   * list.  Careful not to do that if the site_file is open!
   */


-- 
#! /bin/sh
# ppp-address: What's my Internet Address for ppp0 ?
/sbin/ifconfig ppp0 2> /dev/null | grep 'inet addr:' | sed \
's=.*inet addr\:\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*=\1='

---------------------------------------- 
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