docs for hillshade layer and raster-dem source#5805
Conversation
686f330 to
eb74914
Compare
fa57cc4 to
0121b03
Compare
mollymerp
left a comment
There was a problem hiding this comment.
Thanks so much for tackling this @andrewharvey! This is looking great – just a few small comments.
docs/pages/example/hillshade.html
Outdated
| map.removeLayer('hillshade_highlight_bright'); | ||
|
|
||
| map.setLight({ | ||
| position: [1.15, 335, 60] |
There was a problem hiding this comment.
I don't think we need to include this because we decided to use layer-specific lighting properties for the hillshade layer type (hillshade-illumination-direction and hillshade-illumination-anchor).
There was a problem hiding this comment.
I did this since the debug map used a light position, but I see what you mean now.
| "id": "hillshading", | ||
| "source": "dem", | ||
| "type": "hillshade" | ||
| }, 'waterway-river-canal-shadow'); |
There was a problem hiding this comment.
maybe add a comment explaining why we want the hillshade layer underneath this layer
| @@ -40,7 +40,7 @@ module.exports = function validateSource(options) { | |||
| errors = errors.concat(validateObject({ | |||
There was a problem hiding this comment.
I think we can actually get rid of this case now and add raster-dem into the previous case with vector and raster sources. you will have to edit line 26 to something like
valueSpec: styleSpec[`source_${type.replace('-','_'}`],to get it to work.
There was a problem hiding this comment.
Good point, that reduces code duplication.
docs/pages/example/hillshade.html
Outdated
| var map = new mapboxgl.Map({ | ||
| container: 'map', | ||
| style: 'mapbox://styles/mapbox/outdoors-v9', | ||
| center: [-74.50, 40], |
There was a problem hiding this comment.
let's change the map center to somewhere with ⛰ s. Z11, center: -119.5857, 37.7221 is yosemite valley for example
0121b03 to
f133fde
Compare
docs/pages/example/hillshade.html
Outdated
| map.removeLayer('hillshade_shadow_med'); | ||
| map.removeLayer('hillshade_shadow_faint'); | ||
| map.removeLayer('hillshade_highlight_med'); | ||
| map.removeLayer('hillshade_highlight_bright'); |
There was a problem hiding this comment.
@mollymerp I'm not sure about this. In terms of an example for the hillshade layer, it might make better sense to just use the Mapbox Basic style and add hillshading to that. It would be a simpler example.
This example is more complex as it removes the existing hillshade layers from Outdoors client side. Especially given any real map wanting Outdoors with raster hillshading would first cut the Hillshade layers from Outdoors in Studio and save that as a new style rather than doing it client side... 💭
There was a problem hiding this comment.
yeah good point – I made a new public style in the Mapbox account that is Outdoors minus the hillshade layers,so you can use this style id and explain with a comment what it is ?
mapbox://styles/mapbox/cjaudgl840gn32rnrepcb9b9g
There was a problem hiding this comment.
Great. Assuming you're okay that people will copy the example and rely on that style not disappearing in the future?
There was a problem hiding this comment.
yep – and we can replace it with a permanent style whenever our core styles start using this layer type.
f133fde to
0f5be60
Compare
dd3ebfe to
0d6da33
Compare
|
Thanks for the fixes @andrewharvey – I added a couple tweaks to the example, and added in the explicit properties the raster-dem source type currently supports for consistency with the other source types, as well as to remove the |
| "value": "string", | ||
| "doc": "An array of one or more tile source URLs, as in the TileJSON spec." | ||
| }, | ||
| "bounds": { |
There was a problem hiding this comment.
That's interesting, I tested bounds and found it had no affect. I better re-test it.
There was a problem hiding this comment.
in order for it to work you have to use the tiles: [...] property to specify the url because otherwise the bounds returned by the source's TileJSON will override the ones you specify. which I suppose we should also document 😅
There was a problem hiding this comment.
this worked as expected for me:
"rasterTerrain": {
"type": "raster-dem",
"tiles": [`https://a.tiles.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.png?access_token=${mapboxgl.accessToken}`],
"bounds" : [-40, -40, 40, 40]
}There was a problem hiding this comment.
ahh that makes sense now 😁
There was a problem hiding this comment.
Agreed, it should be documented but I don't think it's critical for this PR. The same applies to the rest of these properties and raster sources too.
@mollymerp This isn't ready for merging, but posting it here for feedback. This PR includes:
added hillshade example
I'm not sure if we should have a dedicated example for the hillshade layer, but I put one together.
added
raster-demsource andhillshadelayer to docs.included
raster-demsource in the style spec rather than it being a type of therastersource.