Commit c900fb3b authored by Christine Plumejeaud's avatar Christine Plumejeaud
Browse files

First commit of asset of Mélissa code

parent f1a76005
HOWTO
Utiliser ce projet pour faire une carte interactive avec OpenLayers et des graphiques interactifs avec d3.js et nvd3 comme composants de REACT
- [1. Installation](#1-installation)
- [1.1. Dezipper](#11-dezipper)
- [1.2. WITH NPM](#12-with-npm)
- [1.2.1. Installer node et npm](#121-installer-node-et-npm)
- [1.2.2. Installer les dépendances pour la compilation](#122-installer-les-dépendances-pour-la-compilation)
- [1.2.2.1. ndv3 et d3](#1221-ndv3-et-d3)
- [1.2.3. Builder](#123-builder)
- [1.2.4. Tester en local](#124-tester-en-local)
- [2. Debug](#2-debug)
- [2.1. OL](#21-ol)
- [2.1.1. ne pas monter deux fois la carte](#211-ne-pas-monter-deux-fois-la-carte)
- [Flux4 à tester aussi](#flux4-à-tester-aussi)
- [3. Ressources Web](#3-ressources-web)
- [3.1. Pour webpack et la config du build](#31-pour-webpack-et-la-config-du-build)
- [3.2. UI](#32-ui)
- [3.3. Javascript](#33-javascript)
- [3.4. REACT](#34-react)
- [3.5. REACT Avec D3.js](#35-react-avec-d3js)
- [3.6. Pour OpenLayers](#36-pour-openlayers)
- [3.7. Bootstrap](#37-bootstrap)
- [3.8. Opensource ou free software (logiciel libre)](#38-opensource-ou-free-software-logiciel-libre)
- [3.9. Suite](#39-suite)
# 1. Installation
## 1.1. Dezipper
dézipper le fichier layer_v2
lancer CMD dans Windows et se placer dans le répertoire dézippé :
`cd C:\yourpath\...\layer_v2`
## 1.2. WITH NPM
### 1.2.1. Installer node et npm
`node -v`
v12.14.1
`npm -v`
6.13.4
Mettre à jour npm :
`npm install -g npm`
### 1.2.2. Installer les dépendances pour la compilation
Elles sont données dans le fichier package.json
```js
"dependencies": {
"colormap": "^2.3.1",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"html-webpack-plugin": "^4.0.1",
"ol": "^6.2.1",
"ol-ext": "^3.1.11",
"ol-hashed": "^2.0.0",
"ol-layerswitcher": "^3.5.0",
"style-loader": "^1.1.3",
"webpack": "^4.42.1",
"webpack-dev-server": "^3.10.3"
},
"devDependencies": {
"parcel-bundler": "^1.12.4",
"webpack-cli": "^3.3.11"
}
```
Donc il faut les installer une par une :
`npm install ol`
`npm install --save-dev parcel-bundler`
`npm install webpack`
etc.
npm install react-proxy-loader --save-dev
`npm install react-scripts`
```
npm install react-scripts
npm install --save i18next
npm install --save react-i18next
npm install react-i18next@legacy i18next --save
npm install react react-dom
npm install d3v3
```
#### 1.2.2.1. ndv3 et d3
Ne pas faire `npm install d3v4`
NVD3 is recommended to go with d3.js version 3.5.3 and later, but NOT d3 4.x yet. f(layerswitcher et barchart)
- https://www.npmjs.com/package/nvd3
- https://github.com/novus/nvd3/issues/1582
npm load d3 before nvd3
npm uninstall webpack-dev-server
npm uninstall webpack-cli
npm uninstall d3v4
/*"webpack-dev-server": "^3.10.3"*/
/*"webpack-cli": "^3.3.11"*/
npm install d3v4@3.4.4
"d3v4": "^3.4.4",
No matching version found for d3v4@^3.4.4.
npm list
```
npm ERR! peer dep missing: hammerjs@^2.0.0, required by @progress/kendo-react-charts@3.13.0
npm ERR! peer dep missing: popper.js@^1.16.0, required by bootstrap@4.4.1
npm ERR! peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1
npm ERR! peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1
```
### 1.2.3. Builder
Grâce à **webpack.config.js**, le build prépare un fichier **layerswitcher.bundle.js** qui sera le point d'entrée de l'application et contiendra aussi les fichiers de styles ol.css importés via la page **layerswitcher.js**.
```js
//entête de layerswitcher.js
import css from './layerswitcher.css';
import './ol-layerswitcher.css';
import 'ol/ol.css';
```
Il copie aussi les fichiers de données dans data, et indique que la page HTML sera layerswitcher.html
```js
//dans webpack.config.js
new HtmlPlugin({
title:'Alphaportic - openlayers part',
filename:'layerswitcher.html',
template: 'src/layerswitcher.html'
})
```
La commande à lancer :
`npm run build`
```sh
Hash: 81312c6954da91df64cc
Version: webpack 4.42.1
Time: 4666ms
Built at: 2020-03-24 17:31:31
Asset Size Chunks Chunk Names
data/ports.json 514 KiB [emitted] [big]
data/portsref.geojson 642 KiB [emitted] [big]
layerswitcher.bundle.js 328 KiB 0 [emitted] [big] main
layerswitcher.bundle.js.map 1.84 MiB 0 [emitted] [dev] main
layerswitcher.html 1.12 KiB [emitted]
Entrypoint main [big] = layerswitcher.bundle.js layerswitcher.bundle.js.map
[35] ./src/layerswitcher.css 569 bytes {0} [built]
[36] ./node_modules/css-loader/dist/cjs.js!./src/layerswitcher.css 1.55 KiB {0} [built]
[37] ./src/ol-layerswitcher.css 572 bytes {0} [built]
[38] ./node_modules/css-loader/dist/cjs.js!./src/ol-layerswitcher.css 4.45 KiB {0} [built]
[42] ./src/layerswitcher.js + 177 modules 1.23 MiB {0} [built]
| ./src/layerswitcher.js 18.7 KiB [built]
| + 177 hidden modules
+ 150 hidden modules
```
### 1.2.4. Tester en local
`npm start`
http://localhost:3000/layerswitcher.html
# 2. Debug
## 2.1. OL
src\Components\OL\layerswitcher.js
### 2.1.1. ne pas monter deux fois la carte
l 281 src\Components\OL\layerswitcher.js
Dans readAndStoreDataPerPort()
//that.componentDidMount();
### Flux4 à tester aussi
l 510
var flux4 = this.props.t("menu.flux4"); //All
l 705
```js
if (flow.localeCompare(flux0) === 0 | flow.localeCompare(flux4) === 0 ){
portstyle = new Style({
image: new Circle({
radius: getSize(feature),
fill: new Fill({ color: symbolfillcolor }),
stroke: new Stroke({ color: "#000000" }),
}),
geometry: function (feature) {
return feature.getGeometry();
},
});
```
Il manquait un port par défaut dans le niveau store :
l15 src\store\reducer.js
```js
idport: MAP.DEFAULT_PORT, //identifiant du port analysé
```
---
# 3. Ressources Web
## 3.1. Pour webpack et la config du build
- https://webpack.js.org/concepts/configuration#using-other-configuration-languages
- https://webpack.js.org/concepts/configuration/#simple-configuration
package.json :
- https://flaviocopes.com/package-json/
Node
- https://60devs.com/npm-install-specific-version.html
- https://www.sitepoint.com/beginners-guide-node-package-manager/
-
## 3.2. UI
- http://glossaire.infowebmaster.fr/breadcrumb/
- https://goodui.org/
**Material-ui**
- https://medium.com/creative-tims-blog/12-absolute-principles-of-material-design-2ce7cc98d615
- https://github.com/mui-org/material-ui
**Envato design**
- https://tutsplus.com/?utm_source=forums&utm_medium=promos&utm_campaign=tuts_forums-headernav_our_products&utm_content=headernav&_ga=2.230974495.100481333.1585482204-507835756.1585482204
- https://webdesign.tutsplus.com/categories/ui-design?_ga=2.189228075.100481333.1585482204-507835756.1585482204
- https://webdesign.tutsplus.com/
## 3.3. Javascript
- https://code.jquery.com/
- https://getbootstrap.com/docs/4.1/layout/grid/
- http://www.webweaver.nu/html-tips/favicon.shtml
- http://bl.ocks.org/mbostock/9535021
- https://bl.ocks.org/iamkevinv/0a24e9126cd2fa6b283c6f2d774b69a2
- https://putaindecode.io/fr/articles/js/es2015/const-let-var/
**Autocompletion**
- https://openclassrooms.com/fr/courses/510018-decouvrez-la-puissance-de-jquery-ui/510016-lautocompletion
**Free photos stock**
- https://stocksnap.io/
**Colors**
- https://medium.com/creative-tims-blog/practical-color-generators-for-webmasters-a47248ffda9a
- http://paletton.com/#uid=1000u0kllllaFw0g0qFqFg0w0aF
favicon :
- http://favicon.htmlkit.com/favicon/
**font**
```html
<div>Font made from <a href="http://www.onlinewebfonts.com">oNline Web Fonts</a>is licensed by CC BY 3.0</div>
```
- https://www.onlinewebfonts.com/download/1a045963159927274c92b0444fb83c17
**geojson**
- https://blog.mastermaps.com/2012/11/how-to-minify-geojson-files.html
- https://mapshaper.org/
- https://makina-corpus.com/blog/metier/2014/reduire-le-poids-dun-geojson
- https://blog.mastermaps.com/2012/11/how-to-minify-geojson-files.html
**CORS**
**https://stackoverflow.com/questions/43262121/trying-to-use-fetch-and-pass-in-mode-no-cors**
**JSON**
- https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/JSON/stringify
## 3.4. REACT
- https://fr.reactjs.org/docs/forwarding-refs.html
- https://towardsdatascience.com/passing-data-between-react-components-parent-children-siblings-a64f89e24ecf
- https://stackoverflow.com/questions/54314945/reactjs-how-to-use-ref-inside-map-function
- **https://developer.okta.com/blog/2018/12/20/crud-app-with-python-flask-react**
- https://medium.com/code-divoire/cr%C3%A9ation-dune-application-web-avec-python-et-react-partie-1-backend-b5efb8a6a0c5
-
## 3.5. REACT Avec D3.js
- https://medium.com/@Elijah_Meeks/interactive-applications-with-react-d3-f76f7b3ebc71
- https://www.freecodecamp.org/news/how-to-get-started-with-d3-and-react-c7da74a5bd9f/
- https://github.com/novus/nvd3/issues/1582#issuecomment-209690887
- https://codesandbox.io/s/3y4qyno486?file=/src/index.js:637-651
- https://github.com/d3/d3/wiki#linear
- https://nvd3-community.github.io/nvd3/examples/documentation.html#multiBarChart
- https://www.d3indepth.com/scales/
- https://www.npmjs.com/package/nvd3
- https://github.com/NuCivic/react-nvd3
- https://github.com/novus/nvd3/blob/master/examples/documentation.html
- https://aspenmesh.io/using-d3-in-react-a-pattern-for-using-data-visualization-at-scale/
- https://github.com/novus/nvd3/issues/1219
- https://www.youtube.com/watch?v=5FEzELkLsYw
- https://medium.com/@PepsRyuu/why-i-no-longer-use-d3-js-b8288f306c9a
## 3.6. Pour OpenLayers
- https://github.com/openlayers/workshop/releases
- https://openlayers.org/en/latest/doc/tutorials/bundle.html
- https://openlayers.org/workshop/fr/
- https://openlayers.org/workshop/en/deploying/
- https://openlayers.org/en/latest/apidoc/module-ol_layer_Layer-Layer.html#getZIndex
- https://openlayers.org/workshop/fr/vector/style-intro.html
- https://openlayers.org/en/latest/examples/vector-labels.html
- https://maputnik.github.io/editor/#6.96/46.111/-0.107
- https://openlayers.org/en/latest/examples/polygon-styles.html
- https://openlayers.org/en/latest/examples/icon.html
- https://openlayers.org/workshop/fr/basics/resources.html
- **https://openlayers.org/en/latest/apidoc/**
**LayerSwitcher** en particulier
- https://openlayers.org/3rd-party/
- https://openlayers.org/en/latest/apidoc/module-ol_layer_Layer-Layer.html#getZIndex
- http://dev.openlayers.org/docs/files/OpenLayers/Control/LayerSwitcher-js.html
- http://raw.githack.com/walkermatt/ol-layerswitcher/master/examples/select-groups.html
- https://openlayers.org/workshop/fr/controls/modify.html
- http://dev.openlayers.org/examples/click.html
- https://gis.stackexchange.com/questions/252946/what-are-the-possible-listeners-and-event-types-for-an-openlayers-map-ol-map
- https://gis.stackexchange.com/questions/346098/openlayers-6-1-1-add-layer-to-existing-layer-group-in-ol-layerswitcher
- https://openlayers.org/en/master/examples/custom-controls.html
- https://geoservices.ign.fr/documentation/exemples/ol-control-layerSwitcher.html
- **https://github.com/walkermatt/ol-layerswitcher**
- **http://raw.githack.com/walkermatt/ol-layerswitcher/master/examples/select-groups.js**
**OL avec react**
- https://github.com/allenhwkim/react-openlayers/issues/43
- https://dominoc925.blogspot.com/2019/10/simple-example-of-reactjs-and.html
- https://taylor.callsen.me/using-reactflux-with-openlayers-3-and-other-third-party-libraries/
- **https://stackoverflow.com/questions/52216011/cant-display-a-vertor-layer-using-openlayer-in-react**
- https://stackoverflow.com/questions/31758081/loading-json-data-from-local-file-into-react-js
## 3.7. Bootstrap
- https://startbootstrap.com/bootstrap-resources/
- https://www.tutorialrepublic.com/twitter-bootstrap-tutorial/
- https://medium.com/creative-tims-blog/working-on-the-best-bootstrap-resources-44791f0e18f8
Boostrap or Foundation ?
- https://blog.teamtreehouse.com/use-bootstrap-or-foundation
Bootstrap Bay
- https://bootstrapbay.com/?irgwc=1
- https://bootstrapbay.com/theme/datta-able-free-reactjs-admin-dashboard-template-BFD950F
- http://lite.codedthemes.com/datta-able/react/default/dashboard/default
- http://lite.codedthemes.com
- https://bootstrapbay.com/theme/adminkit-web-ui-kit-dashboard-template-B69F880
- https://demo.adminkit.io/tables-bootstrap.html
Creative Tim
- https://www.creative-tim.com/product/get-shit-done-kit
- https://www.creative-tim.com/templates/free
## 3.8. Opensource ou free software (logiciel libre)
- https://siecledigital.fr/2019/10/28/3-mythes-open-source/
- https://www.gnu.org/philosophy/open-source-misses-the-point.fr.html
- https://www.scamadviser.com/check-website/bootstrapbay.com
Sitejabber, Resellerrating and Trustpilot
## 3.9. Suite
Laboratoire L3i, Université de La Rochelle, La Rochelle, France
https://github.com/LinkedPasts/linked-places
\ No newline at end of file
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
This diff is collapsed.
{
"name": "alphaportic",
"version": "0.1.0",
"private": true,
"homepage": "alpha.portic.fr/porticviz",
"description": "Visualization of uncertain data speaking about Modern maritim flows",
"main": "porticviz.html",
"dependencies": {
"@progress/kendo-drawing": "^1.6.0",
"@progress/kendo-file-saver": "^1.0.7",
"@progress/kendo-react-charts": "^3.13.0",
"@progress/kendo-react-intl": "^3.13.0",
"bootstrap": "^4.4.1",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"d3": "^5.16.0",
"d3v3": "^1.0.3",
"font-awesome": "^4.7.0",
"google-maps-react": "^2.0.2",
"html-to-image": "^0.1.1",
"html-webpack-plugin": "^4.0.3",
"i18next": "^19.4.4",
"jquery": "^3.5.1",
"mkdirp": "^1.0.3",
"node-sass": "^4.14.1",
"nvd3": "^1.8.6",
"ol": "^6.2.1",
"ol-ext": "^3.1.11",
"ol-hashed": "^2.0.0",
"ol-layerswitcher": "^3.5.0",
"plotly.js": "^1.54.1",
"plotly.js-basic-dist": "^1.54.1",
"plotly.js-dist": "^1.54.1",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-autocomplete": "^1.8.1",
"react-bootstrap": "^1.0.0",
"react-collapsible": "^2.7.0",
"react-dom": "^16.13.1",
"react-full-screen": "^0.2.4",
"react-i18next": "^9.0.10",
"react-loadable": "^5.5.0",
"react-nvd3": "^0.5.7",
"react-perfect-scrollbar": "^1.5.8",
"react-plotly.js": "^2.4.0",
"react-redux": "^6.0.1",
"react-reveal": "^1.2.2",
"react-router-dom": "^4.3.1",
"react-window-size": "^1.2.2",
"redux": "^4.0.5",
"style-loader": "^1.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"parcel-bundler": "^1.12.4",
"react-proxy-loader": "^0.3.5",
"react-scripts": "^3.4.1",
"react-to-print": "^2.6.3"
}
}
@charset "UTF-8";
@font-face {
font-family: "pct";
src:url("fonts/pct.eot");
src:url("fonts/pct.eot?#iefix") format("embedded-opentype"),
url("fonts/pct.woff") format("woff"),
url("fonts/pct.ttf") format("truetype"),
url("fonts/pct.svg#pct") format("svg");
font-weight: normal;
font-style: normal;
}
[data-icon]:before {
font-family: "pct" !important;
content: attr(data-icon);
font-style: normal !important;
font-weight: normal !important;
font-variant: normal !important;
text-transform: none !important;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
[class^="pct-"]:before,
[class*=" pct-"]:before {
font-family: "pct" !important;
font-style: normal !important;
font-weight: normal !important;
font-variant: normal !important;
text-transform: none !important;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.pct-arrow1:before {
content: "\61";
}
.pct-arrow2:before {
content: "\62";
}
.pct-arrow3:before {
content: "\63";
}
.pct-arrow4:before {
content: "\64";
}
.pct-chat1:before {
content: "\65";
}
.pct-chat2:before {
content: "\66";
}
.pct-chat3:before {
content: "\67";
}
.pct-chat4:before {
content: "\68";
}
.pct-loader1:before {
content: "\69";
}
.pct-arrow-sharp1:before {
content: "\6a";
}
.pct-arrow-sharp2:before {
content: "\6b";
}
.pct-arrow-sharp3:before {
content: "\6c";
}
.pct-arrow-sharp4:before {