[OpenLayers-Users] Get feature name from GML

Andreas Hocevar ahocevar at opengeo.org
Mon Jul 6 03:45:11 EDT 2009


Hi,

On Mon, Jul 6, 2009 at 8:11 AM, Anthony Masinton<amasinton at gmail.com> wrote:
> I'm a new user of OL and would like some help with getting feature
> names from GML.
>
> I have a layer based on a GML file with several polygons in it.
> Using the select-feature-openpopup example I am able to highlight
> each polygon and display a popup which gives the feature's ID
> (feature.id) and its area - as shown in the example.
>
> What I would like to display in the popup instead is the name of the
> feature from the GML file's gml:name tag for the selected feature.

I have not tried this, but looking at the GML format code it seems
that using feature.attributes.name instead of feature.id in the
example should do the trick.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list