Hi Arnd,<br><br>thanks for your reply, this seems like it should work. I've been trying it out, but can't get it to work.. What should go in the brackets after 'GML', and where does 'response' come from? Sorry if these are really basic questions, but I don't have much experience in JS or OL... <br>
<br>Thanks again,<br><br>Alex. <br><br><div class="gmail_quote">On Sun, Jun 27, 2010 at 2:44 PM, Arnd Wippermann <span dir="ltr"><<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><font face="Arial" size="2" color="#0000ff"><span>Hi,</span></font></div>
<div dir="ltr" align="left"><font face="Arial" size="2" color="#0000ff"><span></span></font> </div>
<div dir="ltr" align="left"><font face="Arial" size="2" color="#0000ff"><span>something like this should work:</span></font></div>
<div dir="ltr" align="left"><font face="Arial" size="2" color="#0000ff"><span></span></font> </div>
<div dir="ltr" align="left"><font face="Arial" size="2" color="#0000ff">var features = new
OpenLayers.Format.GML().read(response);</font></div>
<div> </div>
<div dir="ltr" align="left"><font face="Arial" size="2" color="#0000ff">if(features)<br>{<br> if(features.constructor !=
Array)<br> features =
[features];</font></div>
<div> </div>
<div dir="ltr" align="left"><font face="Arial" size="2" color="#0000ff">
for(var i=0;i<features.length;i++)<br>
{<br> var ftLyr = new
OpenLayers.Layer.Vector("Feature " +
i);<br>
addLayer(ftLyr);<br>
ftLyr.addFeatures(features[i]);<br> }<br>}<br></font></div>
<div dir="ltr" align="left"><span><font face="Arial" size="2" color="#0000ff">Arnd</font></span></div><br>
<div dir="ltr" lang="de" align="left">
<hr>
<font face="Tahoma" size="2"><b>Von:</b> <a href="mailto:users-bounces@openlayers.org" target="_blank">users-bounces@openlayers.org</a>
[mailto:<a href="mailto:users-bounces@openlayers.org" target="_blank">users-bounces@openlayers.org</a>] <b>Im Auftrag von </b>Alex
Brandsen<br><b>Gesendet:</b> Sonntag, 27. Juni 2010 14:43<br><b>An:</b> Eric
Lemoine<br><b>Cc:</b> <a href="mailto:users@openlayers.org" target="_blank">users@openlayers.org</a><br><b>Betreff:</b> Re:
[OpenLayers-Users] parsing a GML file into different layers<br></font><br></div><div><div></div><div class="h5">
<div></div>Hi Eric,<br><br>thanks for your reply. I probably need to use
OpenLayers.<span> </span>Format.GML.read() , but how do I then split
the array it returns into different layers?<br><br>Thanks,<br><br>Alex.<br><br>
<div class="gmail_quote">On Sat, Jun 26, 2010 at 7:12 AM, Eric Lemoine <span dir="ltr"><<a href="mailto:eric.lemoine@camptocamp.com" target="_blank">eric.lemoine@camptocamp.com</a>></span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<div>
<div></div>
<div>On Friday, June 25, 2010, Alex Brandsen <<a href="mailto:alex.brandsen@gmail.com" target="_blank">alex.brandsen@gmail.com</a>> wrote:<br>> Hi
all,<br>><br>> I'm building a map of a medieval wallpainting, and the
graffiti inscribed in this wall, which can be found on <a href="http://www.thomasav.com/DurhamGraffiti/" target="_blank">www.thomasav.com/DurhamGraffiti/</a> (still quite buggy
though!).<br>> I was wondering if there is a way for OpenLayers to
dynamically turn features from a single GML file into seperate layers, by
providing an array of feature id's. I've been looking through the
documentation and been googling around, but I can't seem to find anything
useful. Perhaps "OpenLayers. Filter. FeatureId" could do something like this,
but the documentation on this is quite sparse..<br>><br>> Ofcourse, I
could just write a php script that would pre-parse the gml into seperate,
temporary gml files, but I think using OpenLayers itself would be
preferable.<br>><br>> If anyone has any ideas, I would be very
grateful!<br><br><br></div></div>Hi<br><br>The protocol or format that you use
will give you an array of<br>features. You are then free to dispatch the
features to separate<br>vector layers, for example based on their
ids.<br><br>I hope it helps,<br><br><br>--<br>Eric Lemoine<br><br>Camptocamp
France SAS<br>Savoie Technolac, BP 352<br>73377 Le Bourget du Lac,
Cedex<br><br>Tel : 00 33 4 79 44 44 96<br>Mail : <a href="mailto:eric.lemoine@camptocamp.com" target="_blank">eric.lemoine@camptocamp.com</a><br><a href="http://www.camptocamp.com" target="_blank">http://www.camptocamp.com</a><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br>