add feature to map in OpenLayers3

المشرف العام

Administrator
طاقم الإدارة
I want to add a point to a map but can't seem to do it.

I have this function to create a point:

INPUT:[208, "POINT(-72.7072715090951 41.5953903556503)]"function make_point(input){ var format = new ol.format.WKT(); var point = format.readFeature(input[1], { "dataProjection": new ol.proj.Projection("EPSG:4326") }); point.id=input[0]; return point;}OUTPUT:pn {na: false, va: undefined, yb: Fc, Od: pn, gb: null…} G: Object geometry: E A: Array[2] 0: -72.7072715090951 1: 41.5953903556503Then I add this point to a layer like this:

function make_point_vector_layer(point){ var point_feature = new ol.Feature({ geometry: point, name: 'Point' }); } var point_vector = new ol.layer.Vector({ map : map, source: new ol.source.Vector({ features: [point_feature] }) }); return point_vector;}But I get this error:

Uncaught TypeError: n.J is not a functionDoes anyone know what the problem is?

P.S. This happens after the map has been draw. Like, it's happening after an ajax call.

Thanks in advance for your kind help.



أكثر...
 
أعلى