Openlayers 3 how to add kml vector from a string variable

55 views
Skip to first unread message

Rey Jaropay

unread,
Jun 16, 2017, 3:31:37 AM6/16/17
to OpenLayers Dev
  var kmlString = result;
            
            var features = new ol.format.KML().readFeatures(kmlString, {
                dataProjection: 'EPSG:4326'
                
            });

            var KMLvectorSource = new ol.source.Vector({});

            var KMLvector = new ol.layer.Vector({
                source: KMLvectorSource,
                visible: true
            });

            KMLvectorSource.addFeature(features);
            map.addLayer(KMLvector);

hi guyz I'm trying to get a KMLlayer that returns a geometry of polygon and i catch it to a string
i did the code above as i research but it doesn't work
Reply all
Reply to author
Forward
0 new messages