Based on this link example, I am trying to use Point feature but I get :

my.js:10 Uncaught TypeError: ol.source.Point is not a constructor

   var iconFeature = new ol.Feature({
        geometry: new ol.source.Point([35.1495, 33.39243]),
        name: 'A point',
        population: 4000,
        rainfall: 500
  • 1
    It should be new ol.geom.Point
    – Mike
    Dec 10, 2019 at 10:34
  • @Mike i actually want to place multiple points. Latitude and Longitude are coming from the server as json format via ajax.
    – Andd
    Dec 10, 2019 at 12:35
  • How this example placed the point?
    – Andd
    Dec 10, 2019 at 13:00
  • Solution to your question has been given in the first comment. If you have additional question(s), put it/them in separate question(s).
    – TomazicM
    Dec 10, 2019 at 18:26
  • This question continues here gis.stackexchange.com/questions/344656/…
    – Andd
    Dec 11, 2019 at 9:34

1 Answer 1


If you look at an earlier version which uses full build syntax you can see it is new ol.geom.Point https://openlayers.org/en/v4.6.5/examples/icon.html

If you have geojson data OpenLayers can load and parse it directly from the url

var vectorLayer = new ol.layer.Vector({
  source: new ol.source.Vector({
    url: 'your json url',
    format: new ol.format.GeoJSON()
  style: .... 

or if you have loaded the json yourself you can parse it into a features array, the geometry and any properties specified in a valid geojson will be included

var features = new ol.format.GeoJSON().readFeatures(your_json_data, {dataProjection: 'EPSG:4326', featureProjection: map.getView().getProjection());

Note that if your map view is not LonLat (e.g. it is web mercator) and you use readFeatures you must transform the coordinates to display the features in their correct location.

If your json is simply an array you must loop through to create each feature and add it to the source. You may also need to transform the geometry projection to view it.

   var iconFeature = new ol.Feature({
        geometry: new ol.geom.Point([lon, lat]).transform('EPSG:4326', viewProjection),
        name: name

If you have an array in the form [[lon, lat]. [lon, lat], [lon, lat], .... , [lon, lat]] you could create a single MultiPoint feature

   var feature = new ol.Feature({
        geometry: new ol.geom.MultiPoint(array).transform('EPSG:4326', viewProjection)

Not the answer you're looking for? Browse other questions tagged or ask your own question.