WebGL map rendering engine for creative cartography
Bug Fixes
Bug Fixes
Bug Fixes
sampleRasterAtPixel()
, when using with mixed vector/raster tile sizes. 98c528c
zoom_offset
parameter (which implicitly changes tile size).shaders:
uniforms:
u_colors:
- [0.5, 0.5, 0.5] # gray
- [1, 0, 0] # red
- [1, 0, 1] # purple
- [0, 1, 1] # yellow
ignoreGlobal
option to fix a minification error when bundling Tangram with Webpack. de04804
noParse
option applied to Tangram. This is no longer necessary, allowing for simpler builds without special config. Also see #699.scene.queryFeatures()
will now return empty feature set if the scene isn't initialized (e.g. has not been loaded yet, is still in process of loading, etc.). 5d94514Improvements
first
property to the first view_complete
event after each scene load (e.g. this value resets after a scene.load()
). a30ca53
scene.subscribe({ view_complete: ({ first }) => console.log('First view complete event?', first) });
Bug Fixes
scene.updateConfig()
or loading a new scene with scene.load()
.New Features & Functionality Changes
GeoJSON
/TopoJSON
sources, where the lack of an {x}
/{y}
/{z}
tile pattern in the URL indicates the image should be treated as a standalone/un-tiled source:
sources:
chelan:
type: Raster # can now indicate either tiled or un-tiled image source
url: images/chelan.jpg # no tile XYZ pattern in URL indicates standalone image
bounds: [-120.588, 47.467, -119.904, 48.033] # geo-extent of the image
images:
type: Raster
composite:
- { url: image1.png, bounds: [...] }
- { url: image2.png, bounds: [...] }
- { url: image3.png, bounds: [...] }
...
alpha
value can be set either for the entire data source, or per image within the composite
array (with the latter taking precedence):
image:
type: Raster
alpha: 0.7 # apply 70% alpha to images
composite:
- { url: ..., bounds: ... }
- { url: ..., bounds: ..., alpha: 1 } # override to apply full alpha to this image
opaque
blend mode does not process alpha values (e.g. all pixels are drawn with full opacity), the raster data source alpha
parameter only applies when rendering a raster source with non-opaque
blend modes (such as translucent
or overlay
), and is ignored (with a warning) when using opaque
.composite
images, with alpha
applied to the larger image:
max_display_density
parameter will limit the internal resolution a which a raster source is re-sampled. Setting this to a low value like max_display_density: 1
will reduce texture memory usage on high-density displays (such as some phones), at the expense of some visual resolution.@2x
, @3x
, etc.) raster tiles #695
@2x
file naming convention for web and mobile assets. Similar to Leaflet, this is supported in Tangram raster data sources with the {r}
URL template token: https://tiles.maps.com/{z}/{x}/{y}{r}.png
.url_density_scales
parameter. For example, Wikimedia maps has several resolutions, which can be rendered in Tangram with:
sources:
raster:
type: Raster
url: https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png
url_density_scales: [1, 1.3, 1.5, 2, 2.6, 3]
url_density_scales
is [1, 2]
, meaning it will load either "plain" tile URLs like tile.png
, or [email protected]
tiles on displays with a display density >= 2.zoom_offset
data source parameter for down-sampling data #685
zoom_offset
data source parameter allows the user to request lower zooms for each zoom level, reducing tile size and visual detail.zoom_offset: 1
will down-sample the tile data (for both vector and raster sources) by one level, e.g. at zoom 12, zoom 11 tiles will be loaded instead.tile_size: 512
already do this implicitly, loading one level lower than the typical Web Mercator "view" zoom level; any zoom_offset
for these data source is applied in addition to the tile size adjustment, e.g. zoom_offset: 1
with tile_size: 512
will request tiles from two zoom levels earlier (but the 512px tiles will have been designed to not show any loss in visual detail from the first zoom subtraction).zoom_offset: 1
(as compared to full detail), automatically generalizing the terrain while also lowering network bandwidth:
repeat_group
name #687
repeat_group
parameter has been to default to the full, unique combination of all layer names that a given feature matches. While designed to allow for features with identical names but different purposes (e.g. a road and nearby park with the same name) to both properly display without repeat interference between them, in practice this behavior is too granular, causing many crowded, repeated labels for more common cases such as a road that changes from major to minor classification, while retaining its name. This sub-optimal behavior has been hidden by a bug that did not properly implement the original intent.
repeat_group
is that of its top-level parent in the scene's layers
. For example, for typical scene structures this means that all roads will belong to the same repeat group, as would all landuse, all POIs, etc. (assuming top-level layers of roads
, landuse
, pois
, and so forth). This better captures the original intent. In practice (combined with the prior long-standing bug), most scenes will not be affected by this change, though it may have a subtle impact on label placement and density.Optimizations
Bug Fixes
scene.updateConfig()
memory leak #697size
0221e25transform
/preprocess
changes wouldn't be picked up on updateConfig()
) b3dbe72Internal
async/await
syntax, and use fast-async
for transpiled support in ES5 build 9a6faf3eslint
8cd7022Bug Fixes
Internal
$zoom
filter type check (can't be a function) 5bd8747Build Changes
<script type="module">
tag, and because all browsers that support ES modules also support the most commonly used ES6+ features, includes minimal JS code transpiling. This leads to smaller bundle sizes and faster loading, with less code for the browser to download and parse.
tangram.min.mjs
and tangram.debug.mjs
files, following the JS community and Node.js practice of using the .mjs
file extension to distinguish ES modules from CommonJS modules. This minified/zipped build is 154k.tangram.min.js
and tangram.debug.js
files. This minified/zipped build is 170k.module
/nomodule
pattern:<!-- modern browsers load the optimized .mjs file, older browsers (IE11) load the transpiled .js file -->
<script type="module" src="https://unpkg.com/tangram/dist/tangram.min.mjs"></script>
<script nomodule src="https://unpkg.com/tangram/dist/tangram.min.js"></script>
preset-env
and "auto-polyfilling" by usage, and Terser for minification.New Features
request_headers
property #670
sources:
tiles:
type: TopoJSON
url: ...
request_headers:
Authorization: Bearer XXXXXX
$source
, $layer
, $geometry
, and $visible
properties to queryFeatures()
#676
scene.queryFeatures({ group_by: ['$layer', '$geometry', '$visible'] })
transform
functions #675Bug Fixes
global
property bug when updating scene.config
via JS #683shaders:
uniforms:
u_colors:
- [0.5, 0.5, 0.5] # gray
- [1, 0, 0] # red
- [1, 0, 1] # purple
Improvements (Optimizations & Internal)
animation
flag is true
, still skip continuous rendering if no animated styles are visible, to improve rendering performance 7c5c799sprite
definitions, and downgrade to debug level (this is a valid technique for scene authoring) fb3fa62Improvements
interactive
features in lines
and polygons
, removing selection attributes from the VBOs of non-interactive
features 1dbf46e a1131dfinteractive
features are visible 068aec9Bug Fixes
text_source
(e.g. text_source: [name, kind]
should use the feature's name
property for the label if available, otherwise fallback to the kind
property) #672 #673interactive
property from their inline 1eeadc0repeat_group: 0
(should default to px units and act as 0px
value) 5e5ccbb0
value for miter_limit
from their inline c602640repeat_group
with a name of 0
86e2688Bug Fixes
raster
styles (which don't support feature selection). #665 7c51588Bug Fixes
points
-based styles are rendered with more than one texture
(set in draw
groups), e.g. when multiple road shield textures are used with the same rendering style. 417e4b9cdcfa26b2d5b4a87da1866136d8233c92Internal