ushahidi / platform

Ushahidi Platform API version 3+
http://ushahidi.com
Other
680 stars 506 forks source link

Mapping exploration #2309

Closed rjmackay closed 6 years ago

rjmackay commented 6 years ago

Timebox: 1 day

rowasc commented 6 years ago

some thoughts about this while I get started Server side render/image creation

Client side: If we go for client side solutions we are basically killing the mobile users and users with slow connections I think, but at the same time it's probably not our target audience for deployment organizations .

rowasc commented 6 years ago

just some more notes to myself

Client side: If we go for client side solutions we are basically killing the mobile users and users with slow connections I think, but at the same time it's probably not our target audience for deployment organizations .

I need to run more tests and experiment some more, but from some quick tests I run today it looks like definitely mobile users will be negatively affected by a live version of ~5maps. I will be working on figuring this out today.

On the other hand, loading ~5 maps in desktop apparently is OK, fast even. It's a bit slow to render the new tiles on the map, which I'll test today to report back, but that is not really something specific to having multiple maps per view

rowasc commented 6 years ago

https://docs.google.com/a/ushahidi.com/document/d/1oNiYzKnAEBqMfASrWjZt8CvUfU_PYpPc83kK_AZs92g/edit?disco=AAAABdJ88Fs

Link to conversation here where we are trying to figure out the requirements a bit more

rowasc commented 6 years ago

This is the repo , for the curious https://github.com/ushahidi/meatloaf_experimental_maps Since the timebox is gone, here is what I found out

The real fun and improvement starts when we use a web worker to offload the server requests and send back a message to the main thread to render the map as we get each deployment. This makes for a much better user experience and has the result of lowering the first meaningful paint to sub 2s times. For browser compatibility there are some polyfills that make this usable beyond the modern browsers, so it should be OK for the target audience of the dashboard.
The one thing that would make a massive difference would be if we were ablet o do L.geojson in webworkers. This is not possible right now due to leaflet. I think there are big perf gains to be had with mapbox gl, but I didn't get to play with it yet.

TLDR: web workers are awesome and improve the user experience we can provide. MapboxGL would be a good 2hs timeboxed experiment to run and report back. If If I get some time during the weekend I will make a quick test with mapbox too

rowasc commented 6 years ago

Something else I discovered while doing the mapping experiments: we might need the bring the config for each deployment too, since that's where the map configurations live (mark cluster size being the most important I think)

rowasc commented 6 years ago

@jshorland @justinscherer We're wondering if for the use case of maps in the organization projects panel we have a specific target of browsers in mind. To make it as performant as possible, we need to use newer technologies, web workers and MapBoxGL JS (preferred). Both work best (or at all) in modern browsers, think evergreen browsers in general and relatively new iPhone/Android devices. As a reference: https://caniuse.com/#search=WebGL%20-%203D%20Canvas%20graphics https://caniuse.com/#feat=webworkers

I'm thinking that since this is mostly for enterprise users and not consumer oriented (right??) it would be possible to do this with new technologies like this, but we need your call on this.

justinscherer commented 6 years ago

Great question @rowasc

Is there an alternative that would have better low-end browser support with the same design?

How would those libraries behave on modern-ish browsers with a slow connection?

Is there a way to design the view to depricate for bad/old browsers? This could be a future enhancement, potentially.

justinscherer commented 6 years ago

Just a reminder. The map images only need to be thumbnails. They don't need to plan/zoom, etc.

rowasc commented 6 years ago

Is there an alternative that would have better low-end browser support with the same design?

How would those libraries behave on modern-ish browsers with a slow connection?

rjmackay commented 6 years ago

The map images only need to be thumbnails. They don't need to plan/zoom, etc.

@justinscherer the thing here is that either we still have to load a full mapping library (ie. leaflet/mapboxgl) to render the deployment data on the map, or we need to have a rendering pipeline that generates static 'thumbnail' style images. What I'm trying to get at: pan/zoom interactions aren't the costly things parts of load times. Its more getting the data onto the map.

While mapbox does have some tools for adding your own data, they're mostly targeted at static datasets not dynamic data ie. post in the platform. Carto has some more possibilities - rendering map tiles from tables of data, so we'd just have to figure out how to sync our data into Carto. But I don't that something we can do in the scope of this first build.

justinscherer commented 6 years ago

Ok, given all this, using WebGL and webworkers should be fine. We should do a few tests afterwards and reassess in a few months.

rowasc commented 6 years ago

@rjmackay not sure what to do with this ticket :| do I move it to review?

rjmackay commented 6 years ago

@rowasc write up conclusions on this ticket https://zube.io/ushahidi/platform/c/3945 so it can become the spec for how we build the map components.