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 node worldmap in explorer #238

Merged

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented Feb 21, 2022

Description

Working on issue #225

Implement first task :

  • Create an algorithm to transform a geographical patch into a x/y coordinates
  • Create the JavaScript component to display it on the node explorer

I noticed that some coordinates cannot compute a geo patch. For exemple when longitude is equal to -45, sdc and tdc are equal to 1 or -1 and then are not in range for the index_patch function

Test are just on 4 geo patch, but I tested all and it works fine (cannot test all in geo_patch_test cause compute_patch is private)

I'll work soon on second task to add map on the explorer, I think to use Leaflet to display the map

@Neylix Neylix changed the title Implement algorithm to retrieve coordinates Add node worldmap in explorer Feb 21, 2022
@ghost
Copy link

ghost commented Feb 21, 2022

For the UI, what do you think of:

Something more graphical should be great.
But however, thanks for the contribution 👍

@ghost ghost added feature New feature request external contribution UI Invole user interface labels Feb 22, 2022
@Neylix
Copy link
Member Author

Neylix commented Feb 22, 2022

Thanks for reply !

Using echarts is a good idea as it is already imported and used in telemetry.

However using points on the map is not interesting because the range of coordinates is to large. Here the worldmap with all ranges displayed :

image

So we cannot have precise point on the map, unless if we get the exact coordinates from nodes instead of getting a range using geo patch.

In all case, I think that displaying the range is a good idea as it is an important variable for the ARCH consensus.

What do you think about getting node exact coordinates and grouping them with a range of +-1 and so have good precision to diplay them as a point on the map like in your exemple ?

@ghost
Copy link

ghost commented Feb 22, 2022

Hello.
Thanks for the changes and the proposals.
In fact GeoPatch are designed with sub levels of details.
So each patch have 3 digits.
Each digit corresponds to a subdivision of 16 squares.
Example: 012, it will be located on the first square, then inside it will go in the second nested square and finally it will to the third nested square of the latter.
This way we have some precision but without giving too much information.

Also if there are too many points we can aggregate or if for UI clarity it will not render nicely, we can keep two digits and show popup with the number of nodes inside.

@Neylix
Copy link
Member Author

Neylix commented Feb 22, 2022

Hi !

Correct me if I'm wrong but I think that each digit do not subdivise by 16 the possible range, the first one yes, but the 2 others only subdivise by 4 :
Depending on real coordinates, the first digit can be all possiblities (from 0 to F)
Then, due to function resolve_with_sign() the second digit must have f_i and s_i with the same sign as the original coordinates so it let open only 4 possiblities.
For exemple if first digit is "0" so f_i positive and s_i negative, second digit must have same sign so it remain only "0", "1", "4", "5".
It's same thing for the third digit.

So with that said, we can have only 256 geo patch (16 * 4 * 4).
I tested this with "brute force" method (calculate all coordinates possiblities incrementing by 0.5) and the result is 256 unique geo patch

If I'm right, the final subdivision looks like the map I presented in my last comment (16 by 16 subdivisions)

@ghost
Copy link

ghost commented Feb 22, 2022

Hi !

Correct me if I'm wrong but I think that each digit do not subdivise by 16 the possible range, the first one yes, but the 2 others only subdivise by 4 : Depending on real coordinates, the first digit can be all possiblities (from 0 to F) Then, due to function resolve_with_sign() the second digit must have f_i and s_i with the same sign as the original coordinates so it let open only 4 possiblities. For exemple if first digit is "0" so f_i positive and s_i negative, second digit must have same sign so it remain only "0", "1", "4", "5". It's same thing for the third digit.

So with that said, we can have only 256 geo patch (16 * 4 * 4). I tested this with "brute force" method (calculate all coordinates possiblities incrementing by 0.5) and the result is 256 unique geo patch

If I'm right, the final subdivision looks like the map I presented in my last comment (16 by 16 subdivisions)

Hello.
If I'm remember well, normally it should be 16x16 squares at least for the two first digits, and probably also for the third.
@I-Archer-Zero Can you confirm ?
If so, we would have to change the coordinates to geo patch algorithm.

@Neylix
Copy link
Member Author

Neylix commented Mar 1, 2022

Hi @samuel-uniris @I-Archer-Zero
Do you have an update on this subject ?
Is there a need to rework on geo patch algorithm ?

@ghost ghost mentioned this pull request Mar 11, 2022
4 tasks
@ghost
Copy link

ghost commented Mar 15, 2022

Related to #253

@ghost ghost added core team Assigned to the core team and removed external-contribution labels Apr 19, 2022
@ghost ghost changed the base branch from master to develop April 19, 2022 08:05
@Neylix Neylix linked an issue Apr 19, 2022 that may be closed by this pull request
2 tasks
@Neylix
Copy link
Member Author

Neylix commented Apr 20, 2022

How to test :

  • Testing data sent from Phoenix Live is done in worldmap_live_test.ex
  • Testing maps updates in real time : run docker-compose up node 1 go on explorer worldmap view and then run other node containers
  • Testing multiple nodes display without running hundred of container : update worldmap_live.ex file and replace P2P.available_nodes() by your own datas (can create a loop to randomly generates Nodes data)

@Neylix Neylix requested a review from a user April 20, 2022 12:35
@ghost ghost merged commit 53278d4 into archethic-foundation:develop Apr 21, 2022
@Neylix Neylix deleted the Add-worldmap-for-node-distribution branch April 21, 2022 08:39
@ghost ghost mentioned this pull request Apr 27, 2022
ghost pushed a commit that referenced this pull request May 6, 2022
* Implement algorithm to retrieve coordinates
* add world map page on the explorer
* Add possibility to show authorized and pending node
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core team Assigned to the core team feature New feature request UI Invole user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add worldmap for the node distribution
1 participant