Open Indigo744 opened 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.
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.
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 ? ;) )
No I didn't have time to start something! I'll test and review happily :)
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").
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
Hello @Indigo744 ,
Thanks for your feedback !
"For the dropdown, sort by folders like in the repo" You are right, I will add this
"Be able to provide a custom map link (for testing purpose)" Done. I wonder if we should also add a textarea, in order to be able to paste a map content ?
"By default, areas/plots/links should have a tooltip with their ID shown" How do you see this feature? If we set the IDs in tooltips within the map configuration editor automatically, it will be huge for some maps, no ?
"Maybe able to select Mapael/Raphael version from cdnjs" yes that could be usefull !
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.
Regarding some points:
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?