Repository navigation
add tileset encoding option to darwin sources - #11274
Conversation
|
|
||
| /** | ||
| Raster tiles generated with the Mapbox encoding formula where | ||
| elevaion = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1) |
There was a problem hiding this comment.
Typo: elevation.
Also, I’m not sure how this comment will be interpreted by reStructuredText and Markdown parsers, but this will at least format it like a pretty formula in the jazzy documentation (which uses a Markdown parser):
<var>elevation</var> = −10000 + ((<var>red</var> × 256² + <var>green</var> × 256 + <var>blue</var>))|
|
||
| /** | ||
| Raster tiles generated with the Mapzen Terrarium encoding formula where | ||
| elevaion = (R * 256 + G + B / 256) - 32768 |
There was a problem hiding this comment.
<var>elevation</var> = (<var>red</var> × 256 + <var>green</var> + <var>blue</var> ÷ 256) − 32768| // when the dem enciding is changed using an NSValue | ||
| MGLDEMEncoding terrarium = MGLDEMEncodingTerrarium; | ||
| tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{ | ||
| MGLTileSourceOptionDEMEncoding: [NSValue value:&terrarium withObjCType:@encode(MGLDEMEncoding)], |
There was a problem hiding this comment.
Use @(MGLDEMEncoding) instead, so that the value in the dictionary is “boxed” in an NSInteger instead of an NSValue. Most option dictionaries use NSIntegers for more convenient unboxing.
There was a problem hiding this comment.
Should I delete this test altogether then because the one above it uses @(MGLDEMEncoding) and NSNumber
There was a problem hiding this comment.
Oh, I see, I misread this. You’re right, carry on. 👍
| tileSet.encoding = mbgl::Tileset::DEMEncoding::Mapbox; | ||
| break; | ||
| case MGLDEMEncodingTerrarium: | ||
| tileSet.encoding = mbgl::Tileset::DEMEncoding::Terrarium; |
There was a problem hiding this comment.
If encoding is supported by TileSet no matter which source type the TileSet is used with, then this implementation is fine and the second and third steps in #11224 (comment) are unnecessary.
| MGLDEMEncodingMapbox = 0, | ||
|
|
||
| /** | ||
| Raster tiles generated with the Mapzen Terrarium encoding formula where |
There was a problem hiding this comment.
Should we link to this documentation or this GitHub repository?
There was a problem hiding this comment.
in GL JS I linked to https://aws.amazon.com/public-datasets/terrain/ due to the mapzen shutdown 🤷♀️
| typedef NS_ENUM(NSUInteger, MGLDEMEncoding) { | ||
|
|
||
| /** | ||
| Raster tiles generated with the Mapbox encoding formula where |
There was a problem hiding this comment.
Consider linking to this document in lieu of a standard specification.
d10a3f5 to
611ea72
Compare
| Raster tiles generated with the Mapbox encoding formula where | ||
| elevaion = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1) | ||
| Raster tiles generated with the Mapbox encoding formula. | ||
| See more details here: https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb |
There was a problem hiding this comment.
Documentation comments use Markdown format. Link “Mapbox encoding formula” to this URL using Markdown format. (Technically, HTML syntax would be preferable, but Quick Help’s formatting is currently broken, so the only parser we care much about right now is jazzy’s.)
b47c18d to
484f979
Compare
* add tileset encoding option to darwin sources * correct style guide * link out to dem encoding docs * markdownify comments
part of #11224
@1ec5 I didn't end up following your instructions exactly because
encodingis not a constructor option for RasterDEMTileset but rather an option on the baseTilesetclass so I didn't understand how to add the option handling further down in the source inheritance – but maybe I'm doing something wrong 😅