<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
You have to actually load the GeoJSON features into the layer.<br>
<br>
First, look at the following examples:<br>
<br>
<a class="moz-txt-link-freetext" href="http://openlayers.org/dev/examples/geojson-reprojected.html">http://openlayers.org/dev/examples/geojson-reprojected.html</a><br>
<a class="moz-txt-link-freetext" href="http://openlayers.org/dev/examples/cartodb-geojson.html">http://openlayers.org/dev/examples/cartodb-geojson.html</a><br>
<br>
They both use a Fixed strategy which is the best one if you want to
load your data once and have it in a static file or known URL.<br>
<br>
You would add your style definition to the vector layer definition
they present in these examples and then you would have a layer with
features to be symbolized.<br>
<br>
Matt Priour<br>
Kestrel Computer Consulting<br>
<br>
<br>
<div class="moz-cite-prefix">On 12/12/2012 6:21 AM, Gery . wrote:<br>
</div>
<blockquote cite="mid:DUB117-W120D378749F077985D488CAB04F0@phx.gbl"
type="cite">
<div dir="ltr">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
<div dir="ltr"><font style="font-size: 10pt;" size="2"
color="#366092" face="Arial">Hello,<br>
<br>
I have some features in GeoJSON format I want to display, so
I did this:<br>
<br>
[code]<br>
</font><font style="font-size: 10pt;" size="2" color="#366092"
face="Arial"> var vectorLayer = null;<br>
<br>
var vectorStyle =<br>
{<br>
graphicName: 'square',<br>
strokeColor: '#222',<br>
fillColor: '#222'<br>
};<br>
<br>
var styleDefault = OpenLayers.Util.applyDefaults(<br>
vectorStyle,<br>
OpenLayers.Feature.Vector.style['default']<br>
);<br>
<br>
vectorLayer = new OpenLayers.Layer.Vector('search',<br>
{<br>
styleMap: new OpenLayers.StyleMap(<br>
{<br>
'default': styleDefault<br>
}<br>
),<br>
displayInLayerSwitcher: true<br>
}<br>
);<br>
</font><font style="font-size: 10pt;" size="2" color="#366092"
face="Arial">[/code]<br>
<br>
but they don't appear in the map, my question is if this is
enough to get the features displayed or do I need something
else there? if this is enough, I should think that this
problem is about how the features are being read by OL. In
fact, this doesn't work either:<br>
<br>
var ll = new OpenLayers.LonLat(feature.geometry.x,
feature.geometry.y);<br>
mapPanel.map.setCenter(ll);<br>
<br>
I get: <br>
<br>
</font>
<div role="listitem" class="errorTitle focusRow subLogRow "><span
class="errorMessage ">feature is not defined</span></div>
<span class=" "></span>
<table class=" " cellpadding="0" cellspacing="0">
<tbody class=" ">
<tr class=" ">
<td class=" "><img moz-do-not-send="true"
src="chrome://firebug/content/blank.gif"
role="checkbox" title="Break On This Error"
class="errorBreak a11yFocus "></td>
<td class=" "><a moz-do-not-send="true"
class="errorSource a11yFocus ">
<pre title="ll = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y);" class="errorSourceCode ">var ll = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y);</pre>
</a></td>
</tr>
</tbody>
</table>
<font style="font-size: 10pt;" size="2" color="#366092"
face="Arial"><br>
why should this happen? thanks in advance</font><br
id="ecxFontBreak">
<br>
<br>
<font style="font-size:10pt" size="2" color="#1F497D"
face="Arial"><br>
__________________________________________________________________________________________<br>
Piensa en el medio ambie<font style="" face="Arial">nte -
mantenlo en la pantalla. NO lo imprimas si NO es
necesario.</font></font><font style="font-size:10pt"
size="2" color="#1F497D" face="Arial"><br>
</font><font style="font-size:10pt" size="2" color="#1F497D"
face="Arial">Think green - keep it on the screen. Do NOT
print if it is NOT necessary.</font><font
style="font-size:10pt" size="2" color="#1F497D" face="Arial"><br>
</font><font style="font-size:10pt" size="2" color="#1F497D"
face="Arial"><span id="ecxresult_box" class="ecxshort_text"
lang="de"><span class="ecxhps">Denken Sie an</span> <span
class="ecxhps">die Umwelt</span></span></font><font
style="font-size:10pt" size="2" color="#1F497D" face="Arial"><span
id="ecxresult_box" lang="de"><span class="ecxhps"></span> <span
class="ecxhps">-</span> <span class="ecxhps">bewahren
Sie es</span> <span class="ecxhps">auf dem Bildschirm.</span>
<span class="ecxhps">Drucken Sie NICHT</span><span>, wenn</span>
<span class="ecxhps">es NICHT notwendig ist</span><span>.</span></span></font><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
</blockquote>
<br>
</body>
</html>