You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { ParquetLoader } from '@loaders.gl/parquet';
Description
Consider the following code which renders counts against h3 indexes in a parquet file. As the code is below it works but that's because ( marked in the code below) I am having to convert each value of h3 index from Uint8Array(15) using d.h3.toString() . Without that conversion, H3HexagonLayer doesn't render!
<script>
import {MapboxOverlay} from '@deck.gl/mapbox';
import {Map} from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
import {H3HexagonLayer} from '@deck.gl/geo-layers';
import {ParquetLoader} from '@loaders.gl/parquet';
import {ZstdCodec} from 'zstd-codec';
let first = true;
export default {data(){return{msg: 'Hello World!'}},
async mounted() {constlayer=newH3HexagonLayer({id: 'H3HexagonLayer',//data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf.h3cells.json',data: '/ais_h3_8.parquet',loadOptions: {worker: false,//see if we can turn on the worker. see https://deck.gl/docs/developer-guide/loading-data#loaders-and-web-workersmodules: {'zstd-codec': ZstdCodec}},loaders: [ParquetLoader],extruded: false,getHexagon: d=>{//this is very inefficient, see if parquet can be correctly encoded to yield stringif(first){console.log(d);// prints {count: 7153252, h3: Uint8Array(15)}first=false;}returnd.h3.toString();// <<<<<<------- IMP: without this conversion the rendering breaks! },gpuAggregation: true,getFillColor: d=>[255,(1-d.count/500)*255,0],pickable: false,beforeId: 'watername_ocean',opacity: 0.5});constmap=newMap({container: 'map',style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',center: [-122.45,37.8],zoom: 8});awaitmap.once('load');constdeckOverlay=newMapboxOverlay({interleaved: true,layers: [layer]});map.addControl(deckOverlay);}}</script><template><divid="map"class="map"></div></template>
<stylescoped>
.map {height: 100%;width: 100%;}</style>
Here's the details on my parquet file created with DuckDB
Since the parquert file has varchars for h3 indexes, I am expecting the deck.gl loader code to work without having to explicit convert to string for every single value.
I am wondering if this is a bug somewhere in Deck.gl or Loaders.gl or if there's something I need to do to change the parquet file itself which uses zstd compression.
Loader
import { ParquetLoader } from '@loaders.gl/parquet';
Description
Consider the following code which renders counts against h3 indexes in a parquet file. As the code is below it works but that's because ( marked in the code below) I am having to convert each value of h3 index from
Uint8Array(15)
usingd.h3.toString()
. Without that conversion,H3HexagonLayer
doesn't render!Here's the details on my parquet file created with DuckDB
Expected Behavior
Since the parquert file has varchars for h3 indexes, I am expecting the deck.gl loader code to work without having to explicit convert to string for every single value.
I am wondering if this is a bug somewhere in Deck.gl or Loaders.gl or if there's something I need to do to change the parquet file itself which uses zstd compression.
Steps to Reproduce
Steps to reproduce is in the above example.
Environment
Node Version: 20.0.15
Browser: Chrome
OS: MacOS Sequoia (M1 Max)
"dependencies": {
"@deck.gl/core": "^9.0.32",
"@deck.gl/geo-layers": "^9.0.32",
"@deck.gl/layers": "^9.0.32",
"@deck.gl/mapbox": "^9.0.32",
"@loaders.gl/compression": "^4.2.5",
"@loaders.gl/core": "^4.2.5",
"@loaders.gl/parquet": "^4.2.5",
"maplibre-gl": "^4.7.1",
"vue": "^3.4.29",
"zstd-codec": "^0.1.5"
},
Logs
One row from parquet file on console:
The text was updated successfully, but these errors were encountered: