Membership Map Issue#10 #706
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Link 🔗:
Issue: #10
Type of Change
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 ✅
pre-commit run --all
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"])},
test_json()
test_bpd_countries()