<!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.18928"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=796424313-27062010>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=796424313-27062010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=796424313-27062010>something like this should work:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=796424313-27062010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>var features = new
OpenLayers.Format.GML().read(response);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial>if(features)<BR>{<BR> if(features.constructor !=
Array)<BR> features =
[features];</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
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 class=796424313-27062010><FONT color=#0000ff
size=2 face=Arial>Arnd</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> users-bounces@openlayers.org
[mailto:users-bounces@openlayers.org] <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> users@openlayers.org<BR><B>Betreff:</B> Re:
[OpenLayers-Users] parsing a GML file into different layers<BR></FONT><BR></DIV>
<DIV></DIV>Hi Eric,<BR><BR>thanks for your reply. I probably need to use
OpenLayers.<SPAN class=HB> </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: rgb(204,204,204) 1px solid; 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></BODY></HTML>