Check the documentation: Although this source receives tiles with vector features from the server, it is not meant for feature editing.
So, you can not add a ol.interaction.Draw
interaction to add features directly to your ol.source.VectorTile
. That is waywhy you get the error this.source_.addFeature is not a function
.
Use a ol.layer.Vector
with a GeoJSON source.
var vectorSource = new ol.source.Vector({
format: new ol.format.GeoJSON(),
loader: function (sourceExtent, resolution, projection) {
(...)
var features = (new ol.format.GeoJSON()).readFeatures(result.data);
vectorSource.addFeatures(features);
(...)
}
});
var vectorJSON = new ol.layer.Vector({
source: vectorSource
});