<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:st="&#1;" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin-top:6.0pt;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-top:6.0pt;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-AU link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>Hi all,<o:p></o:p></p>

<p class=MsoNormal>I am working on a new mapping interface using OL2.8 and have
spent hours on StyleMaps. I am not sure if I am doing things right so thought I
would ask the group. My StyleMap code is as follows:<o:p></o:p></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp; <span
style='color:blue'>var</span> styleMap = <span style='color:blue'>new</span>
OpenLayers.StyleMap({<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#A31515'>&quot;default&quot;</span>: <span style='color:
blue'>new</span> OpenLayers.Style({ pointRadius: <span style='color:#A31515'>&quot;${scaledSize}&quot;</span>,
graphicYOffset: <span style='color:#A31515'>&quot;-${scaledDSize}&quot;</span>,<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
strokeColor: <span style='color:#A31515'>&quot;${colorStroke}&quot;</span>,
strokeWidth: <span style='color:#A31515'>&quot;${scaledStroke}&quot;</span>,
strokeDashstyle: <span style='color:#A31515'>&quot;solid&quot;</span>,
strokeOpacity: .75,<o:p></o:p></span></p>

<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:
0cm;margin-left:36.0pt;margin-bottom:.0001pt;text-indent:36.0pt;text-autospace:
none'><span style='font-size:10.0pt;font-family:"Courier New"'>graphicZIndex:
11,<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
externalGraphic: <span style='color:#A31515'>'//www.exploroz.com/Utilities/Scripts/Openlayers/img/marker-blue.png'</span>,
label: <span style='color:#A31515'>&quot;${getTitle}&quot;</span>,<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
labelAlign: <span style='color:#A31515'>&quot;lb&quot;</span>, fontColor: <span
style='color:#A31515'>'#808080'</span>, fontSize: <span style='color:#A31515'>'${scaledSize}px'</span>,
fontFamily: <span style='color:#A31515'>'arial'</span>,<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
fillColor: <span style='color:#A31515'>&quot;#a0a0a0&quot;</span>, fillOpacity:
<span style='color:#A31515'>'${opacityFill}'<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}, { context: {<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
getTitle: <span style='color:blue'>function</span>(feature) { <span
style='color:blue'>if</span> (feature.geometry.CLASS_NAME == <span
style='color:#A31515'>&quot;OpenLayers.Geometry.Point&quot;</span> &amp;&amp; <o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thisMap.Map.getZoom()
&gt; 4) <span style='color:blue'>return</span> <span style='color:#A31515'>'&nbsp;&nbsp;
'</span> + feature.attributes.title + <span style='color:#A31515'>'&nbsp;&nbsp;
'</span>; <span style='color:blue'>else</span> <span style='color:blue'>return</span>
<span style='color:#A31515'>''</span>; },<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
colorStroke: <span style='color:blue'>function</span>(feature) { <span
style='color:blue'>if</span> (feature.geometry.CLASS_NAME == <span
style='color:#A31515'>&quot;OpenLayers.Geometry.Polygon&quot;</span>) <span
style='color:blue'>return</span> <o:p></o:p></span></p>

<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:
0cm;margin-left:72.0pt;margin-bottom:.0001pt;text-indent:36.0pt;text-autospace:
none'><span style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>'#a0a0a0'</span><span
style='font-size:10.0pt;font-family:"Courier New"'>; <span style='color:blue'>else</span>
<span style='color:blue'>return</span> <span style='color:#A31515'>'#4F53FF'</span>;
},<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
opacityFill: <span style='color:blue'>function</span>(feature) { <span
style='color:blue'>if</span> (feature.geometry.CLASS_NAME == <span
style='color:#A31515'>&quot;OpenLayers.Geometry.Polygon&quot;</span>) <span
style='color:blue'>return</span> <o:p></o:p></span></p>

<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:
0cm;margin-left:72.0pt;margin-bottom:.0001pt;text-indent:36.0pt;text-autospace:
none'><span style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>'0.4'</span><span
style='font-size:10.0pt;font-family:"Courier New"'>; <span style='color:blue'>else</span>
<span style='color:blue'>return</span> <span style='color:#A31515'>'1'</span>;
},<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
scaledSize: <span style='color:blue'>function</span>(feature) { val = feature.layer.map.getZoom()
* 1.5; val &gt; 4 ? <span style='color:blue'>null</span> : val = 4; <span
style='color:blue'>return</span> val; },<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
scaledDSize: <span style='color:blue'>function</span>(feature) { val =
feature.layer.map.getZoom() * 3; val &gt; 8 ? <span style='color:blue'>null</span>
: val = 8; <span style='color:blue'>return</span> val; },<o:p></o:p></span></p>

<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:
0cm;margin-left:72.0pt;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>scaledStroke: <span
style='color:blue'>function</span>(feature) { val =
feature.layer.map.getZoom(); val &lt; 2 ? val = 2 : val &lt; 4 ? <span
style='color:blue'>null</span><o:p></o:p></span></p>

<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:
0cm;margin-left:72.0pt;margin-bottom:.0001pt;text-indent:36.0pt;text-autospace:
none'><span style='font-size:10.0pt;font-family:"Courier New"'>: val = 4; <span
style='color:blue'>return</span> val; }<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}),<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#A31515'>&quot;select&quot;</span>: <span style='color:blue'>new</span>
OpenLayers.Style({ strokeColor: <span style='color:#A31515'>&quot;${colorStroke}&quot;</span>,
fillColor: <span style='color:#A31515'>&quot;#ee9900&quot;</span>,
externalGraphic:<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span
style='color:#A31515'>'//www.exploroz.com/Utilities/Scripts/Openlayers/img/marker-green.png'</span>,
fontWeight: <span style='color:#A31515'>'bold'</span>, fontColor: <span
style='color:#A31515'>'black'<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}, { context: {<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
colorStroke: <span style='color:blue'>function</span>(feature) { <span
style='color:blue'>if</span> (feature.geometry.CLASS_NAME == <span
style='color:#A31515'>&quot;OpenLayers.Geometry.Polygon&quot;</span>) <span
style='color:blue'>return</span> <o:p></o:p></span></p>

<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:
0cm;margin-left:36.0pt;margin-bottom:.0001pt;text-indent:36.0pt;text-autospace:
none'><span style='font-size:10.0pt;font-family:"Courier New";color:#A31515'>'#ee9900'</span><span
style='font-size:10.0pt;font-family:"Courier New"'>; <span style='color:blue'>else</span>
<span style='color:blue'>return</span> <span style='color:#A31515'>'#90EE90'</span>;
}<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></p>

<p class=MsoNormal style='margin:0cm;margin-bottom:.0001pt;text-autospace:none'><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
})<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
});<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>Is
there a better way to handle the scaling of objects and specifying how to
handle each type of feature than the above. It works fine but I thought I would
ask to see if there is a more correct way to accomplish this task as I am
wanting to now add a number of different point graphics and this would involve
some additional feature context functions.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>Thanks
in advance.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>David
Martin</span><o:p></o:p></p>

<p class=MsoNormal align=center style='margin:0cm;margin-bottom:.0001pt;
text-align:center'><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>