[OpenLayers-Users] Format.WKT.write method
Simon Cantem
simon at citysafe.org
Wed May 16 07:02:28 EDT 2007
I've been playing with the Format.WKT class recently and just have a
query with the write method. I'm using it to convert the vector elements
to WKT so that I can then post the form and easily save it into
PostgreSQL (with PostGIS). I've noticed that unlike the other Format
classes, it expects a either a geometry object or an array of geometry
objects, the other Format classes (eg Format.GML and Format.WFS) expect
a features array. The disadvantage of this is that you can't just pass
it the features property of the vector layer, and quickly convert it to
WKT. I've made a change to my copy of /Format/WKT.js starting at line
67:
if(isCollection) {
if (i>0) {
pieces.push(',');
}
geometry = collection[i].geometry;
} else {
geometry = collection[i];
}
The check for "isCollection" is so that the WKT example still works.
Is this a valid change or have I missed an easier way of doing this
conversion?
Thanks,
Simon
------------------------------------------------------------------------
------------------------
Simon Cantem
System Administrator / Analyst Programmer
CitySafe - www.citysafe.org <http://www.citysafe.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlayers.org/pipermail/users/attachments/20070516/664d0c06/attachment.htm
More information about the Users
mailing list