javascript - "Object has no method 'getBounds'" error in OpenLayers -


i'm using code draw point on map:

function addpointtomap(pmap){     var coordinates = new array();      // style point     var style_blue = openlayers.util.extend({}, openlayers.feature.vector.style['default']);     style_blue.strokecolor = "blue";      style_blue.fillcolor = "blue";       // make point     coordinates.push(new openlayers.geometry.point(33, 33));     var pointfeature =  new openlayers.feature.vector(coordinates, null, style_blue);      // layer     var pointslayer = new openlayers.layer.vector("points layer");     pointslayer.addfeatures([pointfeature]);     pmap.addlayer(pointslayer);          } 

i'm getting error console:

uncaught typeerror: object point(33, 33) has no method 'getbounds' 

what doing wrong?

for sake of completeness, received similar error while adding polygon (not point) raw wkt data. error there no bounds occur because object of wrong type.

when call addfeatures, expects array of openlayers.feature.vector objects, created format.read.

var wkt_parser = new openlayers.format.wkt(); var wkt_data_parsed = wkt_parser.read(some_raw_wkt_data_string); layer.addfeatures([wkt_data_parsed]); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -