Hi,
 
instead write you take read:
 
var geometry_collection = new OpenLayers.Geometry.MultiPoint();
 
var fts=map.layers[1].features;
for(var i=0;i<fts.length;i++)
    geometry_collection.addPoint(fts[i].geometry);
 
var parser       = new OpenLayers.Format.GML();
 
var feature      = new OpenLayers.Feature.Vector();
feature.geometry = geometry_collection;
 
//features 2 gml
var gml = parser.write(feature);
 
alert(gml);
 
//gml 2 feature array
var ftArr = parser.read(gml);
 
alert(ftArr.length);
alert(ftArr[0].geometry);
map.layers[2].addFeatures(ftArr);

Arnd

 
  _____  

Von: Lucas Heezen - Covadis [mailto:[email protected]] 
Gesendet: Donnerstag, 1. März 2012 20:00
An: Arnd Wippermann
Cc: [email protected]
Betreff: RE: [OpenLayers-Users] GeometryCollection to GML


Is it also possible to do a reverse of that? 

I have this GML string:

<gml:MultiPoint
srsName="http://www.opengis.net/gml/srs/epsg.xml#28992";><gml:pointMember><gm
l:Point><gml:coordinates xmlns:gml="http://www.opengis.net/gml"; decimal="."
cs="," ts="
">203236.64977406,464492.34165434</gml:coordinates></gml:Point></gml:pointMe
mber><gml:pointMember><gml:Point><gml:coordinates
xmlns:gml="http://www.opengis.net/gml"; decimal="." cs="," ts="
">220559.86535174,404337.17345485</gml:coordinates></gml:Point></gml:pointMe
mber><gml:pointMember><gml:Point><gml:coordinates
xmlns:gml="http://www.opengis.net/gml"; decimal="." cs="," ts="
">306760.47770758,372675.14445673</gml:coordinates></gml:Point></gml:pointMe
mber><gml:pointMember><gml:Point><gml:coordinates
xmlns:gml="http://www.opengis.net/gml"; decimal="." cs="," ts="
">373076.72169331,469050.83303507</gml:coordinates></gml:Point></gml:pointMe
mber></gml:MultiPoint>

And i want i to convert to a Openlayers.Geometry.MultiPoint object...

Greetz, 
Lucas

  _____  

Van: Arnd Wippermann [[email protected]]
Verzonden: donderdag 1 maart 2012 18:37
Aan: Lucas Heezen - Covadis
CC: [email protected]
Onderwerp: AW: [OpenLayers-Users] GeometryCollection to GML


Hi, 
 
create a feature from your geometry and save that.
 
var geometry_collection = new OpenLayers.Geometry.MultiPoint();
 
var fts=vectorLayer.features;
for(var i=0;i<fts.length;i++)
    geometry_collection.addPoint(fts[i].geometry);
 
var writer       = new OpenLayers.Format.GML();
var feature      = new OpenLayers.Feature.Vector();
feature.geometry = geometry_collection;
 
var gml = writer.write(feature);
 
alert(gml);
 
Arnd



  _____  

Von: [email protected]
[mailto:[email protected]] Im Auftrag von Lucas
Heezen - Covadis
Gesendet: Donnerstag, 1. März 2012 09:33
An: openlayers list
Betreff: [OpenLayers-Users] GeometryCollection to GML



Hello, 

 

Is it possible to convert a geometry.collection (multipoint) to gml?

 

This is what I have so far:

 

var geometry_collection = new OpenLayers.Geometry.MultiPoint();

vectorLayer.features.each(function(ff, index) {

geometry_collection.addPoint(ff.geometry);

});

                        

var writer = new OpenLayers.Format.GML();

var gml = writer.buildGeometry.multipoint(geometry_collection);

alert(gml);

 

But is get the following error:  this.createElementNS is not a function

 


Met vriendelijke groet,
Lucas Heezen


Beschrijving: http://www.covadis.nl/emailkop/logo.gif

Covadis b.v. 

t: 026 3616600 


Geograaf 12 

f: 026 3612317 


6921 EW Duiven 

e:  <mailto:[email protected]> [email protected]

 

<<image001.gif>>

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to