Creating Maps With Style


Published on

MapGuide Open Source includes a symbolization engine that allows users to define custom libraries of dynamic, expression-driven symbols for everything from highway shields to utility network symbology. This slideshow provides an overview of the new XML Symbol formats and shows participants how to define symbols in XML and use them to stylize feature data in MapGuide. In the class, participants will see how to create a small symbol library and use the symbols for styling points, lines, and labels in MapGuide.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Creating Maps With Style

  1. 1. Creating Maps with Style<br />Defining and Using Custom Cartographic Symbols in MapGuide<br />
  2. 2. Session Outline<br /><ul><li>Introduction to MapGuide’s New Cartographic Model
  3. 3. Simple Symbols and Point Usage
  4. 4. Simple Symbols and Line Usage
  5. 5. Compound Symbols
  6. 6. Data Driven Symbols</li></li></ul><li>Introduction to MapGuide’s New Cartographic Model<br />
  7. 7. MapGuide Cartographic Examples<br />Custom line styles and patterns<br />Repeating line labels and directional arrows<br />Ability to offset symbology from the geometry<br />
  8. 8. MapGuide Cartographic Examples<br />A more consistent and accurate way to define cased-lines<br />Use of symbols on lines for labeling, e.g. highway shields, utility symbology, etc. <br />
  9. 9. The New Cartographic Model<br />Simple Symbol Definition<br />Graphics<br />Resize Box<br />
  10. 10. The New Cartographic Model<br />Simple Symbol Definition<br />Graphics<br />Resize Box<br />Point Usage<br />Line Usage<br />Area Usage<br />
  11. 11. The New Cartographic Model<br />Simple Symbol Definition<br />Graphics<br />Resize Box<br />Point Usage<br />Line Usage<br />Area Usage<br />Parameter Definition<br />
  12. 12. The New Cartographic Model<br />Simple Symbol Definition<br />Graphics<br />Resize Box<br />Point Usage<br />Line Usage<br />Area Usage<br />Parameter Definition<br />Compound Symbol Definition<br />Simple Symbol<br />Simple Symbol<br />. . .<br />Simple Symbol<br />
  13. 13. The New Cartographic Model<br />Layer Definition<br />Simple Symbol Definition<br />Vector Layer Definition<br />Graphics<br />Resize Box<br />Vector Scale Range<br />Point Usage<br />Composite Type Style<br />Line Usage<br />Composite Rule<br />Area Usage<br />Composite Symbolization<br />Parameter Definition<br />Symbol Instance<br />Compound Symbol Definition<br />Simple Symbol<br />Simple Symbol<br />. . .<br />Simple Symbol<br />
  14. 14. Status of the Implementation<br />With MapGuide Open Source 1.2<br /><ul><li>Usage with Points is fully functional
  15. 15. Usage for Highway Shields is fully functional
  16. 16. General usage for Lines is considered “Preview”
  17. 17. Code is in place to do line joins for complex line styles, however the code is buggy and requires massaging of the style definition to make it look good</li></ul>Coming in MapGuide Open Source 2.0 (this Fall)<br /><ul><li>Complete support for usage with Lines and Areas
  18. 18. Lots of bug fixes, more control over rendering passes, angular offsets relative to geometry, and legend support for multi-variatethematics (RFC 29)</li></li></ul><li>In this Lab we’ll…<br />Turn this:<br />Into this:<br />
  19. 19. In this Lab we’ll…<br />And turn this:<br />Into this:<br />
  20. 20. Lab SetupLoad, Unpack, and Check<br />Use the MapGuide Administrator application to load the MapsWithStyle.mgp file.http://localhost:8008/mapguide/mapadmin/login.php<br />Unzip the Lab Application files to:C:Program FilesMapGuideOpenSourceWebServerExtensionswww<br />Unzip the lab exercise files to: C:<br />Test: http://localhost:8008/mapguide/maplab/index.php<br />
  21. 21. Simple Symbols and Point Usage<br />
  22. 22. Simple Symbol Definition<br />
  23. 23. Defining Graphics as a Path<br />‘None’<br />‘Round’<br />‘Square’<br />‘Triangle’<br />‘None’<br />‘Bevel’<br />‘Round’<br />‘Miter’<br />
  24. 24. Specifying Geometry<br />Syntax of the Geometry element is a subset of that defined in the Microsoft XPS Abbreviated Geometry Syntax.<br />All coordinates are specified in millimeters and defined in the Cartesian Plane.<br />
  25. 25. Geometry Example<br />To draw a 5 mm square box<br />Would look like:<br />M -2.5,2.5 H 2.5 V -2.5 H -2.5 Z<br />
  26. 26. Geometry Syntax<br />
  27. 27. Geometry Syntax<br />
  28. 28. Defining Graphics as an Image<br />
  29. 29. Defining Graphicsas Text<br />
  30. 30. Point Usage<br />‘FromAngle’<br />or<br />‘FromGeometry’<br />
  31. 31. Example: A Simple Square Symbol<br /><SimpleSymbolDefinition version="1.0.0"><br /> <Name>Blue Square</Name><br /> <Description>Cool a Blue Square</Description><br /> <Graphics><br /> <Path><br /> <Geometry>M -2.5,2.5 H 2.5 V -2.5 H -2.5 Z</Geometry><br /> <FillColor>FF0000FF</FillColor><br /> <LineColor>FFFFFFFF</LineColor><br /> <LineWeight>0.75</LineWeight><br /> <LineWeightScalable>false</LineWeightScalable><br /> </Path><br /></Graphics><br /> <PointUsage><br /> <AngleControl>’FromAngle’</AngleControl><br /> </PointUsage><br /> <ParameterDefinition/><br /></SimpleSymbolDefinition><br />
  32. 32. Layer Definition Changes<br />
  33. 33. Example: Layer with Simple Square<br />--- Common Layer Definition Stuff Removed ---<br /><CompositeTypeStyle><br /> <CompositeRule><br /> <LegendLabel></LegendLabel><br /> <CompositeSymbolization><br /> <SymbolInstance><br /> <ResourceId><br /> Library://CartoSymbols/Square.SymbolDefinition<br /> </ResourceId><br /> <ParameterOverrides/><br /> </SymbolInstance><br /> </CompositeSymbolization><br /> </CompositeRule><br /></CompositeTypeStyle><br />--- Common Layer Definition Stuff Removed ---<br />
  34. 34. Lab Exercise #1Define an International Hospital Symbol<br />Navigate to C:MapsWithStyleLab1<br />Complete Missing Geometry in Hospital.SymbolDefinition.xml<br />Add Symbol Reference: Library://MapsWithStyle/CartoSymbols/Hospital.SymbolDefinitionin Hospital.LayerDefinition.xml<br />In the Lab1 directory run “loadall.bat”<br />
  35. 35. Simple Symbols and Line Usage<br />
  36. 36. Defining Line Patterns<br /><ul><li>Dashed line patterns can be defined by specifying the geometry for a single complete sequence of dashing and then specifying a “Repeat” value.
  37. 37. For example:</li></ul>Geometry: M 0,0 H 4 Z M 6,0 H 2 Z<br />Repeat: 10<br />Results in:<br />
  38. 38. Lines with Decorations<br /><ul><li>Crossing decorations can be added to line patterns by simply adding the additional geometry and repeating the pattern as before.
  39. 39. For example:</li></ul>Geometry: M -2.5,0.0 H 2.5 ZM 0.0,0.5 V -0.5 Z<br />Repeat: 5<br />Results in:<br />
  40. 40. Line Usage<br />‘FromAngle’<br />or<br />‘FromGeometry’<br />‘OverlapNone’<br />‘OverlapDirect’<br />‘OverlapNoWrap’<br />‘OverlapWrap’<br />‘None’<br />‘Bevel’<br />‘Round’<br />‘Miter’<br />
  41. 41. Lab Exercise #2Replace the Railroad Line Pattern<br />Navigate to C:MapsWithStyleLab2<br />Complete Missing Geometry in Railroad.SymbolDefinition.xml<br />Specify the Repeat value in theLineUsage element<br />In the Lab2 directory run “loadall.bat”<br />
  42. 42. Compound Symbols<br />
  43. 43. Compound Symbol Definition<br /><ul><li>Create “cased” line styles
  44. 44. Add decorative symbols at the start, end, or at repeating intervals along a line
  45. 45. The RenderingPass element provides fine-grained control of the draw order</li></li></ul><li>Creating a Highway with Shields<br />The Highway Outline<br /><SimpleSymbol><br /> <SimpleSymbolDefinition><br /> <Name>Outline</Name><br /> <Graphics><br /> <Path><br /> <Geometry>M 0.0,0.0 H 5.0 Z</Geometry><br /> <LineColor>FF000000</LineColor><br /> <LineWeight>1.4</LineWeight><br /> </Path><br /> </Graphics><br /> <LineUsage><br /> <VertexControl>'OverlapWrap'</VertexControl><br /> <StartOffset>0</StartOffset><br /> <Repeat>5.0</Repeat><br /> </LineUsage><br /> <ParameterDefinition/><br /> </SimpleSymbolDefinition><br /> <RenderingPass>0</RenderingPass><br /> </SimpleSymbol><br />
  46. 46. Creating a Highway with Shields<br />The Highway Inner Line<br /> <SimpleSymbolDefinition><br /> <Name>Inner</Name><br /> <Graphics><br /> <Path><br /> <Geometry>M 0.0,0.0 H 5.0 Z</Geometry><br /> <LineColor>FFFF0000</LineColor><br /> <LineWeight>0.8</LineWeight><br /> </Path><br /> </Graphics><br /> <LineUsage><br /> <VertexControl>'OverlapWrap'</VertexControl><br /> <StartOffset>0</StartOffset><br /> <Repeat>5.0</Repeat><br /> </LineUsage><br /> <ParameterDefinition/><br /> </SimpleSymbolDefinition><br /> <RenderingPass>1</RenderingPass><br /> </SimpleSymbol><br />
  47. 47. That was easy, what about the Shield?<br /><ul><li>The Shield is defined as aSimple Symbol containing bothPath and Text Graphic elements
  48. 48. The Text element is placed atthe center of the shield
  49. 49. Using the ResizeControl andResizeBox elements the shield can grow to accommodate multi-digit route numbers
  50. 50. StartOffset and EndOffset elements are used to ensure it starts and ends 50 mm from the endpoints
  51. 51. Repeat is used to draw the shield every 200 mm</li></li></ul><li>Lab Exercise #3Complete the Freeway Compound Symbol<br />Navigate to C:MapsWithStyleLab3<br />Review the Compound Symbol provided inFreeway.SymbolDefinition.xml<br />Specify the 3 RenderingPass elements.<br />Specify the ResizeControl for the Shield to ensure it grows to match the resize box: 'AdjustToResizeBox‘.<br />Specify the ResizeControl for the Text to ensure it expands the resize box: 'AddToResizeBox‘.<br />Specify the GrowControl for the ResizeBox to force the symbol to grow in width: 'GrowInX‘.<br />In the Lab3 directory run “loadall.bat”.<br />
  52. 52. Data Driven Symbols<br />
  53. 53. Now the Really Cool Part…<br />Every aspect of a Simple Symbol Definition whether standalone or as part of a Compound Symbol Definition can be driven by FDO expressions.<br /><ul><li>Symbol Definitions advertize this via the Parameter Definition element.
  54. 54. Symbol Instances in the Layer Definition supply values for parameters via the Parameter Overrides element.</li></li></ul><li>Parameter Definition<br />
  55. 55. Parameter Definition<br />
  56. 56. Parameter Definition Example<br /><ParameterDefinition><br /> <Parameter><br /> <Identifier>MY_PARAMETER</Identifier><br /> <DefaultValue>0</DefaultValue><br /> <DisplayName>Some Parameter</DisplayName><br /> <Description>More useless stuff here.</Description><br /> <DataType>Integer</DataType><br /> </Parameter><br /></ParameterDefinition><br /><ul><li>Replace constant element value(s) in your symbol with %MY_PARAMETER%. </li></li></ul><li>Parameter Overrides<br />
  57. 57. Parameter Overrides<br />
  58. 58. Parameter Overrides Example<br /><ParameterOverrides><br /> <Override><br /> <SymbolName>MySymbol</SymbolName><br /> <ParameterIdentifier><br />MY_PARAMETER<br /> </ParameterIdentifier><br /> <ParameterValue>“MY_VALUE_FIELD"</ParameterValue><br /> </Override><br /></ParameterOverrides><br />Any FDO Expression!!!<br />
  59. 59. Lab Exercise #4Replace the ‘#’ in the Shield with the Route Number<br />Navigate to C:MapsWithStyleLab4<br />Review the Parameter Definition of the Shield symbol provided in Freeway.SymbolDefinition.xml<br />Specify the Parameter Identifier: ROUTE_NUMBER.<br />Replace the constant ‘#’ with the Parameter Identifier: %ROUTE_NUMBER%.<br />Review the Parameter Overrides elements provided in Roads.LayerDefinition.xml<br />Set the Parameter Identifier elements to: ROUTE_NUMBER.<br />In the Lab4 directory run “loadall.bat”<br />
  60. 60. Q & A<br /><br />