Ejemplo n.º 1
0
     $lineRule = $factory->CreateLineRule($ruleLegendLabel, $filter, $color);
     // Create a line type style
     $lineTypeStyle = $factory->CreateLineTypeStyle($lineRule);
     // Create a scale range
     $minScale = '0';
     $maxScale = '1000000000000';
     $lineScaleRange = $factory->CreateScaleRange($minScale, $maxScale, $lineTypeStyle);
     // Create the layer definiton
     $featureName = 'SHP_Schema:Lines';
     $geometry = 'SHPGEOM';
     $layerDefinition = $factory->CreateLayerDefinition($featureSourceName, $featureName, $geometry, $lineScaleRange);
     //---------------------------------------------------//
     // Add the layer to the map
     $newLayer = add_layer_definition_to_map($layerDefinition, $layerName, $layerLegendLabel, $sessionId, $resourceService, $map);
     // Add the layer to a layer group
     add_layer_to_group($newLayer, $groupName, $groupLegendLabel, $map);
 }
 // --------------------------------------------------//
 // Turn on the visibility of this layer.
 // (If the layer does not already exist in the map, it will be visible by default when it is added.
 // But if the user has already run this script, he or she may have set the layer to be invisible.)
 $layerCollection = $map->GetLayers();
 if ($layerCollection->Contains($layerName)) {
     $linesLayer = $layerCollection->GetItem($layerName);
     $linesLayer->SetVisible(true);
 }
 $groupCollection = $map->GetLayerGroups();
 if ($groupCollection->Contains($groupName)) {
     $analysisGroup = $groupCollection->GetItem($groupName);
     $analysisGroup->SetVisible(true);
 }
Ejemplo n.º 2
0
 $query = '//LegendLabel';
 // Get a list of all the <LegendLabel> elements in the
 // XML.
 $nodes = $xpath->query($query);
 // Find the correct node and change it
 foreach ($nodes as $node) {
     if ($node->nodeValue == 'Built after 1950') {
         $node->nodeValue = 'Built after 1980';
     }
 }
 // --------------------------------------------------//
 // ...
 // Add the layer to the map
 $layerDefinition = $domDocument->saveXML();
 $newLayer = add_layer_definition_to_map($layerDefinition, "RecentlyBuilt", "Built after 1980", $sessionId, $resourceService, $map);
 add_layer_to_group($newLayer, "Analysis", "Analysis", $map);
 // --------------------------------------------------//
 // Turn off the "Square Footage" themed layer (if it
 // exists) so it does not hide this layer.
 $layerCollection = $map->GetLayers();
 if ($layerCollection->Contains("SquareFootage")) {
     $squareFootageLayer = $layerCollection->GetItem("SquareFootage");
     $squareFootageLayer->SetVisible(false);
 }
 // --------------------------------------------------//
 // Turn on the visibility of this layer.
 // (If the layer does not already exist in the map, it will be visible by default when it is added.
 // But if the user has already run this script, he or she may have set the layer to be invisible.)
 $layerCollection = $map->GetLayers();
 if ($layerCollection->Contains("RecentlyBuilt")) {
     $recentlyBuiltLayer = $layerCollection->GetItem("RecentlyBuilt");