<!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> </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: </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>{<BR> "type":
"FeatureCollection",<BR> "features":
[<BR>
{<BR> "type":
"Feature",<BR>
"properties":
{<BR>
"_id"
:<BR>
{<BR>
"code" :
"123",<BR>
"version" :
0<BR>
},<BR>
"Status" :
"W"<BR>
},<BR>
"geometry":
{<BR>
"type":
"Point",<BR>
"coordinates":
[<BR>
-86.586502,<BR>
34.731189<BR>
]<BR>
}<BR>
},<BR>
{<BR> "type":
"Feature",<BR> </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> </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> </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> </DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN
class=625034817-18012012> </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> 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> var styleMap = new OpenLayers.StyleMap({</DIV>
<DIV> "default": new
OpenLayers.Style({</DIV>
<DIV> fillOpacity:
0.5,</DIV>
<DIV> pointRadius:
5,</DIV>
<DIV> fillColor:
"#ee9900"</DIV>
<DIV> })</DIV>
<DIV> });</DIV>
<DIV> </DIV>
<DIV> var lookup = {</DIV>
<DIV> "S": {fillColor: "red"},</DIV>
<DIV> "A": {fillColor: "green"},</DIV>
<DIV> "X": {fillColor: "blue"}</DIV>
<DIV> };</DIV>
<DIV><BR></DIV>
<DIV> styleMap.addUniqueValueRules("default",
"Status", lookup);</DIV></DIV>
<DIV><BR></DIV>
<DIV>However, when I apply the addUniqueValueRules, no features are drawn.
Tracing through the draw cycle,</DIV>
<DIV>line 117 of Comparison.js which is getting the value of "Status" from the
context returns undefined. What do I need to do to get the "Status" into
the correct context? </DIV>
<DIV><BR></DIV>
<DIV>Thanks,</DIV>
<DIV><BR></DIV>
<DIV>John</DIV></BODY></HTML>