tgve / tgvejs

Turing Geo-Visualisation Engine
MIT License
31 stars 7 forks source link
geospatial-analytics geospatial-visualization visualization

Node CI npm version GitHub package.json version codecov

The Turing Geovisualisation Engine (TGVE) is a web-based, interactive visual analytics tool for geospatial data analysis, built using R and JavaScript/React, that can be used as a complete server-client application or just as a front-end stand-alone application. The visual views and interaction mechanisms designed into the tool is underpinned by empirically-informed guidelines around visualization design and techniques from Geographic Information Science (GIScience). Additionally, techniques from geographic information science (GIScience) and related domains are used to implement automatic aggregation of temporal and spatial data.

TGVE screen shot

npm package

note: the older versions released under https://www.npmjs.com/package/eatlas is deprecated.

This is a React Component ES Module that can be embedded in your React applications. To install in your project:

npm install @tgve/tgvejs
# or
yarn add @tgve/tgvejs

Then, for an example to import the TGVE package and use it as the main component in a React app, see the tgve/app repo. Following is a snippet of ReactJS from that repo:

import React from 'react';
import Tgve from '@tgve/tgvejs';

function App() {
  return (
    <Tgve defaultURL={process.env.REACT_APP_DEFAULT_URL}/>
  );
}

Configuration settings

TGVE supports separately-provided geography (in GeoJSON or Shapefile) and point data sources (in CSV). Other formats are not supported.

The following parameters can be passed to the TGVE app. Each parameter can be passed as an environment variable, with the exception of:

For example: REACT_APP_GEOGRAPHY_URL or when using TGVE as a component <Tgve geographyURL="https://geo.com">. For more on passing variables to a React app and the REACT_APP_ prefix please see React docs.

They can also be passed to the TGVE as URL query parameters. For instance localhost:3000?dark=false.

None of the above values is necessary and in the current release “Add data” button allows loading data into eAtlas.

Callbacks

The TGVE supports these callbacks since v1.5.1:

In light of the above callbacks, when data is loaded in TGVE via "Add data" button from the local machine (i.e via FileReader API), the TGVE will disable other data sources until "reset" button is pressed.

Shapefiles

For more about shapefiles please refer to this Wikipedia entry. The TGVE can read shapefiles if provided as a zip file using shapefile.js. The package is used as external dependency, therefore, if you do use it make sure you have <script src="https://unpkg.com/shpjs@latest/dist/shp.js"></script> in your React app's index.html file. Then, just add the source as defaultURL=www.domain/shape.zip.

Data and settings

As stated above, you can create a script tag to pass data and above configurations as JSON to where TGVE is being rendered; for example in an index.html where the component is rendered like:

<!--notice the ID names-->
<script id="tgve-data" type="application/json">{'valid':'geojson'}</script>
<script id="tgve-settings" type="application/json">{'defaultURL':'https://raw.githubusercontent.com/layik/eatlas-data/main/casualties_100.geojson','dark':'false'}</script>

External dependenices

The package relies on Plotly to be available as window.Plotly. You can satisify this dependency by adding Plotly in your HTML build where the package is used. For instance version 2.6.3 minifed:

<script src="https://cdn.plot.ly/plotly-2.6.3.min.js"></script>

If you are not sure, please see the app repository.

Testing

The package follows create-react-app testing kits and uses mainly @testing-library/react and jest. Run npm run test.

Contributing

See:

Package Status

This package is part of ongoing research at the University of Leeds, is provided “as is” and is likely to be changed without warning to meet the research needs of the University.

Citing TGVE

You can cit TGVE like:

@inproceedings {10.2312:evs.20231045,
booktitle = {EuroVis 2023 - Short Papers},
editor = {Hoellt, Thomas and Aigner, Wolfgang and Wang, Bei},
title = {{TGVE: a Tool for Analysis and Visualization of Geospatial Data}},
author = {Hama, Layik and Beecham, Roger and Lomax, Nik},
year = {2023},
publisher = {The Eurographics Association},
ISBN = {978-3-03868-219-6},
DOI = {10.2312/evs.20231045}
}

Funding

The project is led by Dr Nik Lomax and Dr Roger Beecham and funded by the EPSRC via The Alan Turing Institute's AI for Science and Government Programme, grant number EP/T001569/1.