javascript - How to add markers to OPENLAYERS map with JSON coordinates? -


i trying zoom , add markers html openlayers map, far hardcoded lat , long pulled json result. in first place drop marker @ location , using lat , lng create function avoid harcoding , being able drop marker json entry.

here code far, location zoomed location cant find how drop marker? thanks!

 var map = new ol.map({   layers: [    new ol.layer.tile({    source: new ol.source.osm()})   ],   view: new ol.view({    center: ol.proj.fromlonlat([103.835471, 1.303371]),    zoom: 6   }),  target: 'map' }); 

here basic steps want follow:

make sure transform coordinates geometry if lat/lon.

the following may helpful:

http://openlayers.org/en/v3.9.0/examples/icon.html


Comments