The XML Files
This sample uses data from the BuildMap developer sample. When you run
BuildMap, it writes these files to the directory containing BuildMap.dll. See
the Developer Samples Guide for details.
One file is Zoning.layer. This specifies all the properties for drawing one layer
in a map. Note the <ResourceId> element, which refers to the resource for
the feature source.
<?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"
version="1.0.0">
<VectorLayerDefinition>
<ResourceId>Library://Data/SDF/Zoning.FeatureSource
</ResourceId>
<FeatureName>Schema:Zoning</FeatureName>
<FeatureNameType>FeatureClass</FeatureNameType>
<Geometry>Geometry</Geometry>
<VectorScaleRange>
<AreaTypeStyle>
<AreaRule>
<LegendLabel />
<AreaSymbolization2D>
<Fill>
<FillPattern>Solid</FillPattern>
<ForegroundColor>a03cafda</ForegroundColor>
<BackgroundColor>FF000000</BackgroundColor>
</Fill>
<Stroke>
<LineStyle>Solid</LineStyle>
<Thickness>0.0</Thickness>
<Color>FF000000</Color>
<Unit>Centimeters</Unit>
</Stroke>
</AreaSymbolization2D>
</AreaRule>
</AreaTypeStyle>
</VectorScaleRange>
</VectorLayerDefinition>
</LayerDefinition>
12 | Chapter 2 Resources
The second file is Zoning.FeatureSource, which defines the properties of an SDF
feature source. The File parameter points to the location on disk. See Feature
Service on page 17 for more details.
<?xml version="1.0" encoding="utf-8"?>
<FeatureSource xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
stance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Provider>OSGeo.SDF.3.3</Provider>
<Parameter>
<Name>File</Name>
<Value>C:\Map 3D SDK\Map Samples\Plat
form\BuildMap\Data\SDF\Zoning.sdf</Value>
</Parameter>
<Parameter>
<Name>ReadOnly</Name>
<Value>False</Value>
</Parameter>
</FeatureSource>
Adding The Resource
To use the XML files to create the layer and the feature source, use
MgResourceService.SetResource(). For example:
Adding The Resource | 13