neveldo / mapael-documentation

Mapael documentation
5 stars 3 forks source link

Page to test all available maps #6

Open Indigo744 opened 6 years ago

Indigo744 commented 6 years ago

I was wondering if we should add a page where the user can select any map it wants (from the mapael-maps repo) and it would automatically load.

I imagine a dropdown (or a tree) with all maps fetched from Github (master branch). Obviously, minified version should be hidden.

Additionally, allow the user to specify any external link to load a map (e.g. useful in case of testing a branch).

What do you think?

neveldo commented 6 years ago

Hello @Indigo744 ,

A mapael test/demo page where the users could load a map from the repository (or external ones) could be a great idea ! We could add a NPM dependency to the mapael-documentation project in order to host the available maps. Some PHP code could help to build the select list on the page. However, I think this is not the best approach, has it will constrain me to update the mapael-maps' dependency whenever a new map is added.

I think a better approach is to retrieve the maps list direcly from the github project page (by scraping ? Or maybe there is an API to do that easily ?), and then load them from rawgit.

The test page could go a little further, with some input to allow to plot some points, or even load a full custom JSON configuration.

Indigo744 commented 6 years ago

Indeed, I think the best approach is to be dynamic and retrieve maps at runtime.

Github offers a powerful API. For instance, for accessing repo content, see here: https://developer.github.com/v3/repos/contents/

We could provide indeed a list of plots all around the world in a JSON file (maybe like all world capitals?) so at least a map has one plot displayed.

neveldo commented 6 years ago

It's a good idea to display on the maps by default the world capitals by default in order to have at least one plot on it, moreover such a dataset seems to be quite easy to find : http://techslides.com/list-of-countries-and-capitals .

I will try to make a first draft of it asap ! (if you haven't already began to work on it of course ? ;) )

Indigo744 commented 6 years ago

No I didn't have time to start something! I'll test and review happily :)

neveldo commented 6 years ago

Hello @Indigo744 ,

Here is a first draft : https://www.vincentbroute.fr/mapael/try.html , what do you think about it ?

I didn't used github API as it require some backend code with the oAuth authentication (for now, there is only frontend code for this tool). Maybe the default code example and the overall interface should be more "sexy").

Indigo744 commented 6 years ago

Really nice! I like where this is going :)

Some suggestions on top of my head:

The Github API can be used from the frontend with XHR calls. No oAuth required (but we can be limited by the number of requests). I didn't expect this tools to be generated by backend actually

neveldo commented 6 years ago

Hello @Indigo744 ,

Thanks for your feedback !

Thanks for the info regarding Github API, I will re-check that point asap.

I also thought about some other features, in order to go a little further :

Anyway, as soon as I finish a first clean version (even without all the feature listed here), I will make a PR on mapael-documentation repository.

Indigo744 commented 6 years ago

Regarding some points: