Skip to content

Commit 88b39c0

Browse files
authored
Added setting to customize a map provider for map visualizations (#201)
1 parent a344f17 commit 88b39c0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/chart/MapChart.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ const NeoMapChart = (props: ChartProps) => {
3434
const intensityProp = props.settings && props.settings.intensityProp ? props.settings.intensityProp : "";
3535
const defaultNodeColor = "grey"; // Color of nodes without labels
3636
const dimensions = props.dimensions ? props.dimensions : {width: 100, height: 100};
37+
const mapProviderURL = props.settings && props.settings.providerUrl ? props.settings.providerUrl : "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
38+
const attribution = props.settings && props.settings.attribution ? props.settings.attribution : '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors';
3739

40+
41+
3842
const [data, setData] = React.useState({ nodes: [], links: [], zoom: 0, centerLatitude: 0, centerLongitude: 0 });
3943

4044
// Per pixel, scaling factors for the latitude/longitude mapping function.
@@ -339,8 +343,8 @@ const NeoMapChart = (props: ChartProps) => {
339343
scrollWheelZoom={false}>
340344
{heatmap}
341345
<TileLayer
342-
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
343-
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
346+
attribution={attribution}
347+
url={mapProviderURL}
344348
/>
345349
{markers}
346350
{lines}

src/config/ReportConfig.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,11 @@ export const REPORT_TYPES = {
700700
values: [true, false],
701701
default: false
702702
},
703+
"providerUrl": {
704+
label: "Map Provider URL",
705+
type: SELECTION_TYPES.TEXT,
706+
default: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
707+
},
703708
"autorun": {
704709
label: "Auto-run query",
705710
type: SELECTION_TYPES.LIST,

0 commit comments

Comments
 (0)