Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

Commit

Permalink
properly set data.format and no longer hardcode local raster ids
Browse files Browse the repository at this point in the history
  • Loading branch information
gretacb committed Aug 12, 2014
1 parent 82be54f commit 76327c6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,12 @@ source.normalize = function(data) {
}
return l;
});
// Format property to distinguish from imagery tiles.
data.format = 'pbf';

// Construct vector_layers info from layer properties if necessary.
data.vector_layers = protocolIsValid(tm.parse(data.id).protocol) === 'local'
? data.Layer.reduce(function(vlayers, l) {
// Only allow one vector_layer for local raster sources.
if (l.Datasource.type === 'gdal') return [{id:'raster_local'}];
if (l.Datasource.type === 'gdal') return [{id:'undefined'}];

This comment has been minimized.

Copy link
@yhahn

yhahn Aug 12, 2014

Member

Hm, this should be

return undefined;

ie. there should be no data.vector_layers key set at all (you'll see all the stuff this breaks for bullet #3)


var info = {};
info.id = l.id;
Expand All @@ -357,6 +355,13 @@ source.normalize = function(data) {
return vlayers;
}, [])
: data.vector_layers;

// Format property to distinguish from imagery tiles.
if(data.vector_layers !== undefined && data.vector_layers.length > 0){
if (data.Layer[0].Datasource.type === 'gdal') data.format = 'webp';
else data.format = 'pbf';
}

return data;
};

Expand Down

0 comments on commit 76327c6

Please sign in to comment.