
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@maptalks/gltf-layer
Advanced tools
maptalks.gltf is a maptalks layer used to rendering gltf models on map.
npm install @maptalks/gltf-layer.https://unpkg.com/@maptalks/gltf-layer@0.2.0/dist/maptalks.gltf.js<script type="text/javascript" src="../maptalks.gltf.js"></script>
<script>
var map = new maptalks.Map("map",{
center : [0, 0],
zoom : 15
});
var gltflayer = new maptalks.GLTFLayer('gltf').addTo(map);
var gltfMarker = new maptalks.GLTFMarker(coordinate, {
outline: true,
symbol : {
rotation: [90, 0, 0]
}
}).addTo(gltflayer);
</script>
import { GLTFLayer } from 'maptalks.gltf';
import { GLTFMarker } from 'maptalks.gltf';
const map = new maptalks.Map("map",{
center : [0, 0],
zoom : 15
});
const gltflayer = new GLTFLayer('gltf').addTo(map);
const gltfMarker = new GLTFMarker(coordinate, {
outline: true,
symbol : {
rotation: [90, 0, 0]
}
}).addTo(gltflayer);
(inherited from maptalks.OverlayLayer)a layer used to renderering gltf model on map, it manages gltf markers.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | gltflayer's id | |
options | Object | null | construct options |
(static)registerShader(name, type, config, uniforms)register a custom shader to gltf layer
| Parameter | Type | Default | Description |
|---|---|---|---|
name | String | shader's name | |
type | String | shader's type | |
config | Object | a regl shader structure | |
uniforms | Object | null | uniforms transform to webgl shader |
(static)removeShader(name)remove a shader from gltf layer's shader list
| Parameter | Type | Default | Description |
|---|---|---|---|
name | String | shader's name |
(static)getShaders()get all shaders registed to gltf layer
returns :
Object: gltf layer's shader list
(static)fromJSON(json)create a GLTFLayer from s JSON object
| Parameter | Type | Default | Description |
|---|---|---|---|
json | Objec | JSON object |
returns :
GLTFLayer: a new gltf layer
add one or more gltf marker in gltf layer
| Parameter | Type | Default | Description |
|---|---|---|---|
markers | GLTFMarker | Array. | one or more GLTFMarkers |
returns :
GLTFLayer: this
remove one or more gltf marker from gltf layer
| Parameter | Type | Default | Description |
|---|---|---|---|
markers | GLTFMarker | Array. | one or more GLTFMarkers |
get gltf layer's models
returns :
Object: gltf model list
convert gltflayer to a JSON object
| Parameter | Type | Default | Description |
|---|---|---|---|
options | Object | null | export options |
returns :
Object: gltflayer's JSON
set styles for gltf layer
| Parameter | Type | Default | Description |
|---|---|---|---|
layerStyle | Object | style object to set for gltflayer |
returns :
GLTFLayer: this
get gltf layer's style objects if it has set
| Parameter | Type | Default | Description |
|---|---|---|---|
layerStyle | Object | style object to set for gltflayer |
returns :
Object: layer's style object
update a style's symbol for gltf layer by index
| Parameter | Type | Default | Description |
|---|---|---|---|
idx | Number | the index of gltflayer's style | |
symbolProperties | Object | null | a style object |
get all modle's url added to gltf layer
returns :
Array: gltf model list
clear all gltf markers
returns :
GLTFLayer: this
remove itself from map
_identify the gltf markers on the given coordinate
| Parameter | Type | Default | Description |
|---|---|---|---|
coordinate | maptalks.Coordinate | coordinate to identify | |
options | Object | null | some conditions |
(inherited from maptalks.Marker)a gltf marker object to render gltf models
| Parameter | Type | Default | Description |
|---|---|---|---|
coordinates | maptalks.Coordinates | coordinates of the gltf marker | |
options | Object | null | construct options defined in GLTFMarker |
(static)fromJSON(json)create a new GLTFMarker from a JSON object
| Parameter | Type | Default | Description |
|---|---|---|---|
json | Object | a JSON objec |
returns :
GLTFMarker: a new GLTFMarker
set a gltf model path for gltf marker
| Parameter | Type | Default | Description |
|---|---|---|---|
url | String | gltf model's path |
returns :
GLTFMarker: this
set coordinates for gltf marker
| Parameter | Type | Default | Description |
|---|---|---|---|
coordinates | Coordinate | Array. | the gltf marker's location |
returns :
GLTFMarker: this
add a gltf marker to gltf layer
| Parameter | Type | Default | Description |
|---|---|---|---|
layer | GLTFLayer | the layer to add to |
returns :
GLTFMarker: this
remove itselt from gltf layer
show the marker
returns :
GLTFMarker: this
hide the marker_
returns :
GLTFMarker: this
add a gltf marker to gltf layer
| Parameter | Type | Default | Description |
|---|---|---|---|
bloom | Boolean | whether has bloom effect |
returns :
GLTFMarker: this
if the gltf marker has bloom effect
returns :
Boolean : if has bloom effect
set shadow effect for gltf marker
| Parameter | Type | Default | Description |
|---|---|---|---|
shadow | Boolean | whether has shadow effect |
returns :
GLTFMarker: this
if the gltf marker has shadow effect
returns :
Boolean : if has shadow effect
set outline effect for gltf marker
| Parameter | Type | Default | Description |
|---|---|---|---|
outline | Boolean | whether has outline effect |
returns :
GLTFMarker: this
if the gltf marker has outline effect
returns :
Boolean : if has outline effect
if the gltf marker has outline effect
returns :
Boolean : if has outline effect
_clone a marker by itself
returns :
GLTFMarker : a new gltf marker
set id for gltf marker
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | gltf marker's id |
get gltf marker's id
set a shader for gltf marker
| Parameter | Type | Default | Description |
|---|---|---|---|
shader | Object | shader's config |
returns :
GLTFMarker : a new gltf marker
FAQs
A maptalks Layer to render gltf
The npm package @maptalks/gltf-layer receives a total of 2,093 weekly downloads. As such, @maptalks/gltf-layer popularity was classified as popular.
We found that @maptalks/gltf-layer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.