Search code examples
openlayers

JSTS: wkt.replace is not a function error


I am setting a polygon to a veriable after that I am using this

var a = reader.read('b');

If I am using this

var input = reader.read ('POLYGON((4528808.754015567,-13568218.807617325 4528738.470266289,-13568105.086122138 4528701.519912617,-13567985.512265863 4528701.519912617));

No error occurred.


Solution

  • After so much search I found that you have to convert it into string first Like this

    var strGeom = new OpenLayers.Format.WKT(a);

    var parseGeo = reader.read(strGeom.toString());