Skip to content

Membership Map Issue#10 #706

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

Open
wants to merge 2 commits into
base: pycon-us-sprints-2025
Choose a base branch
from

Conversation

darrellajenkins
Copy link

Issue Link 🔗:

Issue: #10

Type of Change

  • Bug fix 🐞
  • New feature/page
  • Documentation update
  • Other

Description 📋

  • What: Provide an overview of the issue this PR addresses. Explain the context and background information.

  • Why: Describe why the changes are being made. Highlight key updates, new features, or bug fixes.

  • How: Explain how these changes will affect the project or end-users.

Checklist ✅

  • Followed the Code of Conduct and Contribution Guide
  • Ran pre-commit run --all
  • All tests pass locally
  • Added tests (if applicable)
  • Documentation updated (if applicable)

Additional Notes & Screenshots

Source data json file from:
https://github.com/bsrweb/geo-json-countries-mapbox/blob/master/countries/all-countries.json

See below starter code to create a membership map.

import json

with open("iso.json", "r") as file:
data = json.load(file)

def test_json():
for feature in data["features"]:
print(f"Type: {feature['type']}, A3: {feature['properties']['A3']}")
print(f"Geometry Type: {feature['geometry']['type']}")
print(f"Coordinates: {feature['geometry']['coordinates']}")
print("-" * 40)

ISO = { "US":"USA",
"UNITED KINGDOM":"GBR",
"CANADA":"CAN",
"KENYA":"KEN",
"NIGERIA":"NGA",

}

def test_bpd_countries():
for b in bpd_countries:
print(b)

def coord_finder(code):
for coord in data["features"]:
if coord["properties"]["A3"] == code:
return coord["geometry"]["coordinates"]

bpd_countries = [
{ "country_name":"US",
"country_code": ISO["US"],
"events":["PyTexas","PyOhio"],
"members":8,
"coord": coord_finder(ISO["US"])},

            {   "country_name":"UK",
                "country_code": ISO["UNITED KINGDOM"],
                "events":["PyLondon","PyBrisbane"],
                " members":8,
                "coord": coord_finder(ISO["UNITED KINGDOM"])},

            {   "country_name":"Canada",
                "country_code": ISO["CANADA"],
                "events":["PyVancouver","PyBritishColumbia"],
                "members":2,
                "coord": coord_finder(ISO["CANADA"])},

            {   "country_name":"KENYA",
                "country_code": ISO["KENYA"],
                "events":["PyNairobi"],
                "members":6,
                "coord": coord_finder(ISO["KENYA"])},

            {   "country_name":"NIGERIA",
                "country_code": ISO["NIGERIA"],
                "events":["Lagos"],
                "members":9,
                "coord": coord_finder(ISO["NIGERIA"])},

             ]

test_json()
test_bpd_countries()

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.

1 participant