Add loader and strategy to ol.source.Vector

This commit is contained in:
Éric Lemoine
2015-04-03 20:13:50 +02:00
parent e86fd4afd4
commit 09b90c8424
7 changed files with 251 additions and 16 deletions

View File

@@ -1,9 +1,9 @@
goog.require('ol.FeatureOverlay');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.GeoJSON');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.GeoJSON');
goog.require('ol.source.MapQuest');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
@@ -31,10 +31,11 @@ var style = new ol.style.Style({
})
});
var styles = [style];
var vectorLayer = new ol.layer.Vector({
source: new ol.source.GeoJSON({
projection: 'EPSG:3857',
url: 'data/geojson/countries.geojson'
source: new ol.source.Vector({
url: 'data/geojson/countries.geojson',
format: new ol.format.GeoJSON()
}),
style: function(feature, resolution) {
style.getText().setText(resolution < 5000 ? feature.get('name') : '');