ol3 load wfs layer Clusterversuch(funktioniert nicht)
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.1/proj4.js"></script>
<script src="http://epsg.io/3301.js"></script>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.5/ol.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.5/ol.css">
<div id="map" class="map"></div>
JavaScript
var projection = ol.proj.get('EPSG:3301');
window.projection = projection;
projection.setExtent([350000, 6370000, 750000, 6630000]);
var base = new ol.layer.Image({
title: "Maa-ameti aluskaardid",
maxResolution: 10000,
source: new ol.source.ImageWMS({
url: 'http://kaart.maaamet.ee/wms/alus?',
ratio: 1.05,
params: {
LAYERS: 'MA-ALUS',
FORMAT: 'image/png',
TRANSPARENT: 'false',
VERSION: '1.1.1'
}
})
});
var vectorSource = new ol.source.ServerVector({
format: new ol.format.GeoJSON(),
loader: function (extent, resolution, projection) {
var url = 'http://loom-gis.geo.ut.ee:8080/geoserver/ermas/ows?service=WFS&' +
'version=1.1.0&request=GetFeature&typeName=ermas:testdata_geopnt&' +
'outputFormat=text/javascript&format_options=callback:loadFeatures&' +
'srsname=EPSG:3301&bbox=' + extent.join(',') + ',EPSG:3301'
$.ajax({
url: url,
dataType: 'jsonp'
});
},
strategy: ol.loadingstrategy.createTile(new ol.tilegrid.XYZ({
maxZoom: 19
})),
projection: 'EPSG:3301'
});
window.vectorSource = vectorSource;
var defaultStyle = new ol.style.Style({
image: new ol.style.Circle({
radius: 3,
// fill: new ol.style.Fill({color: '#AA0000'}),
stroke: new ol.style.Stroke({
color: 'red',
width: 1
})
})
})
var testdata_geopnt = new ol.layer.Vector({
source: vectorSource,
style: defaultStyle
});
window.testdata_geopnt = testdata_geopnt;
var clusterSource = new ol.source.Cluster({
distance: 40,
source: vectorSource
});
var loadFeatures = function (response) {
vectorSource.addFeatures(vectorSource.readFeatures(response));
};
window.loadFeatures = loadFeatures;
var styleCache = {};
var clusters = new ol.layer.Vector({
source:...