[mapguide-users] Dynamically creating a line layer with SDF
Feature Source
Jackie Ng
jackie.ng at aecsystems.com.au
Wed Nov 28 22:32:11 EST 2007
Just looking at your code...
Validation is failing because the $featureName should be an enumerated value
( "FeatureClass" or "NamedExtension" )
The value of $featureClass should actually be the resourceid of the layer
definition xml document. The current value should be the current value of
$featureName (ie. $featureClass = "SDF_2_Schema:Selected")
- Jackie
uXuf wrote:
>
> Hi all,
>
> I am trying to add a layer of lines to my map using an existing
> FeatureSource in the library. This FeatureSource was generated from an SDF
> (created by Map 3D). I want to create the layer using the
> LayerDefinitionFactory instead of the usual XML file way.
>
> However, I get a "The new XML document is invalid" error when I try to use
> the add_layer_definition_to_map() function of the
> LayerDefinitionFactory.php. Inspecting this problem it turns out that the
> layer definition that (I think) I am sending with the code is failing to
> validate with the LayerDefinition-1.0.0.xsd. I haven't touched the XSD
> file at all since installation. Probably this error could lie when I am
> creating my geometry, I checked in the examples and consistently it was
> specified as "SHPGEOM", however when I check it out in Studio by creating
> a temporary layer from the feature source it is specified as "Data". I
> have also checked by specifying geometry as "Data". The error remains so.
>
> Another thing I am getting confused in is to provide the Feature Name. I
> provide it with the value of "SDF_2_Schema:Selected", but I am not sure
> whether I should use "SHP_Schema:Selected". Any pointers in this regard
> would be greatly welcomed.
>
> Here is the relevant part of my code:
>
> //Set up a temporary layer
> $factory = new LayerDefinitionFactory();
> $legendLabel = '';
> $filter = '';
> $color = 'FF0000FF';
> $lineRule = $factory->CreateLineRule($legendLabel, $filter, $color);
> $lineTypeStyle = $factory->CreateLineTypeStyle($lineRule);
> $minScale = '0';
> $maxScale = '1000000';
> $lineScaleRange = $factory->CreateScaleRange($minScale, $maxScale,
> $lineTypeStyle);
>
> //The following FeatureSource is generated from and SDF
> $featureClass = "Library://akMaps/Data/Arteries.FeatureSource";
>
> //Could this be the real culprit?
> $featureName = "SDF_2_Schema:Selected";
>
> //Or this?
> $geometry = 'Data';
> $layerDefinition = $factory->CreateLayerDefinition($featureClass,
> $featureName, $geometry, $lineScaleRange);
>
> //error occurs in this function, fails to validate with
> LayerDefinition.xsd
> $newLayer = add_layer_definition_to_map($layerDefinition, "Selected",
> "Selected", $mgSessionID, $resourceService, $map);
>
>
> Any help would be greatly appreciated.
>
> Thanks in advance,
> uXuf
>
>
--
View this message in context: http://www.nabble.com/Dynamically-creating-a-line-layer-with-SDF-Feature-Source-tf4893966s16610.html#a14018732
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list