[mapguide-users] RE: Highlighting selected features

navya024 navya.gudupi at gmail.com
Mon Jun 14 02:52:17 EDT 2010


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.


More information about the mapguide-users mailing list