[mapguide-users] RE: Highlighting selected features

Dave Wilson dave.wilson at autodesk.com
Fri Jun 18 13:32:16 EDT 2010


I'm not doing much programming these days so I can't specifically answer your question, but I'm not sure I understand why you need to re-project the layer?

MapGuide will transform the data in Coordinate System A in your layer to Coordinate System B assigned to the map by default. What is the case where you need to re-project this?

Dave

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of navya024
Sent: Monday, June 14, 2010 12:52 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] RE: Highlighting selected features


Hi,
i want to do layer reprojection on the fly.
i have written the code based on the sample code provided by you.

 MgInitializeWebTier($webconfigFilePath);
    $args = ($_SERVER['REQUEST_METHOD'] == "POST") ? $_POST : $_GET;
    $sessionId = $args['SESSION'];

    $mapName = $args['MAPNAME'];
    $userInfo = new MgUserInformation($sessionId);
    $siteConnection = new MgSiteConnection();
    $siteConnection->Open($userInfo);
    $resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
$featureService =
$siteConnection->CreateService(MgServiceType::FeatureService);

    $map = new MgMap();
    $map->Open($resourceService, 'map');
 $mapWktSrs = $map->GetMapSRS();

 $resourceID = new MgResourceIdentifier('Library://new/dat.FeatureSource');

 $byteSource = new MgByteSource('C:/GFProp_Req.sdf');
 $data = $byteSource->GetReader();
 $resourceService->SetResourceData($resourceID, 'GFProp_Req', 'File',
$data);
  $newLayer=CreatLayer($resourceService,$resourceID,$sessionId);

        $newLayer->SetVisible(true);
			   $newLayer->ForceRefresh();
			   	 $newLayer->SetDisplayInLegend(true);

	$map->GetLayers()->Insert(0, $newLayer);
                $map->Save($resourceService);

$layer=$map->GetLayers()->GetItem(1);
$featureSource = new MgResourceIdentifier($layer->GetFeatureSourceId()); 
$featureSC = $featureService->GetSpatialContexts($featureSource, true); 
$featureSC->ReadNext(); 
$featureSRS = $featureSC->GetCoordinateSystemWkt(); 
$coordSysFactory = new MgCoordinateSystemFactory(); 
$sourceSRS = $coordSysFactory->Create($featureSRS); 
$targetSRS = $coordSysFactory->Create($mapWktSrs); 
$LL2LamCC = $coordSysFactory->GetTransform($sourceSRS, $targetSRS); 
 $layerClassName = $layer->GetFeatureClassName();
 $queryOptions = new MgFeatureQueryOptions();
  $featureReader = $featureService->SelectFeatures($featureSource,
$layerClassName, $queryOptions);
$agfObj = $featureReader->GetGeometry("Geometry"); 
$agfRW  = new MgAgfReaderWriter(); 
$geoObj = $agfRW->Read($agfObj); 
$wktRW  = new MgWktReaderWriter(); 
$wktObj = $wktRW->Write($geoObj);

i have transformed the featuresource srs to mapsrs but how to add it to
reproject the layer??can you please guide me.
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Highlighting-selected-features-tp3901646p5176359.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list