-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mapbox raster #3928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapbox raster #3928
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,7 +131,7 @@ function isVisible(opts) { | |
|
||
return opts.visible && ( | ||
Lib.isPlainObject(source) || | ||
(typeof source === 'string' && source.length > 0) | ||
((typeof source === 'string' || Array.isArray(source)) && source.length > 0) | ||
); | ||
} | ||
|
||
|
@@ -193,22 +193,34 @@ function convertOpts(opts) { | |
break; | ||
} | ||
|
||
return { layout: layout, paint: paint }; | ||
return { | ||
layout: layout, | ||
paint: paint | ||
}; | ||
} | ||
|
||
function convertSourceOpts(opts) { | ||
var sourceType = opts.sourcetype; | ||
var source = opts.source; | ||
var sourceOpts = {type: sourceType}; | ||
var sourceOpts = { | ||
type: sourceType | ||
}; | ||
var field; | ||
|
||
if(sourceType === 'geojson') { | ||
field = 'data'; | ||
} else if(sourceType === 'vector') { | ||
field = typeof source === 'string' ? 'url' : 'tiles'; | ||
} else if(sourceType === 'raster') { | ||
field = 'tiles'; | ||
sourceOpts.tileSize = 256; | ||
for(var index = 0; index < source.length; index++) { | ||
var url = source[index]; | ||
source[index] = decodeURIComponent(url); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? I would expect the URLs in the |
||
} | ||
} | ||
|
||
sourceOpts[field] = source; | ||
|
||
return sourceOpts; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -100,7 +100,7 @@ var attrs = module.exports = overrideAll({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sourcetype: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
valType: 'enumerated', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
values: ['geojson', 'vector'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
values: ['geojson', 'vector', 'raster'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At some point, we could add
which could be used together with |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dflt: 'geojson', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
role: 'info', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
description: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -132,7 +132,7 @@ var attrs = module.exports = overrideAll({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
valType: 'enumerated', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
values: ['circle', 'line', 'fill', 'symbol'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
values: ['circle', 'line', 'fill', 'symbol', 'raster'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As plotly.js/src/plots/mapbox/layout_defaults.js Lines 53 to 90 in c0cebfd
Down the road, it might be nice to expose some of mapbox-gl's raster style settings: https://docs.mapbox.com/mapbox-gl-js/style-spec/#layers-raster |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dflt: 'circle', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
role: 'info', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
description: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this means both:
and
will work