4

我不知道如何WKT在 OpenLayers 中使用该格式。

我试过在文档中找到解决方案,女巫基本上把我带到了这个:http: //jsfiddle.net/Christer/WG8YP/2/

但这给了我以下错误:

Uncaught SyntaxError: Unexpected number

我不知道hazzle是关于什么的,因为数字和所有内容都是直接从openlayers自己的边界/点/地理复制出来的。

4

1 回答 1

8

试试这个

http://jsfiddle.net/WG8YP/4/

addFeatures需要一系列特征

代码:

var polygonFeature = wkt.read("POLYGON((-15.8203125 2.4609375, -15.8203125 -10.546875, 6.85546875 -11.25, 8.26171875 -3.33984375, -15.8203125 2.4609375))");
polygonFeature.geometry.transform(map.displayProjection, map.getProjectionObject());         
vectors.addFeatures([polygonFeature]);
于 2012-08-14T14:56:12.817 回答