[mapguide-commits] r5588 - trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Mar 3 10:09:31 EST 2011


Author: jng
Date: 2011-03-03 07:09:31 -0800 (Thu, 03 Mar 2011)
New Revision: 5588

Modified:
   trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/RecentlyBuilt.LayerDefinition
   trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_point_layer_definition.php
   trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/layer_functions.php
Log:
#1614: Fix point of interests layer not showing due to 2 things:
 - Point feature source is in Arbitrary XY which does not transform to Sheboygan's CS (LL84). Maybe this worked in the days pre MGOS 2.0, but it doesn't now.
 - Update version attribute and schema version of the RecentlyBuilt.LayerDefinition

Modified: trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/RecentlyBuilt.LayerDefinition
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/RecentlyBuilt.LayerDefinition	2011-03-03 14:32:22 UTC (rev 5587)
+++ trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/RecentlyBuilt.LayerDefinition	2011-03-03 15:09:31 UTC (rev 5588)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<LayerDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LayerDefinition-1.1.0.xsd">
+<LayerDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LayerDefinition-1.3.0.xsd">
 	<VectorLayerDefinition>
 		<ResourceId>Library://Samples/Sheboygan/Data/Parcels.FeatureSource</ResourceId>
 		<FeatureName>SHP_Schema:Parcels</FeatureName>

Modified: trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_point_layer_definition.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_point_layer_definition.php	2011-03-03 14:32:22 UTC (rev 5587)
+++ trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/create_new_point_layer_definition.php	2011-03-03 15:09:31 UTC (rev 5588)
@@ -97,8 +97,10 @@
 	// Create the feature source
 	$featureSourceName = 'Library://Samples/DevGuide/Data/points.FeatureSource';
 	$resourceIdentifier = new MgResourceIdentifier($featureSourceName);
-	$wkt = "LOCALCS[\"*XY-MT*\",LOCAL_DATUM[\"*X-Y*\",10000],UNIT[\"Meter\", 1],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]";
-	$sdfParams = new MgCreateSdfParams("ArbitraryXY", $wkt, $featureSchema);
+	//$wkt = "LOCALCS[\"*XY-MT*\",LOCAL_DATUM[\"*X-Y*\",10000],UNIT[\"Meter\", 1],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]";
+    $wkt = 'GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.01745329251994]]';
+	//$sdfParams = new MgCreateSdfParams("ArbitraryXY", $wkt, $featureSchema);
+    $sdfParams = new MgCreateSdfParams("LatLong", $wkt, $featureSchema);
     $featureService->CreateFeatureSource($resourceIdentifier, $sdfParams);
 
 	// We need to add some data to the sdf before using it.  The spatial context

Modified: trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/layer_functions.php
===================================================================
--- trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/layer_functions.php	2011-03-03 14:32:22 UTC (rev 5587)
+++ trunk/MgDev/Doc/samples/phpsamples/modifying_maps_and_layers/layer_functions.php	2011-03-03 15:09:31 UTC (rev 5588)
@@ -20,26 +20,26 @@
 // Adds the layer definition (XML) to the map.
 // Returns the layer.
 {
-  global $schemaDirectory;
+    global $schemaDirectory;
 
     // Validate the XML.
     $domDocument = new DOMDocument;
     $domDocument->loadXML($layerDefinition);
-  if (! $domDocument->schemaValidate($schemaDirectory . "LayerDefinition-1.3.0.xsd") ) // $schemaDirectory is defined in common.php
-  {
-    echo "ERROR: The new XML document is invalid.<BR>\n.";
-    return NULL;
-  }    
+    if (! $domDocument->schemaValidate($schemaDirectory . "LayerDefinition-1.3.0.xsd") ) // $schemaDirectory is defined in common.php
+    {
+        echo "ERROR: The new XML document is invalid.<BR>\n.";
+        return NULL;
+    }    
 
-  // Save the new layer definition to the session repository  
-  $byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition));
-  $byteSource->SetMimeType(MgMimeType::Xml);
-  $resourceID = new MgResourceIdentifier("Session:$sessionId//$layerName.LayerDefinition");
-  $resourceService->SetResource($resourceID, $byteSource->GetReader(), null);
-  
-  $newLayer = add_layer_resource_to_map($resourceID, $resourceService, $layerName, $layerLegendLabel, $map);
-  
-  return $newLayer;
+    // Save the new layer definition to the session repository  
+    $byteSource = new MgByteSource($layerDefinition, strlen($layerDefinition));
+    $byteSource->SetMimeType(MgMimeType::Xml);
+    $resourceID = new MgResourceIdentifier("Session:$sessionId//$layerName.LayerDefinition");
+    $resourceService->SetResource($resourceID, $byteSource->GetReader(), null);
+
+    $newLayer = add_layer_resource_to_map($resourceID, $resourceService, $layerName, $layerLegendLabel, $map);
+
+    return $newLayer;
 }
 
 //////////////////////////////////////////////////////////////
@@ -47,24 +47,24 @@
 // Adds a layer to a layer group. If necessary, it creates the layer group.
 {
   
-  // Get the layer group
-  $layerGroupCollection = $map->GetLayerGroups();
-  if ($layerGroupCollection->Contains($layerGroupName))
-  {
-    $layerGroup = $layerGroupCollection->GetItem($layerGroupName);
-  }
-  else
-  {
-    // It does not exist, so create it
-    $layerGroup = new MgLayerGroup($layerGroupName); 
-    $layerGroup->SetVisible(true);
-    $layerGroup->SetDisplayInLegend(true);
-    $layerGroup->SetLegendLabel($layerGroupLegendLabel);
-    $layerGroupCollection->Add($layerGroup); 
-  }
-  
-  // Add the layer to the group
-  $layer->SetGroup($layerGroup);  
+    // Get the layer group
+    $layerGroupCollection = $map->GetLayerGroups();
+    if ($layerGroupCollection->Contains($layerGroupName))
+    {
+        $layerGroup = $layerGroupCollection->GetItem($layerGroupName);
+    }
+    else
+    {
+        // It does not exist, so create it
+        $layerGroup = new MgLayerGroup($layerGroupName); 
+        $layerGroup->SetVisible(true);
+        $layerGroup->SetDisplayInLegend(true);
+        $layerGroup->SetLegendLabel($layerGroupLegendLabel);
+        $layerGroupCollection->Add($layerGroup); 
+    }
+
+    // Add the layer to the group
+    $layer->SetGroup($layerGroup);  
 }
 
 //////////////////////////////////////////////////////////////
@@ -73,22 +73,22 @@
 // repository) to the map.
 // Returns the layer.
 {
-  $newLayer = new MgLayer($layerResourceID, $resourceService);  
-  
-  // Add the new layer to the map's layer collection
-  $newLayer->SetName($layerName);
-  $newLayer->SetVisible(true);
-  $newLayer->SetLegendLabel($layerLegendLabel);
-  $newLayer->SetDisplayInLegend(true);
-  $layerCollection = $map->GetLayers(); 
-  if (! $layerCollection->Contains($layerName) )
-  {
-    // Insert the new layer at position 0 so it is at the top
-    // of the drawing order
-    $layerCollection->Insert(0, $newLayer); 
-  }
-  
-  return $newLayer;
+    $newLayer = new MgLayer($layerResourceID, $resourceService);  
+
+    // Add the new layer to the map's layer collection
+    $newLayer->SetName($layerName);
+    $newLayer->SetVisible(true);
+    $newLayer->SetLegendLabel($layerLegendLabel);
+    $newLayer->SetDisplayInLegend(true);
+    $layerCollection = $map->GetLayers(); 
+    if (! $layerCollection->Contains($layerName) )
+    {
+        // Insert the new layer at position 0 so it is at the top
+        // of the drawing order
+        $layerCollection->Insert(0, $newLayer); 
+    }
+
+    return $newLayer;
 }
 
 //////////////////////////////////////////////////////////////



More information about the mapguide-commits mailing list