Infrastructure Map Server General Discussion

Infrastructure Map Server General Discussion

Reply
Member
crkunz
Posts: 4
Registered: ‎03-19-2009
Message 1 of 7 (679 Views)

symbol definition with xml

679 Views, 6 Replies
03-19-2009 03:02 AM
Hello,
I’m running MapGuide Studio 2009 and trying to define symbols with an xml-schema.

I would like to write an xml-file, which defines the scale ranges with different sizes of the symbol.

I’ve imported the dwg-file in Map Guide Studio, saved the SymbolDefinition-file, defined the LayerDefinition-file and loaded both up with Map Agent (Set Resource).
Well, now I can see the symbol in the map and in the Layer Definition, but I can’t resize the symbol or change its color. I thought I had to define it in the xml-file but everything I’ve tried didn’t work.

Does anyone have any suggestions, comments or helpful links?

Any help would be appreciated.

Charlotte
(and sorry for my English)
Employee
dswilson
Posts: 729
Registered: ‎09-14-2006
Message 2 of 7 (679 Views)

Re: symbol definition with xml

04-14-2009 03:33 PM in reply to: crkunz
The symbol schema is pretty complicated and allows for many variations. There are specific tags for the color and the size and these would have to be defined within each scale range definition or in each symbol. One example would be to create multiple versions of the Symbols in a folder in your site explorer and change their definition to inherently have a different color and a different size based on a series of draw moves (a Path symbol). Then create your layer definition so that it references the different symbols in the different scale ranges.

If you attach what you have so far in XML files it might be easier to give some direction. Some examples for defining the symbols can be found here:

http://trac.osgeo.org/mapguide/wiki/MapGuideRfc14

Regards,
Dave


Dave Wilson
SQA Analyst
AEC IM
Autodesk, Inc.

New Member
Peter56
Posts: 2
Registered: ‎10-02-2008
Message 3 of 7 (679 Views)

Re: symbol definition with xml

04-21-2009 08:01 AM in reply to: crkunz
Hello Charlotte,



you can scale the symbol in the layer definition. For example:



<CompositeRule>

<LegendLabel></LegendLabel>

<Filter>"BLName" = 'F-AB-ABZWL'</Filter>

<CompositeSymbolization>

<SymbolInstance>

<ResourceId>Library://kempen/symbole/fw/F-AB-ABZWL.SymbolDefinition</ResourceId>

<ParameterOverrides />

<ScaleX>ScaleX</ScaleX>

<ScaleY>ScaleY</ScaleY>

<SizeContext>MappingUnits</SizeContext>

</SymbolInstance>

</CompositeSymbolization>

</CompositeRule>

In this example, the scalefactors (ScaleX and ScaleY) are database fields. Otherwise you can use discrete values (I think real values).

The color you can set in the <Path>-tag of the symbol definition:



<Name>F-AB-ABZWL</Name>

<Graphics>

<Path>

<Geometry>M 100 ,-300 L -497.123 ,-300</Geometry>

<LineColor>ff009900</LineColor>

<LineWeight>%LINIENBREITE%</LineWeight>

</Path>



You can define the colors as hex values or as parameters.

Unfortunately you can't use database values for the color.

Some more informations (only in German) you can find on

http://www.bricscad.bplaced.net/html/mapguide_und_symbole.html

It's only a small private site. I hope to improve the site until end of may. It's a matter of time. At the moment I'm writing some VBA lines for automatic generation of the XML-files from AutoCAD blocks.

Feel free to ask me, if You are interested in sharing codes or call me, if you are German speeking.



Regards - Peter - and sorry too for bad English Edited by: peter56 on Apr 21, 2009 3:02 PM
Member
crkunz
Posts: 4
Registered: ‎03-19-2009
Message 4 of 7 (679 Views)

Re: symbol definition with xml

04-27-2009 02:27 AM in reply to: crkunz

Hello,
many thanks to both of you! The xml-definiton for the symbol and layer now works fine.
I know the bricscad page... it really helped me to understand the xml-definitons, and get started with it. (and yes, im german speaking)
Now i got the xml-symbols in the map, but i can't select them anymore. I searched the internet, but i couldn't find out, if this is possible or if this is not possible. Do you know anything about it?

well here ist the symbol definiton i have so far:
<?xml version="1.0" encoding="UTF-8"?>
<SimpleSymbolDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SymbolDefinition-1.1.0.xsd" version="1.1.0">

<Name>Symbol</Name>
<Graphics>
<Path>
<Geometry>M -200,-500 L 200,-500 L 0,100 Z</Geometry>
<FillColor>ffee82ee</FillColor>
<LineColor>ff000000</LineColor>
<LineWeight>0.0</LineWeight>
<LineWeightScalable>true</LineWeightScalable>
</Path>
<Path>
<Geometry>M -300,100 L 300,100</Geometry>
<FillColor>00000000</FillColor>
<LineColor>ff000000</LineColor>
<LineWeight>0.0</LineWeight>
<LineWeightScalable>true</LineWeightScalable>
</Path>
<Path>
<Geometry>M -250,350 L 0,100 L 250,350</Geometry>
<FillColor>00000000</FillColor>
<LineColor>ff000000</LineColor>
<LineWeight>0.0</LineWeight>
<LineWeightScalable>true</LineWeightScalable>
</Path>
<Path>
<Geometry>M 0,500 L 0,100</Geometry>
<FillColor>00000000</FillColor>
<LineColor>ff000000</LineColor>
<LineWeight>0.0</LineWeight>
<LineWeightScalable>true</LineWeightScalable>
</Path>
</Graphics>
<PointUsage/>
<ParameterDefinition/>
</SimpleSymbolDefinition>

and a part of the layer definition:



<?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.2.0.xsd" version="1.2.0">
<VectorLayerDefinition>
<ResourceId>Library://leuchten/Daten/A70_S_City.FeatureSource</ResourceId>
<FeatureName>SDF_2_Schema:A70_S_CityErweitert</FeatureName>
<FeatureNameType>FeatureClass</FeatureNameType>
<PropertyMapping>
<Name>A70_S_AUSLEGERID</Name>
<Value>ID</Value>
</PropertyMapping>
[...]
<PropertyMapping>
<Name>A70_S_AUSLEGERMASTHERSTELLER</Name>
<Value>Masthersteller</Value>
</PropertyMapping>
<Geometry>Data</Geometry>
<VectorScaleRange>
<MaxScale>2500</MaxScale>
<CompositeTypeStyle>
<CompositeRule>
<LegendLabel>BodenLP</LegendLabel>
<CompositeSymbolization>
<SymbolInstance>
<ResourceId>Library://leuchten/Symbole/A70_MA_City.SymbolDefinition</ResourceId>
<ParameterOverrides/>
<ScaleX>10</ScaleX>
<ScaleY>10</ScaleY>
<SizeContext>MappingUnits</SizeContext>
</SymbolInstance>
</CompositeSymbolization>
</CompositeRule>
</CompositeTypeStyle>
</VectorScaleRange>
<VectorScaleRange>
<MinScale>2500</MinScale>
<MaxScale>5000</MaxScale>
<CompositeTypeStyle>
<CompositeRule>
<LegendLabel>BodenLP</LegendLabel>
<CompositeSymbolization>
<SymbolInstance>
<ResourceId>Library://leuchten/Symbole/A70_MA_City.SymbolDefinition</ResourceId>
<ParameterOverrides/>
<ScaleX>20</ScaleX>
<ScaleY>20</ScaleY>
<SizeContext>MappingUnits</SizeContext>
</SymbolInstance>
</CompositeSymbolization>
</CompositeRule>
</CompositeTypeStyle>
</VectorScaleRange>
</VectorLayerDefinition>
</LayerDefinition>

Regards

Charlotte

Edited by: crkunz on Apr 27, 2009 9:35 AM
New Member
Peter56
Posts: 2
Registered: ‎10-02-2008
Message 5 of 7 (679 Views)

Re: symbol definition with xml

05-14-2009 01:16 AM in reply to: crkunz
Hello,

I don't know, if it really helps, but with MG2009 (MGOS 2.0 too) and eaerlier I found, that selection custom symbols is very heavy. Could it be a matter of draw order? I check this cases by turning off all other layers and try to pick exactly the insertation point or use a select by window.

Generally it is possible to select this symbols. By the way ... in my applications they are only shown, if the baspoint is viewable in the map.

Regards - Peter
Member
crkunz
Posts: 4
Registered: ‎03-19-2009
Message 6 of 7 (679 Views)

Re: symbol definition with xml

05-14-2009 02:33 AM in reply to: crkunz
Hello,
well, i think MGE 2009 just dont support a selection of custom symbols...
i also tried to select the symbols by turning all layers of or picking exactly the basepoint, but nothing worked.
If there is a way or a solution to it, then i dont know it.

We got MGE 2010 two weeks ago, and with 2010 it is possible to select custom items, without any problems. I just defined the symboldefiniton and changed the layerdefinition,... and voilà; the symbols are selectable.

Regards
Charlotte
Contributor
MarkVolz4695
Posts: 22
Registered: ‎07-09-2009
Message 7 of 7 (679 Views)

Re: symbol definition with xml

07-09-2009 12:35 AM in reply to: crkunz
If you are using a database as your data source I have found that in order to select objects (with any sense of success) it is nessary to have a primary key set on the table.

Mark
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.