[mapguide-users] dynamic label rotation

Walt Welton-Lair walt.welton-lair at autodesk.com
Fri Mar 17 12:36:58 EST 2006


I tracked this down, and it's a bug that manifests itself in Studio.  When the label is set to use an expression for the rotation, that information is not getting saved into the layer definition.

The only workaround I can think of is for you to hand edit the layer definition XML and add the missing information.  You can use the server test forms to help you do this.  Here's what you need to do:

1/ Get the full resource ID of the layer definition
   - in Studio right-click the point layer and bring up its properties
   - under the General tab note the "Resource name" and "Location"
   - combine these into a full path using "<Location>/<Resource name>.LayerDefinition"
       e.g. if your "Location" is "Library://Layers" and "Resource name" is
       "test_strassen_name" then the full path is
       "Library://Layers/test_strassen_name.LayerDefinition"

2/ Open the XML for the layer definition
   - open the test forms in your browser (http://<hostname>/mapguide/mapagent/index.html)
   - click on GetResourceContent
   - in the "Resource ID" field enter the ID from step 1
   - click submit
   - right click in the frame containing the generated XML and select "View Source"

3/ Edit the layer definition
   - locate the first <Label> element; it should have this structure:
       <Label>
         <Unit>Points</Unit>
         <SizeContext>DeviceUnits</SizeContext>
         <SizeX>0.3</SizeX>
         <SizeY>8</SizeY>
         <Rotation>ORI</Rotation>
         <Text>NAME</Text>
         <FontName>Arial</FontName>
         <ForegroundColor>FF000000</ForegroundColor>
         <BackgroundColor>FFFFFFFF</BackgroundColor>
         <BackgroundStyle>Ghosted</BackgroundStyle>
         <HorizontalAlignment>&apos;Center&apos;</HorizontalAlignment>
         <VerticalAlignment>&apos;Baseline&apos;</VerticalAlignment>
       </Label>
   - note that yours should be missing the <Rotation> field; add it (as above),
     setting its value to the expression you want

 4/ Save the updated layer definition
   - save the modified layer definition XML to a text file on your machine
   - in the test forms click on SetResource
   - in the "Resource ID" field enter the ID from step 1
   - in the "Content" field click on "Browse..." and select the text file you saved
   - click submit

The point layer should now use the expression for the label rotation.

Note that if you save the layer again from Studio you will unfortunately lose the edit you made.  Since the above steps take some time, wait until your happy with your point layer and then add this as a final modification.

Walt


-----Original Message-----
From: Sacha Genoud [mailto:s.genoud at mkreis.ch] 
Sent: Friday, March 17, 2006 4:04 AM
To: users at mapguide.osgeo.org
Subject: Re: [mapguide-users] dynamic label rotation


It is a point layer and the attribute is  a number. I have the file 
attached.





Traian Stanev schrieb:

>What kind of layer is it -- point, polygon or line? What kind of property is it -- string, number?
>
>
>-----Original Message-----
>From: Sacha Genoud [mailto:s.genoud at mkreis.ch] 
>Sent: Thursday, March 16, 2006 4:04 AM
>To: users at mapguide.osgeo.org
>Subject: Re: [mapguide-users] dynamic label rotation
>
>
>Hi Traian,
>
>that is what i have done, but it does not work. I have checkt the file 
>and the values in the file
>are ok. Is it a bug?
>
>Thanks!
>
>Sacha
>
>
>
>Traian Stanev schrieb:
>
>  
>
>>Hi,
>>
>>You need to pick "Expression" in the Rotation listbox when setting up
>>the style. See attached screenshot. This will let you base rotation
>>angle on a property value from your data source.
>>
>>Traian
>>
>>
>>-----Original Message-----
>>From: Sacha Genoud [mailto:s.genoud at mkreis.ch] 
>>Sent: Wednesday, March 15, 2006 8:28 AM
>>To: users at mapguide.osgeo.org
>>Subject: [mapguide-users] dynamic label rotation
>>
>>
>>
>>can labels rotated with a value from a shp file in mapguide studio? it 
>>works only
>>with static vlaues?
>>
>>Sacha
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
>>For additional commands, e-mail: users-help at mapguide.osgeo.org
>>
>>
>> 
>>
>>
>>------------------------------------------------------------------------
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
>>For additional commands, e-mail: users-help at mapguide.osgeo.org
>>
>>    
>>
>
>
>  
>


-- 





Gruss

Sacha



-------------------------------------
Kreis AG Sargans
Ingenieur- und Vermessungsbüro
Kantonsschulweg 12

CH-7320 Sargans(Hauptbetrieb)
Tel. +41 (0)81 720 05 00
Fax +41 (0)81 720 05 05

Homepage : http://www.mkreis.ch
E-Mail   : mailto:s.genoud at mkreis.ch
------------------------------------- 






More information about the Mapguide-users mailing list