1 Reply Latest reply on Feb 26, 2003 8:02 AM by 388734

    how to get point ordinates in oracle spatial with oo4o and VC++

    388734

      Hi,

      I need some help baddly.Would someone help me?

      Now I need to get the point ordinates in a table called cities.I use oo4o C++ class library and VC++ 6.0 . In the table, the column name of SDO_GEOMETRY object
      type is "goem". For the reason that the table is created for a point layer, all the point ordinates are stored in the SDO_POINT.

      I read the ordinates in my program as below. But every time the final result of x,y,z are all be 0.000000000 . Although I checked it many times, I still couldn't found why.

      So could some experts tell me the reason or show me how to do that?

      Thanks in advanced.









      ODatabase odb("", "scott", "tiger");
      ODynaset odyn(odb, "SELECT * FROM CITIES");
      if (odyn.IsOpen())
      {
      odyn.MoveFirst();
      OObject geometry;
                
      oresult ores = odyn.GetFieldValue("geom", &geometry);
      if(ores==OCSUCCESS)
      {

      OObject sdopoint;
      const char* attrname3=geometry.GetAttrName(3);
           geometry.GetAttrValue(attrname3, &sdopoint);
           
           const char* ittypename=sdopoint.GetTypeName();     
           int itnumber=sdopoint.GetCount();

           int attrtype=sdopoint.GetAttrType(1);
           const char* attrnameX=sdopoint.GetAttrName(1);
      const char* attrnameY=sdopoint.GetAttrName(2);
           const char* attrnameZ=sdopoint.GetAttrName(3);

           double *x;
           double *y;
           double *z;
           sdopoint.GetAttrValue(attrnameX,x);
           sdopoint.GetAttrValue(attrnameY,y);
           sdopoint.GetAttrValue(attrnameZ,z);
      }
      }