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

Remove google maps, use OpenStreetMap instead #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yankee42
Copy link
Contributor

@yankee42 yankee42 commented Dec 8, 2020

In the triplog and also on the dashboard for last known position the map is not directly shown. There is a "why?" link which says:

[..]displaying the map costs also real money for me as a developer.[..]

That's strange... OpenStreetMap is free and... at least in my opinion also clearly superior to Google Maps. You can't find that this bad, because in the Android-App it is already OpenStreetMap. Why not use it on the Web UI as well?

Here is a PR to replace Google Maps with OSM. It's work in progress however. I have a problem with the Map not initially drawing. As soon as I resize the browser window a tiny bit, the map comes up fine. Why? I have never worked with vue, so in case it has to do with something that Vue does I wouldn't know. (For that matter, the last time I coded plain JavaScript or used OpenLayers is many years ago...). So maybe another pair of eyes can see what I cannot see?

BTW: A little confusing: Some files are indented with 4 spaces, others with 2 spaces. I didn't really know what to do...

I also added some typedefs for the Log. I get totally lost without automatic code completion ;-). However some values seem to be always null for me. Maybe you got some improvements there.

return feature;
}

export default EvNotifyMap;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'export' is only available in ES6 (use 'esversion: 6').


function createMarker(coordinates, src) {
const feature = new Feature({geometry: new Point(coordinates)});
feature.setStyle(new Style({image: new Icon({src, anchor: [0.5, 1]})}));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

};

function createMarker(coordinates, src) {
const feature = new Feature({geometry: new Point(coordinates)});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

})
}));
this.map.on('click', event => {
this.map.forEachFeatureAtPixel(event.pixel, feature => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

features: [marker]
})
}));
this.map.on('click', event => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

const start = createMarker(coordinates[0], require('../assets/marker-start.svg'));
const end = createMarker(coordinates[coordinates.length - 1], require('../assets/marker-finish.svg'));
const pathDrivenLineString = new LineString(coordinates);
const pathDrivenFeature = new Feature({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).


const start = createMarker(coordinates[0], require('../assets/marker-start.svg'));
const end = createMarker(coordinates[coordinates.length - 1], require('../assets/marker-finish.svg'));
const pathDrivenLineString = new LineString(coordinates);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

.map(value => fromLonLat([value.longitude, value.latitude]));

const start = createMarker(coordinates[0], require('../assets/marker-start.svg'));
const end = createMarker(coordinates[coordinates.length - 1], require('../assets/marker-finish.svg'));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

.filter(value => value.longitude != null && value.latitude != null)
.map(value => fromLonLat([value.longitude, value.latitude]));

const start = createMarker(coordinates[0], require('../assets/marker-start.svg'));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

EvNotifyMap.prototype.addLog = function (log) {
const coordinates = log.stats
.filter(value => value.longitude != null && value.latitude != null)
.map(value => fromLonLat([value.longitude, value.latitude]));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

Popup.prototype.show = function (heading, contentHtml, feature) {
this.headingElement.innerText = heading;
this.bodyElement.innerHTML = contentHtml;
const extent = feature.getGeometry().getExtent();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

});
});

this.bodyElement = element(root, 'div', body => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').


element(head, 'a', closeElement => {
closeElement.setAttribute('href', 'javascript:void(0)');
closeElement.addEventListener('click', () => this.hide());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

this.headingElement = element(head, 'h1');

element(head, 'a', closeElement => {
closeElement.setAttribute('href', 'javascript:void(0)');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script URL.

head.setAttribute('class', 'map-popup-head');
this.headingElement = element(head, 'h1');

element(head, 'a', closeElement => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

import VectorSource from 'ol/source/Vector';
import Point from 'ol/geom/Point';
import {Icon, Style, Stroke} from 'ol/style';
import MomentJS from 'moment';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

import Feature from 'ol/Feature';
import VectorSource from 'ol/source/Vector';
import Point from 'ol/geom/Point';
import {Icon, Style, Stroke} from 'ol/style';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

import VectorLayer from 'ol/layer/Vector';
import Feature from 'ol/Feature';
import VectorSource from 'ol/source/Vector';
import Point from 'ol/geom/Point';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

import LineString from 'ol/geom/LineString';
import VectorLayer from 'ol/layer/Vector';
import Feature from 'ol/Feature';
import VectorSource from 'ol/source/Vector';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

import OSM from 'ol/source/OSM';
import LineString from 'ol/geom/LineString';
import VectorLayer from 'ol/layer/Vector';
import Feature from 'ol/Feature';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant