<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.6002.18255" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=Arial size=2>Toni,</FONT></DIV>
<DIV><FONT face=Arial size=2>I am assuming you are using an
OpenLayers.Layer.Vector layer with an HTTP protocol.</FONT></DIV>
<DIV><FONT face=Arial size=2>You need to add a listener for
'beforefeaturesadded' event on the layer.</FONT></DIV>
<DIV><FONT face=Arial size=2>The original JSON should be cached in the event
object as well as the parsed features.</FONT></DIV>
<DIV><FONT face=Arial size=2>You want to apply the layer configuration metadata
properities to the layer in the 'beforefeaturesadded' event
handler.</FONT></DIV>
<DIV><FONT face=Arial size=2>be sure to use 'beforefeaturesadded' with the
plural featureS rather than the 'beforefeatureadded' event with the singular
feature</FONT></DIV>
<DIV><FONT face=Arial size=2>The plural features event runs once before any
features are added from each response, while the singular feature runs
before each individual feature is added and the original JSON response will NOT
be available. Also that is not a good place/time to be changing layer properties
anyway.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Matt Priour</FONT></DIV>
<DIV><FONT face=Arial size=2>Kestrel Computer Consulting</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>IN REPLY TO:</FONT></DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial
size=2>------------------------------------------------------------------------------------</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2><FONT face="Times New Roman" size=3>Date: Tue, 20
Jul 2010 17:31:14 +0200<BR>From: toni hern?ndez <</FONT><A
href="mailto:tonidelacalle@gmail.com"><FONT face="Times New Roman"
size=3>tonidelacalle@gmail.com</FONT></A><FONT face="Times New Roman"
size=3>><BR>Subject: [OpenLayers-Dev] Metadata inside a
JSON</FONT><BR></DIV></FONT>
<DIV>hi all,<BR><BR>I have a map with lots of layers. Each layer has its own
style. The map<BR>application gets each layer from a web-service that some else
has developed<BR>and can not be modified (I guess).<BR><BR>I thouht I could put
any kind of data in a json file, so I tried this:<BR><BR>{<BR>"type":
"FeatureCollection",<BR>"name": "Mapa de la
Internacionalitat",<BR>"minScale":"whatever",<BR>"maxScale":"whatever",<BR><BR>//and
then features and its properties?<BR>"features": [<BR>...<BR>]<BR>}<BR><BR>Now I
have realized that atributes "name", "minScale" and "maxScale" are
not<BR>available from the layer object. I can only get the features
properties.<BR><BR>Is it possible to read first the data of the layer, then
create the layer<BR>and finally add the features?<BR>How could / should I do
that?<BR><BR>Thanks in advance.</DIV></BODY></HTML>