Use ol.source.GeoJSON in geojson example

This commit is contained in:
Tom Payne
2013-12-04 19:17:44 +01:00
parent df975aa558
commit 94d392c0c6
+7 -7
View File
@@ -2,14 +2,13 @@ goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.format.GeoJSON');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.shape');
goog.require('ol.source.GeoJSON');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
@@ -62,7 +61,9 @@ var styleFunction = function(feature, resolution) {
return styles[feature.getGeometry().getType()];
};
var features = new ol.format.GeoJSON().readFeatures({
var vectorSource = new ol.source.GeoJSON(
/** @type {ol.source.GeoJSONOptions} */ ({
object: {
'type': 'FeatureCollection',
'crs': {
'type': 'name',
@@ -123,12 +124,11 @@ var features = new ol.format.GeoJSON().readFeatures({
}
}
]
});
}
}));
var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: features
}),
source: vectorSource,
styleFunction: styleFunction
});
var tmpLineFeature = new ol.Feature(