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: 

How to get xmax,xmin,ymax.ymin from *.sdf file

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
386 Views, 4 Replies

How to get xmax,xmin,ymax.ymin from *.sdf file

hello!

How to get xmax,xmin,ymax.ymin (cordinates of polygons) from *.sdf file?

I use PHP in ajax viewer. I wont make a goto link with zoome to the object. (polygon)
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

function getFeatureInfoByKeyFromSDF($key, $pathtoSDF){
$result=false;
$pathtoSDF; //
if( file_exists($pathtoSDF)){
//
$mySDF = new COM("Autodesk.MgSdfToolkit.1");
//
$point = new COM("Autodesk.MgSdfDoublePoint.1");
$objExtent = new COM("Autodesk.MgSdfBoundingBox.1");
//
$mySDF->Open($pathtoSDF, 1, true);
//
$mySDF->BeginKeyIndexSearch ($key);
//
$object = $mySDF->SearchToNextObject();
$mySDF->EndSearch();
if($object){
$objExtent = $object->Extent;
$result=array("identifier" => "", "coordinates" => "");
$result["identifier"] = $object->key;
$result["coordinates"] = $objExtent->MinX . "," . $objExtent->MinY . " " . $objExtent->MaxX . "," . $objExtent->MaxY;
}else{
return $result;
}
$mySDF->Close();
}else{
$result=array("identifier" => "", "coordinates" => "");
}
return $result;
}


$xx = getFeatureInfoByKeyFromSDF('MC 9-866','C:\\Inetpub\\mapguide\\projects\\Wblite\\SDF\\WBMC09_FM.sdf');
if($xx){
echo "
";
print_r($xx);
echo "
";
}else{
echo "Not found";
}
Message 3 of 5
Anonymous
in reply to: Anonymous

The original post refers to MapGuide Enterprise or Open Source (inferred
from the AJAX viewer mention) so using the SDF COM Toolkit will not work
with the newer SDF+ version files.

This group really needs to be split up into MapGuide 6.5 and older and the
newer MapGuide to avoid these kind of ambiguities in posts and responses.

Andy


wrote in message news:5245241@discussion.autodesk.com...
function getFeatureInfoByKeyFromSDF($key, $pathtoSDF){
$result=false;
$pathtoSDF; //
if( file_exists($pathtoSDF)){
//
$mySDF = new COM("Autodesk.MgSdfToolkit.1");
//
$point = new COM("Autodesk.MgSdfDoublePoint.1");
$objExtent = new COM("Autodesk.MgSdfBoundingBox.1");
//
$mySDF->Open($pathtoSDF, 1, true);
//
$mySDF->BeginKeyIndexSearch ($key);
//
$object = $mySDF->SearchToNextObject();
$mySDF->EndSearch();
if($object){
$objExtent = $object->Extent;
$result=array("identifier" => "", "coordinates" => "");
$result["identifier"] = $object->key;
$result["coordinates"] = $objExtent->MinX . "," . $objExtent->MinY . " " .
$objExtent->MaxX . "," . $objExtent->MaxY;
}else{
return $result;
}
$mySDF->Close();
}else{
$result=array("identifier" => "", "coordinates" => "");
}
return $result;
}


$xx = getFeatureInfoByKeyFromSDF('MC
9-866','C:\\Inetpub\\mapguide\\projects\\Wblite\\SDF\\WBMC09_FM.sdf');
if($xx){
echo "
";
print_r($xx);
echo "
";
}else{
echo "Not found";
}
Message 4 of 5
Anonymous
in reply to: Anonymous

Our firm don't use MapGuide 6.5 no more.
we make new projects with MapGuide Open Source.

So how to get this coordinates from sdf file in PHP (ajax viewer)

I need to take x,y of middle of polygon - to make zoom to this.

I thing i is posilble take this coordinates with php.

Do you know kow?



Thx for
Message 5 of 5
Anonymous
in reply to: Anonymous

Take a look at the findparcels.php file that comes with the PHP sample
application. This illustrates exactly what you are asking for. It uses the
FDO GetCentroid method to get the X and Y of the polygon centroid.

Andy

wrote in message news:5245808@discussion.autodesk.com...
Our firm don't use MapGuide 6.5 no more.
we make new projects with MapGuide Open Source.

So how to get this coordinates from sdf file in PHP (ajax viewer)

I need to take x,y of middle of polygon - to make zoom to this.

I thing i is posilble take this coordinates with php.

Do you know kow?



Thx for

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

Post to forums  

Autodesk Design & Make Report