Skip to content

Conversation

FDelporte
Copy link
Contributor

@FDelporte FDelporte commented Jan 31, 2025

This proposal would generate a world map showing the locations. The new page has not yet been added to the menu bar as it needs further testing. Sorry, I can't run JBake on my system.

Preconditions needed:

  • Generate an API key on https://geocode.maps.co/account/ --> free for 5000 request/day, max 1/sec
  • Add this API key as a repository secret with the name GEO_API_KEY

The JBang script will generate a new page map.adoc with a data list in this format:

var data = [
        {lat: 36.8828261, lng: 30.7045857, name: "Oezcan Acar"},
	{lat: 51.0612766, lng: -1.3131692, name: "George Adams"},
	{lat: 42.6977028, lng: 23.3217359, name: "Dmitry Aleksandrov"},
	{lat: 35.563048, lng: -105.746559, name: "Dan Allen"},
        ...
]

@FDelporte
Copy link
Contributor Author

@aalmiray this merge request assumes you'll first merge the previous one for the new podcast page ;-)

@aalmiray
Copy link
Owner

Is there a free map we could use such as OpenstreetMaps?

@aalmiray
Copy link
Owner

Also, you may need to rebase your changes as it brings over the podcast updates as welll.

@FDelporte
Copy link
Contributor Author

@aalmiray found a free API (up to 5000 calls/day).
That's all I can do for now, have to switch to other work.
Can podcast first be merged? It doesn't change the site yet, only generates the new page for further review and testing.

@aalmiray
Copy link
Owner

aalmiray commented Jan 31, 2025

Ideally we can generate the map waypoints every time the site is regenerated (commit on main), which happens only a few times a month. Thus, it should be static data, no need to issue that many REST calls a day IMHO

@FDelporte
Copy link
Contributor Author

FDelporte commented Jan 31, 2025

no need to issue that many REST calls a day IMHO

Indeed, that's why it's integrated in the site.java process. Only runs when the site gets generated. And we don't have 5000 champions yet, so not a problem either ;-)

@aalmiray
Copy link
Owner

@FDelporte podcast PR has been merged. Unfortunately there are a couple of conflicts to be resolved for this PR.

Frank Delporte added 2 commits January 31, 2025 23:27
# Conflicts:
#	.github/workflows/site.yml
#	CONTRIBUTING.adoc
#	resources/site.java
#	site/templates/menu.ftl
@FDelporte
Copy link
Contributor Author

@aalmiray merge conflicts are fixed! Thanks for merging and publishing the podcast page!

@FDelporte
Copy link
Contributor Author

I still need to review the html page and test if it correctly displays the map. That's why I didn't include a menu link to it. But can you please review @aalmiray if this can be set up in the repository with the required API key?

@FDelporte
Copy link
Contributor Author

@aalmiray map has been further implemented, tested, and is working OK. It shows almost all champions. A file gets generated with locations that could not be converted to lat/long.

Screenshot 2025-02-03 at 19 57 50 Screenshot 2025-02-03 at 19 57 27 Screenshot 2025-02-03 at 19 57 16 Screenshot 2025-02-03 at 20 08 06

@aalmiray
Copy link
Owner

aalmiray commented Feb 3, 2025

Thanks! What should we do for those entries for which lat/long can not be computed? Should we select the capital city of the given country of nomination?

If so, said city should come from a different data file or API call.

import org.json.JSONObject;
import org.json.JSONArray;

import javax.print.attribute.Attribute;
Copy link
Owner

Choose a reason for hiding this comment

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

Are these 2 imports needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

org.json is used to parse the result from geo-api

@FDelporte
Copy link
Contributor Author

lat/long can not be computed

All members now get a location thanks to:

  • correct URL encoding for API
  • max 3 retries per member
  • a few changes in the data

When we publish this, we could request all members (via Slack?) to fill in or update their city and residence country to generate an up-to-date map.

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.

2 participants