Open($userInfo); $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService); $featureService = $siteConnection->CreateService(MgServiceType::FeatureService); $map = new MgMap(); $map->Open($resourceService, '2010'); $layers = $map->GetLayers(); $count = $layers->GetCount(); for ($i = 0; $i < $count; $i++) { $layer = $layers->GetItem($i); } $layerClassName1 = $layer->GetFeatureClassName(); $FeatureResId = new MgResourceIdentifier("Library://Test/Data/Surveys.FeatureSource"); $queryOptions = new MgFeatureQueryOptions(); $queryOptions->SetFilter("DOCUMENT_N LIKE 'S%'");; $featureReader = $featureService->SelectFeatures($FeatureResId, $layerClassName1, $queryOptions); $featureReader->ReadNext(); $featureAgfGeometry = $featureReader->GetGeometry('Geometry'); $agfReaderWriter = new MgAgfReaderWriter(); $featureGeometry = $agfReaderWriter->Read($featureAgfGeometry); $centroid = $featureGeometry->GetCentroid(); $mapCenterX = $centroid->GetCoordinate()->GetX(); $mapCenterY = $centroid->GetCoordinate()->GetY(); $selection = new MgSelection($map); $selection->AddFeatures($layer, $featureReader, 1); $selectionXml = $selection->ToXml(); } catch (MgException $e) { echo " Error: "; echo $e->GetDetails(); echo ""; } ?> function ZoomTo(x,y) { selectionXml = '<?php echo $selectionXml;?>'; parent.parent.mapFrame.SetSelectionXML(selectionXml); var xval=x; var yval=y; parent.parent.mapFrame.ZoomToView(xval, yval, 2000, true); }"/>
Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Zoom To Selection Problem

0 REPLIES 0
Reply
Message 1 of 1
emluv
605 Views, 0 Replies

Zoom To Selection Problem

Hello, I am attempting to create a custom zoom to fuction, in which the user enters the value and Mapguide Enterprise 2010 zooms to it. I kind of have it working, but it seems to zoom to the same feature over and over, and it is not the one entered into the search. It is like it is reading the first value and not looping through the selection. Has anyone run into this before? Thanks!
emluv
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report