[OpenLayers-Users] How to build GML geometry

Andreas Hocevar ahocevar at opengeo.org
Thu Sep 11 04:15:36 EDT 2008


Have a look at http://www.openlayers.org/dev/examples/vector-formats.html.

In particular, you will want to do

var gml = new OpenLayers.Format.GML().write(features);

If you have your features on a layer, you can access them by saying
layer.features. If you just have a geometry, you have to create a
feature with that geometry first, e.g.

var feature = new OpenLayers.Feature.Vector(geometry);
var gml = new OpenLayers.Format.GML().write([feature]);

Regards,
Andreas.

On Tue, Sep 9, 2008 at 10:26 PM, Lehtonen, Mika <mika at digikartta.net> wrote:
> Hi,
>
> one more beginners question:
>
> If I have let's say a Point Geometry in OL. How can I serialize or build
> a GML out of it. I tried it in many ways, but didn't succeed.
>
> - mika -
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list