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

Add: map marker cluster visualization #1203

Closed
wants to merge 27 commits into from
Closed

Add: map marker cluster visualization #1203

wants to merge 27 commits into from

Conversation

WesleyBatista
Copy link
Contributor

This pull request adds Leaflet.markercluster visualization, using ui-leaflet directive from angular-ui.

screenshot 2016-07-22 at 14 20 16

Known issues:

  • We have a limit of 10000 rows. To prevent the web browser to freeze building the points we don't let the script runs if the query results has more than 10k lines. Keep in mind that even with this limit your browser or the final user browser can freeze because it depends on the RAM memory available on the device used. A reasonable number on my tests was 5~6K :/
  • The screen to edit the visualization has UI/UX problems. Trying to provide a fully configurable visualization I exposed all the settings available. This led the UI to have options that doesn't make sense. Also, changing the values do not make them appear on the pre-visualization aside.

Screenshots

screenshot 2016-07-22 at 14 14 49
screenshot 2016-07-22 at 14 14 22
screenshot 2016-07-22 at 14 08 14
screenshot 2016-07-22 at 15 32 52

Mobile

screenshot 22 de julho de 2016 15-08

@@ -39,6 +39,9 @@
<script src="/bower_components/canvg/StackBlur.js"></script>
<script src="/bower_components/canvg/canvg.js"></script>
<script src="/bower_components/leaflet/dist/leaflet.js"></script>
<script src="/bower_components/angular-simple-logger/dist/angular-simple-logger.js"></script>
Copy link
Member

Choose a reason for hiding this comment

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

I think you forgot to remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a dependency from angular-ui/ui-leaflet :/

@arikfr
Copy link
Member

arikfr commented Jul 24, 2016

Thanks! Looking good and definitely will be useful.

The points limit is reasonable and it's good you put a "safe guard" in place.

The screen to edit the visualization has UI/UX problems. Trying to provide a fully configurable visualization I exposed all the settings available. This led the UI to have options that doesn't make sense.

I suggest to review the options and remove the ones that are less likely to be used. Also, let's split it into several tabs, like the charts visualization has. So the less common options won't confuse the "regular" user and be hidden in their own tab.

Also, changing the values do not make them appear on the pre-visualization aside.

That should be easy to fix, let's revisit it after implementing the tabs?

Btw, do you think it will be possible to merge this with the other map visualization?

@arikfr arikfr changed the title Marker Cluster visualization Add: map marker cluster visualization Jul 24, 2016
@WesleyBatista
Copy link
Contributor Author

I will try to implement the tabs and remove some options until tomorrow and send the changes.

@WesleyBatista
Copy link
Contributor Author

Regarding merging with the nowadays solution I think that is a good idea and it was a thing that I was intended to do on the conception.
But I found a little bit tricky since the map visualization is currently using the Leaflet library directly on the visualization code to implement it, and my solution takes the angular-ui's directive.

@WesleyBatista
Copy link
Contributor Author

I think it is possible to merge (and for sure I do like to help on this), but for now maybe it would be better to do this later in another PR.
Do you agree?

@WesleyBatista
Copy link
Contributor Author

@arikfr, can you help me with the options to be updated on the pre-visualization?
It is something with the $scope.$watch. I am getting an infinite loop :/

@arikfr
Copy link
Member

arikfr commented Jul 27, 2016

can you help me with the options to be updated on the pre-visualization? It is something with the $scope.$watch. I am getting an infinite loop :/

Sure I'll give it a look.

Wesley Batista and others added 21 commits August 15, 2016 15:21
Currently limiting the number of points to 6K.
This is to do not freeze the machine due to a kind of memory leak.
Take a look at: angular-ui/ui-leaflet#19
- change the 'renderTemplate';
- add more options to 'defaultOptions';
- add a set of baselayers options found on [here](https://leaflet-extras.github.io/leaflet-providers/preview/);
- ability to set the marker text using a column 'msg' on query;
- remove the comments from 'defaultOptions'
- log a message if the points exceeds 10k
- remove the sample data and get the configs from visualization obj
- breakdown the tag for readability
- get the lat/lon columns from the visualization configs
- add 'descColName' option to visualization configs
- Organize options in tabs
- Remove the width option
@WesleyBatista
Copy link
Contributor Author

@arikfr, I was thinking about do not call the type of this visualization 'MAP_MARKERCLUSTER'.
What do you think about something more general like 'MAP_PLOT', 'MAP_VIZ'... I don't know. But call it something more general and start a smoothly migration from the old to this new one.

Prefer HTTPS instead of SSH protocol
@zlu
Copy link

zlu commented Aug 16, 2016

+1

Wesley Batista added 5 commits August 16, 2016 18:08
Update markercluster.js
- Add default values for 'chunked' options
- Fix the https issue requesting the tiles

Update markercluster_editor.html
- Add tooltip helpers
- Remove link to github source projects READMEs
@arikfr
Copy link
Member

arikfr commented Sep 5, 2016

I finally had the time to look into it:

Also, changing the values do not make them appear on the pre-visualization aside.

There are two issues here:

  1. You are changing the Scope's visualization object to be the visualization.options object, hence breaking the reference in the height setting.
  2. It seems that this directive doesn't support changing options after rendering: it applies the defaults options at the link stage of the controller, which is being run only once.

While reviewing their code, it looks like 5K LOC that have built in support for many Leaflet's plugins. Including duplicate plugins: like support for 5 different icons plugins, that do pretty much the same thing.

The lack of support for "live preview", redundant code and other factors lead me to think of dropping angular-ui-leaflet and keep using Leaflet directly. If you don't mind, I would like to take a stab at implementing the Marker Cluster functionality directly on Leaflet (along with refactoring the current map visualization). OK?

@arikfr
Copy link
Member

arikfr commented Sep 22, 2016

As discussed with @WesleyBatista, I'm closing this in favor of #1292, where I implement clustering using Leaflet.markersCluster directly instead of this Angular wrapper. The main reason being that the wrapper doesn't support some features we need (like live preview).

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.

3 participants