<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19170"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=625034817-18012012><FONT color=#0000ff 
size=2 face=Arial>it's nothing wrong with your code. But your GeoJSON object 
describes a MultiPoint instead of three single points. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=625034817-18012012><FONT color=#0000ff 
size=2 face=Arial>And the properties should not attached to the 
geometry.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=625034817-18012012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 face=Arial>Try something 
like this to create single points:&nbsp;</FONT></SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 
face=Arial>{<BR>&nbsp;&nbsp;&nbsp; "type": 
"FeatureCollection",<BR>&nbsp;&nbsp;&nbsp; "features": 
[<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": 
"Feature",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"properties": 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"_id" 
:<BR>&nbsp;&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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
34.731189<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": 
"Feature",<BR>&nbsp;</FONT></SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 
face=Arial>...</FONT></SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 face=Arial>by the way 
Status="W" is not declared in your styleMap.</FONT></SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 
face=Arial>Arnd</FONT></SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=625034817-18012012>&nbsp;</SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><FONT size=2 
face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org 
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>John 
Cole<BR><B>Gesendet:</B> Mittwoch, 18. Januar 2012 17:36<BR><B>An:</B> 
openlayers-users@lists.osgeo.org<BR><B>Betreff:</B> [OpenLayers-Users] Styling a 
GeoJson vector layer with a stylemapby value<BR></FONT><BR></DIV>
<DIV></DIV>Hey guys,
<DIV>&nbsp; I'm trying to use a stylemap on a GeoJson datasource, and want to 
change the color of the symbol based off of a field in the data.</DIV>
<DIV><BR></DIV>
<DIV>My data looks like:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>{</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"type" : 
"GeometryCollection",</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"geometries" : 
[{</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"type" : 
"Point",</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"_id" : {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"code" : 
"123",</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"version" : 
0</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>},</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"coordinates" : 
[-86.586502, 34.731189],</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"Status" : 
"W"</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}, {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"type" : 
"Point",</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"_id" : {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"code" : 
"234",</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"version" : 
0</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>},</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"coordinates" : 
[-86.57294326, 34.73563314],</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"Status" : 
"W"</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}, {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"type" : 
"Point",</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"_id" : {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"code" : 
"456",</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"version" : 
0</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>},</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"coordinates" : 
[-86.45717254, 34.82754903],</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>"Status" : 
"A"</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>]</DIV>
<DIV>}</DIV></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>and my style stylemap:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; var styleMap = new OpenLayers.StyleMap({</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "default": new 
OpenLayers.Style({</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fillOpacity: 
0.5,</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pointRadius: 
5,</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fillColor: 
"#ee9900"</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; });</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; var lookup = {</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "S": {fillColor: "red"},</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "A": {fillColor: "green"},</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "X": {fillColor: "blue"}</DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; };</DIV>
<DIV><BR></DIV>
<DIV>&nbsp; &nbsp; &nbsp; &nbsp; styleMap.addUniqueValueRules("default", 
"Status", lookup);</DIV></DIV>
<DIV><BR></DIV>
<DIV>However, when I apply the addUniqueValueRules, no features are drawn. 
&nbsp;Tracing through the draw cycle,</DIV>
<DIV>line 117 of Comparison.js which is getting the value of "Status" from the 
context returns undefined. &nbsp;What do I need to do to get the "Status" into 
the correct context? &nbsp;</DIV>
<DIV><BR></DIV>
<DIV>Thanks,</DIV>
<DIV><BR></DIV>
<DIV>John</DIV></BODY></HTML>