PCSS.CoordSystemsMgr coordSysMgr = null;
PCSS.CoordSystem coordSys = null;
PCSS.UnitAndFormatSpec spec = null;
bool isValid = false;
double x = 104.0, y = 4.0, z = 0.0;
double[] point = { 0, 0, 0 }; //the output easting, northing, height values
//Get a reference to the Coordinate Systems Manager class
//of the GeoMedia workspace
coordSysMgr = (PCSS.CoordSystemsMgr) this._document.CoordSystemsMgr;
//Create an instance of the UnitAndFormatSpec class
spec = (PCSS.UnitAndFormatSpec)this._application.CreateService("UnitAndFormatSpec");
//Convert the longitude to radians
spec.ParseValueString(Intergraph.GeoMedia.PCSS.CSValueStringConstants.csvsLongitude, lng.ToString(), out x);
//Convert the latitude to radians
spec.ParseValueString(Intergraph.GeoMedia.PCSS.CSValueStringConstants.csvsLatitude, lat.ToString(), out y);
//Get a reference to the coordinate system class
coordSys = coordSysMgr.CoordSystem;
//Check first to see if the conversion from latitude, longitude to
// easting, northing is valid
coordSys.IsTransformationValid(Intergraph.GeoMedia.PCSS.CSPointConstants.cspLLU, 1, Intergraph.GeoMedia.PCSS.CSPointConstants.cspENU, 1, out isValid);
//If the conversion is valid, then perform the actual conversion
//from latitude, longitude to easting, northing.
if (isValid == true)
{
coordSys.TransformPoint(Intergraph.GeoMedia.PCSS.CSPointConstants.cspLLU, 1, Intergraph.GeoMedia.PCSS.CSPointConstants.cspENU, 1, ref x, ref y, ref z);
point[0] = x;
point[1] = y;
point[2] = z;
}
I have a problem and I wan´t to see if you can help me. I use Geomedia objects to read a shape file. I open shape files and read them with no problem, but I don't know how can I transform or change the projection. My geometries are in Datum 73 and the shape file that I'm reading is in PT-TM06-ETRS89. I could use Molodensky transformation formulas to convert, but I think that Geomedia can do this for me. The only thing I don't know is how ?
ReplyDeleteYup, if you have defined your coordinate systems properly the GeoMedia application can do the transformation automatically for you. However, you've got to do a lot more work if you using GeoMedia objects. In your code, you've got to check your source dataset and your destination coordinate system. If they are not the same, then you have to use a GeoMedia transformation service object to reproject your feature recordsets.
ReplyDelete