[OpenLayers-Users] Pop-up and GML/KML/ ... layers

Eric Lemoine eric.c2c at gmail.com
Wed Feb 6 12:19:04 EST 2008


Hi Yves. Once your gml is properly formatted and you see features on
your map, you should be able to use the SelectFeature control to
select features and display a popup on feature selection. See the
example Pierre pointed out. I also confirm that you should be able to
retrieve the feature info in feature.attributes. If that doesn't work
show us some code :)

2008/2/6, Jacolin Yves <yjacolin at free.fr>:
> Hi Jean,
>
> You are right, the GML was not good, it was created with shp2gml :/ I will
> try
> to create it with ogr2ogr :)
>
> Anyway, I find a new feature in firebug: the DOM inspector, thanks.
>
> Y.
> Le Wednesday 06 February 2008 16:55:53 Jean Pommier (IGE), vous avez écrit :
> > Mmmh, are you sure of the syntax of your GML. What did you use to generate
> > it ?
> > I'm not so used to GML, but it looks quite weird : elmProperty is REALLY a
> > conform gml tag ??
> > Mine (ogr2ogr generated GML, then i changed a few minor things) looks like
> > this :
> >     <gml:featureMember>
> >         <ogr:allcircuits fid="ID1">
> >             <ogr:geometryProperty>
> >                 <gml:LineString>
> >                     <gml:coordinates>9.468016813294355,24.571030547444423
> > 6.003057388645857,23.697212985408044 6.002689662946409,23.696395817186783
> > 6.00264880453534,23.695742082609684 6.00264880453534,23.694965772799492
> > </gml:coordinates>
> >                 </gml:LineString>
> >             </ogr:geometryProperty>
> >             <ogr:Id>1</ogr:Id>
> >             <ogr:tId>DJ-TA-1</ogr:tId>
> >             <ogr:itineraire><![CDATA[circuit2]]></ogr:itineraire>
> >             <ogr:categorie><![CDATA[Grandes traversées]]></ogr:categorie>
> >              <ogr:url><![CDATA[mon url]]></ogr:url>
> >             <ogr:duree>8</ogr:duree>
> >             <ogr:mode>1</ogr:mode>
> >         </ogr:allcircuits>
> >     </gml:featureMember>
> >
> > You could also use firebug to explore your javascript objects : maybe
> > you'll find the right path...
> >
> > 2008/2/6, Jacolin Yves <yjacolin at free.fr>:
> > > Thanks for this tips. Here is a snapshoot of my GML:
> > >   <gml:featureMember>
> > >     <gml:elmProperty>
> > >       <gml:Property name="CODEFICHE">001</gml:Property>
> > >       <gml:Property name="LIBFICHE">001-Lyon 1 Nord</gml:Property>
> > >       <gml:Property name="MONOFICHE">002</gml:Property>
> > >       <gml:Property name="FICHE">001</gml:Property>
> > >       <gml:Property name="CODEFICHEF">1</gml:Property>
> > >     </gml:elmProperty>
> > >     <gml:Point>
> > >
> > > <gml:coordinates>537171.089628033,5743668.39683698</gml:coordinates>
> > > </gml:Point>
> > >   </gml:featureMember>
> > >
> > > I tried feature.attributes.CODEFICHE, but undefined is displayed.
> > >
> > > Any idea? Thank :)
> > >
> > > Y.
> > > Le Wednesday 06 February 2008 15:02:55 Jean Pommier (IGE), vous avez
> > > écrit
> > >
> > > > Hi Yves,
> > > > Yes, you can. The syntax is feature.attributes.<fieldName>, you'll get
> > >
> > > the
> > >
> > > > field value for the current feature
> > > > Is it OK ?
> > > > If you need an example, i have one not so far...
> > > > Jean
> > > >
> > > > 2008/2/6, Jacolin Yves <yjacolin at free.fr>:
> > > > > Hi Pierre,
> > > > >
> > > > > Following this example, I have to parse my GML to find the data
> > >
> > > somewhere
> > >
> > > > > I
> > > > > want to show on my tooltips. Is it the "normal" way? Is it possible
> > > > > to get it
> > > > > with  something like "feature.data.<fieldName>" to display it in the
> > > > > pop-up ?
> > > > >
> > > > > Am I clear? I hope so :)
> > > > >
> > > > > Y.
> > > > >
> > > > > Le Wednesday 06 February 2008 14:02:48 Pierre GIRAUD, vous avez
> écrit
> > > > >
> > > > > > Are you drawing features in a Vector-type layer ?
> > > > > > If so, is this example usefull ?
> > > > > > http://openlayers.org/dev/examples/select-feature-openpopup.html
> > > > > >
> > > > > > Regards,
> > > > > > Pierre
> > > > > >
> > > > > > On Feb 6, 2008 1:02 PM, Jacolin Yves <yjacolin at free.fr> wrote:
> > > > > > > Hi list,
> > > > > > >
> > > > > > > I would like to test the pop-up feature in openlayers. If I add
> a
> > > > > > > GML, KML or some other type of layer. How can I easily retrieve
> > >
> > > data
> > >
> > > > > > > from
> > > > >
> > > > > the
> > > > >
> > > > > > > GML, KML, after clicking on the map ?
> > > > > > >
> > > > > > > Do I need to retrieve the latLong from the click event, then
> > > > > > > parse the GML, and then build the content of the pop-up? Or can
> I
> > >
> > > retrieve
> > >
> > > > > > > data from the GML layer loaded in OL? An another method?
> > > > > > >
> > > > > > > Could you provide some easy exemple for this?
> > > > > > >
> > > > > > > Sorry if my question seems obvious. I am new in Javascript OO :)
> > > > > > >
> > > > > > > Regards,
> > > > > > >
> > > > > > > Y.
> > > > > > > --
> > > > > > > Yves Jacolin
> > > > > > > ---
> > > > > > > http://softlibre.gloobe.org
> > > > > > > _______________________________________________
> > > > > > > Users mailing list
> > > > > > > Users at openlayers.org
> > > > > > > http://openlayers.org/mailman/listinfo/users
> > > > >
> > > > > --
> > > > > Yves Jacolin
> > > > > ---
> > > > > http://softlibre.gloobe.org
> > > > > _______________________________________________
> > > > > Users mailing list
> > > > > Users at openlayers.org
> > > > > http://openlayers.org/mailman/listinfo/users
> > >
> > > --
> > > Yves Jacolin
> > > ---
> > > http://softlibre.gloobe.org
> > > _______________________________________________
> > > Users mailing list
> > > Users at openlayers.org
> > > http://openlayers.org/mailman/listinfo/users
>
>
>
> --
> Yves Jacolin
> ---
> http://softlibre.gloobe.org
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>


More information about the Users mailing list