Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trefadder #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build_copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ if [ -z "$1" ]
path="../Napkin-Visual/client/"
fi

cp umd/keplergl.min.js $path/lib/build.min.js
cp umd/keplergl.min.js $path/lib/build-trefadder.min.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
]
},
"engines": {
"node": ">=12.0.0"
"node": ">=10.0.0"
},
"maintainers": [
"Shan He <[email protected]>",
Expand Down
3 changes: 0 additions & 3 deletions src/components/map-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ const Attribution = () => (
/>
</div>
<div className="attrition-link">
<a href="https://kepler.gl/policy/" target="_blank" rel="noopener noreferrer">
© kepler.gl |{' '}
</a>
<a href="https://www.mapbox.com/about/maps/" target="_blank" rel="noopener noreferrer">
© Mapbox |{' '}
</a>
Expand Down
20 changes: 19 additions & 1 deletion src/layers/geojson-layer/geojson-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import uniq from 'lodash.uniq';
import {DATA_TYPES} from 'type-analyzer';

import Layer, {colorMaker} from '../base-layer';
import {GeoJsonLayer as DeckGLGeoJsonLayer} from '@deck.gl/layers';
import {GeoJsonLayer as DeckGLGeoJsonLayer, TextLayer as DeckGLTextLayer} from '@deck.gl/layers';
import {getGeojsonDataMaps, getGeojsonBounds, getGeojsonFeatureTypes} from './geojson-utils';
import GeojsonLayerIcon from './geojson-layer-icon';
import {GEOJSON_FIELDS, HIGHLIGH_COLOR_3D, CHANNEL_SCALES} from 'constants/default-settings';
Expand Down Expand Up @@ -293,6 +293,11 @@ export default class GeoJsonLayer extends Layer {

const pickable = interactionConfig.tooltip.enabled;
const hoveredObject = this.hasHoveredObject(objectHovered);
var getCentroid = function (arr) {
return arr.reduce(function (x,y) {
return [x[0] + y[0]/arr.length, x[1] + y[1]/arr.length]
}, [0,0])
};

return [
new DeckGLGeoJsonLayer({
Expand Down Expand Up @@ -322,6 +327,19 @@ export default class GeoJsonLayer extends Layer {
: {})
}
}),
new DeckGLTextLayer({
id: defaultLayerProps.id + '99',
data: data.data.map(e => { return { name: e.properties.kunde, coordinates: e.geometry.coordinates[0].length > 0 ? getCentroid(e.geometry.coordinates[0][0]) : e.geometry.coordinates } }),
pickable: false,
sizeUnits: 'meters',
getPosition: d => d.coordinates,
getText: d => d.name ? (d.name.substr(-2) == "AS" ? d.name.substr(0, d.name.length-3) : d.name) : '_',
getColor: d => [230, 230, 230],
getSize: 3,
getAngle: -50,
getTextAnchor: 'middle',
getAlignmentBaseline: 'center'
}),
...(hoveredObject && !visConfig.enable3d
? [
new DeckGLGeoJsonLayer({
Expand Down