IsraelHikingMap / Site

Israel Hiking Map has maps, route planning, and travel information for Israel. This repository holds the files needed for running the Israel Hiking Map site and apps.
https://israelhiking.osm.org.il/
Other
80 stars 32 forks source link

Support map rotation #669

Closed HarelM closed 5 years ago

HarelM commented 6 years ago

Feature

A list of things still to rewrite due to Openlayers migration:

Critical:

Need to test when a release candidate is available:

Might not implement:

HarelM commented 6 years ago

Steps that needs to be done in order to test the branch:

  1. npm install https://github.com/va2ron1/Leaflet
  2. go to node_module/leaflet and remove module line from package.json
  3. go to dist/leaflet-src.js and add the following code below // misc:
    
    var oldL = window.L;
    function noConflict() {
    window.L = oldL;
    return this;
    }

// Always export us to window global (see #2364) window.L = exports;

in `base-poi-marker.layer.ts`:
```js
import { MarkerClusterGroup } from "leaflet.markercluster";`
...
protected markers: MarkerClusterGroup;
...
this.markers = new MarkerClusterGroup({
JasonRodman commented 6 years ago

Any updates on this feature? The ability to rotate the map is a must for me to be able to adopt Leaflet in my project. I went thru a full implementation before I realized it did not support it.

HarelM commented 6 years ago

@JasonRodman I'm not a leaflet maintainer. you should probably post your concerns in the following issues: Leaflet/Leaflet#268 va2ron1/Leaflet#5 Judging by how it has progressed so far if this is a must for you I would try and use a different library. I'm looking into openlayers and angular-cesium right now to see if I can migrate this project.

HarelM commented 6 years ago

Another approach to rotate would be rotate and 3D to be able to better see how the landscape looks. A short POC I'm working on is using angular-cesium: It has the ability to show 2D and 3D maps. to rotate the view and has full support to angular which is good. This will require a very big UI change and I'm not sure it's needed. Never-the-less, it's fun playing with it. image Kinneret with IHM map in 3D.

HarelM commented 6 years ago

While the above is somewhat nice the 3D effect of the map does not give the right perspective IMO, the terrain in not giving the effect I was hoping for and therefore the only lightweight option right now is openlayers.

zstadler commented 6 years ago

See also TileLayer.GL

HarelM commented 6 years ago

Thanks for the link! However, I'm not sure how to use the TileLayer.GL to do the rotation... :-/ I've read some of the docs and some instruction on webGL but I can't figure it out, I'm also concerned that the rotation will happen on every tile separately and so there will be a lot of code to write in order for this to work properly, and it won't work for the esri layers. Bottom line, I'm not sure this is the right approach, I tend to go with an exiting solution - i.e. openlayers...

valleyofdawn commented 6 years ago

This is important for the navigation abilities of the app. It's much easier to decide on turns when the map faces with the direction of movement up. I suggest moving the priority to medium or high.

HarelM commented 5 years ago

Html icons: https://gis.stackexchange.com/questions/253194/create-marker-icon-based-on-html-code-for-openlayers

This seems like a unneeded complexity. The solution is probably to generate image icons for all of the needed marker icons.

HarelM commented 5 years ago

Since we are migrating out of leaflet, there's a need to define the look and feel of the on screen buttons. To align this with the rest of the app I'll be using Material design buttons, with not margins (Ignore the blue tint to some of the buttons, it will be fixed once leaflet style is completely gone): image

zstadler commented 5 years ago

One of the original requirements was

  • To be able to clear rotation and point it north.

There is a need for button to switch between map rotation and north up.

Perhaps a diagonal arrow ( or ) can indicate map rotation, and a vertical, compass-like arrow would indicate a north-up mode ( )

follow_arrow.svg.zip follow_arrow2.svg.zip north_up.svg.zip

HarelM commented 5 years ago

Good point, thanks for reminding me. I'll add it below the location after the entire migrating will be done.

zstadler commented 5 years ago

As a user, I would like to be able to rotate the map manually. For example, when not moving or when the GPS is inactive. Therefore, I think the map orientation button needs to be available at all times and probably not grouped with the GPS icon (unlike the record button).

HarelM commented 5 years ago

Of course, I just said where it will be...

valleyofdawn commented 5 years ago

Another option is for the current location arrow itself to be pressable. Pressing on it will move from direction up to north up.

zstadler commented 5 years ago

What do you mean by "current location arrow"? The GPS activation button? The current location icon on the map?

In any case, canceling manual map rotation is needed even when there is no "current location".

HarelM commented 5 years ago

Pointer event are very unfriendly... :-/ seems like the rewriting of the route editing in openlayer will take longer than expected: here's a short solution to private POI drag while allowing the map to pan when not dragging a private POI: https://stackblitz.com/edit/angular-ngx-openlayers-pointer-drag-and-pan?file=src/app/map/map.component.ts

HarelM commented 5 years ago

Clustering in ngx-openlayers is very slow: One option is to use supercluster by mapbox: https://github.com/mapbox/supercluster Here's an example that uses openlayers. this means the entire interaction with the cluster https://github.com/openlayers/openlayers/pull/5848/commits/ed2ed006f67b8fc428a193192575a5f7e2445953 Another option it to do if from the code behind and not use ngx-openlayers as there's a problem with the style anyway...

HarelM commented 5 years ago

Dropping support for esri features layers for now. There's a lot of work involved in adding them back to openlayers as far as I understand... MapServer will only support using tile/{z}/{y}/{x} for now.

zstadler commented 5 years ago

Please remember to remove the standard OSM map that hides under the selected base map.

HarelM commented 5 years ago

Since I'm not planning or reverting all this work I'll just merge this to master and split all the remaining work to separate issues.