[mapguide-users] Re: How to change Existing Max scale for a layer

SriRam007 binod_tripathy at yahoo.co.in
Fri Feb 26 05:48:07 EST 2010


Hi Kenneth,

I m trying with the Sheboygan

+Sheboygan
    +Layers
       . Buildings
       . CityLimits
       . Roads

Here road layer is having Scale ranges like 

 Range       From     To 
 ------------------------- 
 1            0            10000 
 2            10000      24000 

Am showing all the ranges to let the user edit at runtime . And changing
scale below 24000 is working 
but beyond 24000 it is not working.

And its XML file is like below. And I am changing the bold line 

<?xml version="1.0" encoding="UTF-8"?>
<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:noNamespaceSchemaLocation="LayerDefinition-1.3.0.xsd" version="1.3.0">
  <VectorLayerDefinition>
   
<ResourceId>Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource</ResourceId>
    <FeatureName>SHP_Schema:RoadCenterLines</FeatureName>
    <FeatureNameType>FeatureClass</FeatureNameType>
    <Geometry>SHPGEOM</Geometry>
    <VectorScaleRange>
      <MaxScale>10000</MaxScale>      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <Label>
            <Unit>Points</Unit>
            <SizeContext>DeviceUnits</SizeContext>
            <SizeX>0</SizeX>
            <SizeY>8</SizeY>
            <Text>"NAME"</Text>
            <FontName>Verdana</FontName>
            <ForegroundColor>FF000000</ForegroundColor>
            <BackgroundColor>FFFFFFFF</BackgroundColor>
            <BackgroundStyle>Transparent</BackgroundStyle>
            <HorizontalAlignment>'Center'</HorizontalAlignment>
            <VerticalAlignment>'Baseline'</VerticalAlignment>
            <AdvancedPlacement>
              <ScaleLimit>0.5</ScaleLimit>
            </AdvancedPlacement>
          </Label>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FFFF00FF</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
    <VectorScaleRange>
      <MinScale>"10000"</MinScale>
      <MaxScale>24000</MaxScale>
      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FF808080</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
  </VectorLayerDefinition>
</LayerDefinition>



After modification my XML file :::

 Range       From     To        style(BK color)
 ------------------------------------------
 1            0            11000    Pink
 2            11000      25000    Green

<?xml version="1.0" encoding="UTF-8"?>
<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:noNamespaceSchemaLocation="LayerDefinition-1.3.0.xsd" version="1.3.0">
  <VectorLayerDefinition>
   
<ResourceId>Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource</ResourceId>
    <FeatureName>SHP_Schema:RoadCenterLines</FeatureName>
    <FeatureNameType>FeatureClass</FeatureNameType>
    <Geometry>SHPGEOM</Geometry>
    <VectorScaleRange>
      <MiniScale>0</MiniScale>
      <MaxScale>11000</MaxScale>      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <Label>
            <Unit>Points</Unit>
            <SizeContext>DeviceUnits</SizeContext>
            <SizeX>0</SizeX>
            <SizeY>8</SizeY>
            <Text>"NAME"</Text>
            <FontName>Verdana</FontName>
            <ForegroundColor>FF000000</ForegroundColor>
            <BackgroundColor>FFFFFFFF</BackgroundColor>
            <BackgroundStyle>Transparent</BackgroundStyle>
            <HorizontalAlignment>'Center'</HorizontalAlignment>
            <VerticalAlignment>'Baseline'</VerticalAlignment>
            <AdvancedPlacement>
              <ScaleLimit>0.5</ScaleLimit>
            </AdvancedPlacement>
          </Label>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FFFF00FF</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
    <VectorScaleRange>
      <MinScale>"11000"</MinScale>
      <MaxScale>25000</MaxScale>
      <LineTypeStyle>
        <LineRule>
          <LegendLabel>
          </LegendLabel>
          <LineSymbolization2D>
            <LineStyle>Solid</LineStyle>
            <Thickness>0.5</Thickness>
            <Color>FF808080</Color>
            <Unit>Millimeters</Unit>
            <SizeContext>DeviceUnits</SizeContext>
          </LineSymbolization2D>
        </LineRule>
      </LineTypeStyle>
    </VectorScaleRange>
  </VectorLayerDefinition>
</LayerDefinition>

And i m saving like
resourceService.SetResource(layerResId, new MgByteReader(layerDefinition,
"text/xml"), null);
            layer.SetLayerDefinition(layerResId, resourceService);
            map.Save(resourceService);
then refreshing the map by mapFrame.Refresh();


But the second range is visible upto 24000.
If i will give below 24000 instead of beyond 24000 then everything is
working 
Layer is showing with its style
(0 - 11000  :Pink color 
And 11000 - 24000 (Or below) : Green Color is showing) 
for the respective ranges.

thanks










-- 
View this message in context: http://n2.nabble.com/How-to-change-Existing-Max-scale-for-a-layer-tp4637661p4638326.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list