예제 #1
0
파일: proj3.c 프로젝트: GRASS-GIS/grass-ci
/*!
  \brief Get ellipsoid name for the current location
  
  \return pointer to valid name if ok
  \return NULL on error
*/
const char *G_database_ellipse_name(void)
{
    const char *name;

    name = lookup_proj("ellps");
    if (!name) {
	char buf[256];
	double a, es;

	G_get_ellipsoid_parameters(&a, &es);
	sprintf(buf, "a=%.16g es=%.16g", a, es);
	name = G_store(buf);
    }

    /* strcpy (name, "Unknown ellipsoid"); */
    return name;
}
예제 #2
0
파일: proj3.c 프로젝트: GRASS-GIS/grass-ci
/*!
  \brief Query cartographic projection for the current location
  
  Returns a pointer to a string which is a printable name for
  projection code <i>proj</i> (as returned by G_projection). Returns
  NULL if <i>proj</i> is not a valid projection.
  
  \return projection name
*/
const char *G_database_projection_name(void)
{
    int n;
    const char *name;

    switch (n = G_projection()) {
    case PROJECTION_XY:
    case PROJECTION_UTM:
    case PROJECTION_LL:
	return G_projection_name(n);
    }

    name = lookup_proj("name");
    if (!name)
	return _("Unknown projection");

    return name;
}
예제 #3
0
파일: proj3.c 프로젝트: GRASS-GIS/grass-ci
/*!
  \brief Get datum name for the current location
  
  Returns a pointer to the name of the map datum of the current
  database. If there is no map datum explicitely associated with the
  actual database, the standard map datum WGS84 is returned, on error
  a NULL pointer is returned.
  
  \return datum name
*/
const char *G_database_datum_name(void)
{
    const char *name;
    char buf[256], params[256];
    int datumstatus;

    name = lookup_proj("datum");
    if (name)
	return name;
    else if (!proj_info)
	return NULL;
    else
	datumstatus = G_get_datumparams_from_projinfo(proj_info, buf, params);

    if (datumstatus == 2)
	return G_store(params);
    else
	return NULL;
}
예제 #4
0
/*
 * Print a grid list to stdout.  Just used for debugging.
 */
void print_grid_list( struct grid_db *db )
{
   struct grid_info *g;
   int i = 1;

   printf("  Grid  Date  Time    Variable    Nr  Nc  Nl  Proj#  Vcs#  Filename\n");
   for (g=db->FirstGrid; g; g=g->Next) {
      int projnum = lookup_proj( db, g->Proj );
      int vcsnum = lookup_vcs( db, g->Vcs );
      printf("%c %4d  %05d %06d  %-10s %3d %3d %3d   %3d   %3d   %s\n",
              g->SelectBits==ALL_BITS ? '*': ' ',
              i, g->DateStamp, g->TimeStamp, g->VarName, g->Nr, g->Nc, g->Nl,
              projnum, vcsnum,
              g->FileName );
      i++;
   }

   printf("*=include grid in output file\n");
}