HOMEPAGE

Development Sites - Information for Software-Developers

Developer Platform
The first instructions
Installations
System param. structures
connect to MeteoCom
simple screen drawing
own data drawing
Picture service
File Management
EmailBulletin Service

MeteoTools::GetDataOfPoint

BOOL GetDataOfPoint(int lon,int lat, BMSDATA_SET* set)

Return Value

    Nonzero if successful; otherwise 0.

Parameters

    lon

    longitude in minutes

    lat

    latitude in minutes

    set

    A pointer of a BMSDATA_SET structure that receive the data set.

Remarks

    Get an meteo data set of a geographical point.
    It calculated all values, that between the grid would be.

Example
  
//points for LoadString 
#05000:     Data from Point :
#05001:            pressure :
#05002:         temperature :
#05003:          wind speed :
#05004:     wind comes from :
#05005:   relative humidity :
#05006:        cloud couver :
#05007: sig height of waves :
#05008:     waves come from :
#05009:       precipitation :
#05010:             Station :
//this ist installed long before - precalculated field of wind speed
int beaufort[256],knots[256]; 
double w;
for(int z=0; z<256; z++)
   {
   knots[z]=(int)((double)z*.48595); //0.25 * 1.9438 = .48595
   w=(double)z*.25;
   beaufort[z]=0; 
   if(w != 0.)
      {
      if(w >= 57.0) beaufort[z] = 17;
      else if(w >= 51.0) beaufort[z] = 16;
      else if(w >= 46.2) beaufort[z] = 15; 
      else if(w >= 41.5) beaufort[z] = 14;
      else if(w >= 37.0) beaufort[z] = 13; 
      else if(w >= 32.7) beaufort[z] = 12;
      else if(w >= 28.5) beaufort[z] = 11; 
      else if(w >= 24.5) beaufort[z] = 10;
      else if(w >= 20.8) beaufort[z] = 9; 
      else if(w >= 17.2) beaufort[z] = 8;
      else if(w >= 13.9) beaufort[z] = 7; 
      else if(w >= 10.8) beaufort[z] = 6;
      else if(w >= 8.0) beaufort[z] = 5; 
      else if(w >= 5.5) beaufort[z] = 4;
      else if(w >= 3.4) beaufort[z] = 3; 
      else if(w >= 1.6) beaufort[z] = 2;
      else if(w >= 0.3) beaufort[z] = 1;
      }
   } 

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Bonito counted from left/top to bottom/right
// all the transfomations see the refence point on the center of the screen
// the world cordinates system that Bonito use:
// 
// in minutes = 180W to 180E 	--> -10800 to 10800
//               90N to 90S 	--> -5400  to  5400

void CDataView::ShowStation(float lon, float lat) //lon/lat in minutes
{
   int 		x,y;
   char 	c1,c2;
   CString 	str,lab;
   char 	buf[1024];
   BMSDATA_SET 	klickSet; 


   if(!GetDataOfPoint((int)(lon),(int)lat,&klickSet)) return;

   if(lat < 0) {c1 = 'S'; lat = -lat;} else c1 = 'N';
   if(lon < 0) {c2 = 'E'; lon = -lon;} else c2 = 'W';

   if(lat > 5400.f) lat = 5400.f;
   if(lon > 10800.f) lon = 10800.f;
   y=(int)lat/60;
   x=(int)lon/60;
   lon=lon-((float)x*60.f);
   lat=lat-((float)y*60.f);


   LoadString(5000,lab);
   str.Format("\n%s %2d°%06.3f%c / %3d°%06.3f%c\n\n",lab,y,lat,c1,x,lon,c2);
   LoadString(5001,lab);
   sprintf(buf,"%s %.1f hPa\n",lab,(float)(klickSet.prmsl+9000)/10.f);
   str+=buf;
   LoadString(5002,lab);
   sprintf(buf,"%s %.1f °C\n",lab,(float)klickSet.temp/10.f); str+=buf;
   if(klickSet.wind)
      {
      LoadString(5003,lab);
      BYTE z=(BYTE)(((float)klickSet.wind/2.5f+.5f));
      sprintf(buf,"%s %d = %.1f m/s = %d knots\n",lab
      ,beaufort[z]  		 //precalculated field of beaufort values
      ,(float)klickSet.wind/10.f //calculate m/s
      ,knots[z]);                //precalculated field of knots values
      str+=buf;
      }
   if(klickSet.wdir<3600)
      {
      LoadString(5004,lab);
      sprintf(buf,"%s %.0f°\n",lab,(float)klickSet.wdir/10.f); str+=buf;
      }
   if(klickSet.rh)
      {
      LoadString(5005,lab);
      sprintf(buf,"%s %d %%\n",lab,(int)klickSet.rh); str+=buf;
      }
   if(klickSet.btcdc>0 && klickSet.btcdc<120)
      {
      LoadString(5006,lab);
      sprintf(buf,"%s %d %%\n",lab,(int)klickSet.btcdc); str+=buf;
      }
   if(klickSet.acpt)
      {
      LoadString(5009,lab);
      sprintf(buf,"%s %.1f mm/h\n",lab,(float)klickSet.acpt/10.f); 
      str+=buf;
      }
   if(klickSet.htsgw||klickSet.wvdir)
      {
      LoadString(5007,lab);
      sprintf(buf,"%s %.2f m\n",lab,(float)klickSet.htsgw/10.f); str+=buf;
      LoadString(5008,lab);
      sprintf(buf,"%s %.0f°\n",lab,(float)klickSet.wvdir/10.f); str+=buf;
      }

 //now let is appear
//MeteoKlickDlg dlg(str.GetBuffer(0), this);
//dlg.DoModal();
}

See Also   GetSynopDataOfPoint
 

   Copyright 2006 © Bonito Germany.   
www.bonito.net