[OpenLayers-Users] How to build GML geometry

Lehtonen, Mika mika at digikartta.net
Thu Sep 11 08:16:08 EDT 2008


Yep,

that was the case, I had a geometry and tried to build GML out of it 
without creating the feature first. Silly me. Now it's working.

Thanks,
mika
>
> 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