2
2
// Copyright contributors to the kepler.gl project
3
3
4
4
import * as arrow from 'apache-arrow' ;
5
- import { h3ToGeo } from 'h3-js' ;
6
5
7
6
import Layer , {
8
7
LayerBaseConfig ,
@@ -16,7 +15,12 @@ import {GeoArrowArcLayer} from '@kepler.gl/deckgl-arrow-layers';
16
15
import { FilterArrowExtension } from '@kepler.gl/deckgl-layers' ;
17
16
import { ArcLayer as DeckArcLayer } from '@deck.gl/layers' ;
18
17
19
- import { hexToRgb , DataContainerInterface , ArrowDataContainer } from '@kepler.gl/utils' ;
18
+ import {
19
+ hexToRgb ,
20
+ DataContainerInterface ,
21
+ maybeHexToGeo ,
22
+ ArrowDataContainer
23
+ } from '@kepler.gl/utils' ;
20
24
import ArcLayerIcon from './arc-layer-icon' ;
21
25
import { isLayerHoveredFromArrow , createGeoArrowPointVector , getFilteredIndex } from '../layer-utils' ;
22
26
import {
@@ -140,33 +144,6 @@ const DEFAULT_COLUMN_MODE = COLUMN_MODE_POINTS;
140
144
const brushingExtension = new BrushingExtension ( ) ;
141
145
const arrowCPUFilterExtension = new FilterArrowExtension ( ) ;
142
146
143
- export function getPositionFromHexValue ( token ) {
144
- const pos = h3ToGeo ( token ) ;
145
-
146
- if ( Array . isArray ( pos ) && pos . every ( Number . isFinite ) ) {
147
- return [ pos [ 1 ] , pos [ 0 ] ] ;
148
- }
149
- return null ;
150
- }
151
-
152
- function maybeHexToGeo (
153
- dc : DataContainerInterface ,
154
- d : { index : number } ,
155
- lat : LayerColumn ,
156
- lng : LayerColumn
157
- ) {
158
- // lat or lng column could be hex column
159
- // we assume string value is hex and try to convert it to geo lat lng
160
- const latVal = dc . valueAt ( d . index , lat . fieldIdx ) ;
161
- const lngVal = dc . valueAt ( d . index , lng . fieldIdx ) ;
162
-
163
- return typeof latVal === 'string'
164
- ? getPositionFromHexValue ( latVal )
165
- : typeof lngVal === 'string'
166
- ? getPositionFromHexValue ( lngVal )
167
- : null ;
168
- }
169
-
170
147
function isH3Field ( columns , allFields , key ) {
171
148
const field = allFields [ columns [ key ] . fieldIdx ] ;
172
149
return field ?. type === ALL_FIELD_TYPES . h3 ;
0 commit comments