[OpenLayers-Users] KML: Writing and then reading a MultiPoint geometry

Peter R. Guerzenich Small prgsmall at mac.com
Tue Jun 28 12:25:20 EDT 2011


Hi All,

I am writing an app that writes out a kml file (by submitting to a server) and then reads this file back in when the app starts up, to enable a very coarse synchronization across different browser instances.  The problem that I am seeing is that when I write out an OpenLayers.Geometry.Collection, and then read it back in, only the first geometry in the collection gets added to the OpenLayers Feature.  I am using OpenLayers 2.10.

The code that I am using is:

        kmlReader = new OpenLayers.Format.KML({kmlns: "http://www.opengis.net/kml/2.2"}),
        features = kmlReader.read(data);

where data is the text of the kml that was just fetched via ajax.

The kml looks like:

<MultiGeometry>
	<Point><coordinates>-...</coordinates></Point>
	<LinearRing><coordinates>...</coordinates></LinearRing>
	<LinearRing><coordinates>-...</coordinates></LinearRing>
</MultiGeometry>

(coordinates removed for brevity).

Is there a option that I should be setting for this to read in correctly?

Thanks,

Peter


More information about the Users mailing list