Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

symbol definition with xml

6 REPLIES 6
Reply
Message 1 of 7
crkunz
1005 Views, 6 Replies

symbol definition with xml

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)
6 REPLIES 6
Message 2 of 7
dswilson
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
Message 3 of 7
Peter56
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
Message 4 of 7
crkunz
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
Message 5 of 7
Peter56
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
Message 6 of 7
crkunz
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
Message 7 of 7
MarkVolz4695
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report