[mapguide-users] converting projection on fly

shreepad shreepadr at valuecad.com
Tue Jun 5 14:53:14 EDT 2007


Hi 
i have the data in state plane coordinate and i want to convert them to lat
lon on fly i have wrote the code but it is giving me error. here is my code.
please let me know what i am doing wrong . 

projection is NAD_1983_StatePlane_California_III_FIPS_0403_Feet 
and i want to conver it to LAT LON

here is my code 


MgSelection mapSelection = null;
MgResourceService resService =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
MgFeatureService featService =
(MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
MgMap map = new MgMap();
map.Open(resService, "General Public Map");
mapSelection = new MgSelection(map);
mapSelection.Open(resService, "General Public Map");
MgReadOnlyLayerCollection layers = mapSelection.GetLayers();


MgCoordinateSystemFactory l_oMGCoordinateSystemFactory = new
MgCoordinateSystemFactory();
MgGeometryFactory l_oMGGeometryFactory = new MgGeometryFactory();
String l_sWKTproj = map.GetMapSRS();

Response.Write(l_sWKTproj);
MgCoordinateSystem l_oMGCoordinateSystem =
l_oMGCoordinateSystemFactory.Create(l_sWKTproj);

double l_dMinX = 6141861.7828919375;
double l_dMinY = 2095968.7307088032;

MgCoordinate l_oMGCoordinateLatLonLL =
l_oMGGeometryFactory.CreateCoordinateXY(l_dMinX, l_dMinY);
MgCoordinate l_oMGCoordinateXYLL =
l_oMGCoordinateSystem.ConvertToLonLat(l_oMGCoordinateLatLonLL);

double xConv = l_oMGCoordinateXYLL.GetX();
double yConv = l_oMGCoordinateXYLL.GetY();
Response.Write(xConv);
Response.Write(yConv);

"

-- 
View this message in context: http://www.nabble.com/converting-projection-on-fly-tf3873611s16610.html#a10975522
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list