Skip to content

Commit

Permalink
Merge pull request #11 from CodeForAfrica/fix/update-map-tiles
Browse files Browse the repository at this point in the history
Fix map tiles
  • Loading branch information
nerdlet committed Aug 12, 2020
2 parents 8cdc0de + f5dc4b6 commit b448be2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
71 changes: 57 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,83 @@
# sensors.AFRICA-AQ-map-v2
A new version of air quality map for the Luftdaten.
You can find a here a [Live Version](https://maps.luftdaten.info/).

## Goals and ideas
* visualise recent sensor data on a map
* switch between sensor data (PM2.5, PM10, humidity data, ...)
* visualization between Air Quality Index (AQI) and normal default levels
* identify and add existing air quality data from external sources

### Map application
The implementation makes use of various frameworks and is on [ECMA 6](https://developer.mozilla.org/de/docs/Web/JavaScript) language level. Used frameworks are:
# Sensor.Community Map
visualize recent sensor data on a world map for [Sensor.Community](https://sensor.community).

👉 [Live Version](https://maps.sensor.community/).

# Map application
The implementation makes use of various frameworks and is on [ECMA 6](https://developer.mozilla.org/de/docs/Web/JavaScript) language level.

Used frameworks are:
* [leaflet](http://leafletjs.com/) (mapping framework)
* [d3](https://d3js.org/) (visualisation framework)
* [webpack](https://webpack.github.io/) is used for deployment

## How to run
# How to run
### Installation
Requirements:
* [Node JS](https://nodejs.org/) 10.15.x or higher
* NPM should be version 6.9.x or higher

install all dependencies

```
cp src/js/config.js.dist src/js/config.js
npm install
```

### Develop
start development server (http://127.0.0.1:8080/)

```
npm start
```

### Publish
build all files needed to run on a webserver, files willl be compileed into `dist/`):
build all files needed to run on a webserver, files will be compiled into `dist/`):

```
npm run build
npm run ghpages
```

# Translation

The translation file can be found in `src/js/translation.js`.

To add a new translated word or sentence, add below the key (see below) a new _key-value pair_.
The nested key should start with the iso-code of the language followed by the translated world.
You can find the iso-code on [wikipedia table (639-1)](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).

```javascript
"(Sensor)": { // key - original english translation
"de": "Sensor", // nested key - value pair
"fr": "Détecteur" // add new translation "iso-code": "translated word"
},
"PM10 µg/m³": {},
"PM2.5 µg/m³": {},
"AQI US": {},
"Temperature °C": { // key - original english translation
"de": "Temperatur °C",
"fr": "Température °C" // add new translation "iso-code": "translated word"
},...
```

⚠ Don't forget to add the comma in the previous _key - value pair_ else syntax is broken.

If you don't have a Github account download the file `src/js/translation.js` via the `Raw` button directly right
over the source code. Send us your file with the translation to "tech (at) sensor.community".

## URL-Parameter

### Sensor
valid sensor parameters PM25, PM10, Pressure, Noise, Humidity & Official_AQI_US
http://127.0.0.1:8080/?sensor=Noise

### Location

valid parameters zoom level, lat and long
http://127.0.0.1:8080/#9/48.8123/9.2487

### combine parameters

first start with sensor then location
http://127.0.0.1:8080/?sensor=Noise#9/48.8123/9.2487
2 changes: 1 addition & 1 deletion src/js/config.js.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module.exports = {
// phenomenon shown at start, possible values: PM10, PM25, Official_AQI_US, Temperature, Humidity, Pressure
"selection": "PM10",
// Tiles
"tiles": "https://maps.luftdaten.info/tiles/{z}/{x}/{y}.png",
"tiles": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
"attribution": "Map data © <a href='https://openstreetmap.org'>OpenStreetMap</a> contributors"
}

0 comments on commit b448be2

Please sign in to comment.