Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save charlieforward9/7637c8598caa1537ac965ed1603dcdbe to your computer and use it in GitHub Desktop.
Save charlieforward9/7637c8598caa1537ac965ed1603dcdbe to your computer and use it in GitHub Desktop.
deck.gl GlobeView Icon Layer Bug
/*
* https://deck.gl/docs/api-reference/core/globe-view
*/
const {DeckGL, _GlobeView, ColumnLayer, TileLayer, BitmapLayer, CompositeLayer, IconLayer, COORDINATE_SYSTEM} = deck;
const points = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-81.64597499999999, 27.262075000000003]
},
"properties": {}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-80.53932499999999, 27.458875]
},
"properties": {}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-81.13726363636366, 27.143715151515153]
},
"properties": {}
}
]
};
const layer = new IconLayer({
id: 'IconLayer',
data: points.features,
getIcon: (d) => 'marker',
getPosition: (d) => d.coordinates,
getSize: 40,
iconAtlas: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.png',
iconMapping: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.json',
pickable: true
});
new DeckGL({
views: new _GlobeView({
resolution: 10
}),
initialViewState: {
longitude: 2.27,
latitude: 10.86,
zoom: 0,
minZoom: 0,
maxZoom: 20
},
controller: true,
layers: [
layer,
new TileLayer({
data: 'https://c.tile.openstreetmap.org/{z}/{x}/{y}.png',
minZoom: 0,
maxZoom: 19,
tileSize: 256,
renderSubLayers: props => {
const {
bbox: {west, south, east, north}
} = props.tile;
return new BitmapLayer(props, {
data: null,
image: props.data,
_imageCoordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
bounds: [west, south, east, north]
});
}
})
]
});
<script src="https://unpkg.com/deck.gl@^9.1.0/dist.min.js"></script>
body {
margin: 0;
width: 100vw;
height: 100vh;
overflow: hidden;
}
@charlieforward9
Copy link
Author

Linked to visgl/deck.gl#9554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment