If I had 200+ GeoJSON files defining borders of the world's countries, how would I get this data to appear on the map? Reading the multiple files is the part I cannot figure out. I know how to do this for a single GeoJSON file. Here's my single-file example:
var map, layer;
function init() {
layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", {
layers: 'basic'
}, {
style: 'min-height:700px'
});
map = new OpenLayers.Map('map');
map.addLayer(layer);
createCountryBorders(map);
map.setCenter(new OpenLayers.LonLat(0, 0), 4);
map.zoomToMaxExtent();
}
function createCountryBorders(map) {
var geoJsonLayer = new OpenLayers.Layer.Vector("Country Borders", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "countryborders/sub/countries-hires-line.json",
format: new OpenLayers.Format.GeoJSON()
})
});
map.addLayer(geoJsonLayer);
}