[mapguide-users] RE: [Mapguide_users] KML files and Localhost

navya024 navya.gudupi at gmail.com
Wed Jul 7 00:52:19 EDT 2010


Hi,
iam trying to integrate mapguide layers with google earth.
i downloaded the files.zip sample code
while implementing the same to my google earth
i got the following error:
fetch network
link"failed"(http://localhost/mapguide/googleEarth/calles.php")
http:server error.

My calles.php is as follows

<?php
	include 'AppConstants.php';
	include 'UtilityFunctions.php';
  $outString = '';
	MgInitializeWebTier ($configFilePath);
	$siteConnection = new MgSiteConnection();
	$siteConnection->Open(new MgUserInformation("Administrator", "admin"));
	$geometryFactory = new MgGeometryFactory();
	$featureService =
$siteConnection->CreateService(MgServiceType::FeatureService);
   $resourceService =
$siteConnection->CreateService(MgServiceType::ResourceService);
      $map = new MgMap();
      $map->Open($resourceService,'Mapdata');
       $layer =  $map->GetLayers()->GetItem(4);
       $layerClassName = $layer->GetFeatureClassName();
	$outString .= '<?xml version="1.0" encoding="UTF-8"?>';
	 $outString .= '<kml xmlns="http://earth.google.com/kml/2.0">';
	 $outString .= '<Document>';
   $outString .= '
  <Style id="myBoundaryLine">
    <LineStyle>
      <color>ffff00ff</color>
      <colorMode>normal</colorMode>
      <width>3</width>
    </LineStyle>
    <PolyStyle>
        <color>00ffffff</color>
        <colorMode>normal</colorMode>
    </PolyStyle>
  </Style>
';

	$featureReader = $featureService->SelectFeatures(new
MgResourceIdentifier("Library://demodata/Data/Towerdata.FeatureSource"),
$layerClassName, null);
	$geometryReaderWriter = new MgAgfReaderWriter();
	while ($featureReader->ReadNext())
	{
		$byteReader = $featureReader->GetGeometry('Geometry');
		$geometry = $geometryReaderWriter->Read($byteReader);
		$outString .= '<Placemark>';
		$outString .= '<name>'. 
$featureReader->GetString($featureReader->GetPropertyName(1)) .'</name>';
		$outString .= '<styleUrl>#myBoundaryLine</styleUrl>';

		$outString .= CreateKMLGeometry($geometry, 0);

		$outString .= '</Placemark>';
	}
	$featureReader->Close();
	 $outString .= '</Document>';
	  $outString .= '</kml>';
echo ($outString);
   SendKmlContent($outString,'kml');
?>

please help me if anything i done wrong??????


-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Mapguide-users-KML-files-and-Localhost-tp1808003p5263587.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list