Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
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
Uh oh!
There was an error while loading. Please reload this page.
Mapbox raster #3928
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
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); | ||
Contributor 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'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(visible){ | |
| varsourceType=coerce('sourcetype'); | |
| coerce('source'); | |
| if(sourceType==='vector')coerce('sourcelayer'); | |
| // maybe add smart default based off GeoJSON geometry? | |
| vartype=coerce('type'); | |
| coerce('below'); | |
| coerce('color'); | |
| coerce('opacity'); | |
| coerce('minzoom'); | |
| coerce('maxzoom'); | |
| if(type==='circle'){ | |
| coerce('circle.radius'); | |
| } | |
| if(type==='line'){ | |
| coerce('line.width'); | |
| coerce('line.dash'); | |
| } | |
| if(type==='fill'){ | |
| coerce('fill.outlinecolor'); | |
| } | |
| if(type==='symbol'){ | |
| coerce('symbol.icon'); | |
| coerce('symbol.iconsize'); | |
| coerce('symbol.text'); | |
| Lib.coerceFont(coerce,'symbol.textfont'); | |
| coerce('symbol.textposition'); | |
| coerce('symbol.placement'); | |
| } | |
| } |
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
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