@@ -70,9 +70,42 @@ export default function LeafletMap({ onCountryClick, highlightCountry, gameState
7070
7171 const loadCountryBoundaries = async ( map , L ) => {
7272 try {
73- // For now, we'll create basic country polygons for major countries
74- // In a real implementation, you'd load actual GeoJSON data
75- const countryBounds = getSimplifiedCountryBounds ( ) ;
73+ // Load actual world countries GeoJSON from a public source
74+ const response = await fetch ( 'https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/world.geojson' ) ;
75+ const worldData = await response . json ( ) ;
76+
77+ // Filter to only include our game countries
78+ const gameCountries = [
79+ 'United States of America' , 'Canada' , 'Mexico' , 'Brazil' , 'Argentina' ,
80+ 'Russia' , 'China' , 'India' , 'Australia' , 'Egypt' ,
81+ 'South Africa' , 'Nigeria' , 'Germany' , 'France' , 'Spain' ,
82+ 'United Kingdom' , 'Italy' , 'Turkey' , 'Saudi Arabia' , 'Iran' ,
83+ 'Kazakhstan' , 'Mongolia' , 'Japan' , 'Indonesia' , 'Thailand'
84+ ] ;
85+
86+ // Map display names to GeoJSON names
87+ const countryNameMap = {
88+ 'United States' : 'United States of America' ,
89+ 'United Kingdom' : 'United Kingdom' ,
90+ 'Russia' : 'Russia' ,
91+ 'South Africa' : 'South Africa'
92+ } ;
93+
94+ const filteredFeatures = worldData . features . filter ( feature => {
95+ const countryName = feature . properties . NAME ;
96+ return gameCountries . includes ( countryName ) ;
97+ } ) ;
98+
99+ const countryBounds = {
100+ type : "FeatureCollection" ,
101+ features : filteredFeatures . map ( feature => ( {
102+ ...feature ,
103+ properties : {
104+ ...feature . properties ,
105+ name : Object . keys ( countryNameMap ) . find ( key => countryNameMap [ key ] === feature . properties . NAME ) || feature . properties . NAME
106+ }
107+ } ) )
108+ } ;
76109
77110 const geoJsonLayer = L . geoJSON ( countryBounds , {
78111 style : {
0 commit comments