/** This program demonstrates the use of the country polygons in Country.frink to draw a map of the world. It can be readily altered to draw the map in your favorite projection. This demonstrates the Gall-Peters which I actually really dislike. */ use Country.frink g = new graphics g.stroke[0.001] g.font["SansSerif", "bold", 0.5 degree] // Iterate through all countries. for [code, country] = Country.getCountryList[] { cc = new color[randomFloat[0,1], randomFloat[0,1], randomFloat[0,1], .8] for poly = country.borders // Iterate through polygons in a country. { p = new filledPolygon // This polygon is the filled country po = new polygon // This is the outline of the country for [long, lat] = poly // Iterate through points in polygon { [x,y] = latLongToXYPeters[lat degree, long degree] p.addPoint[x, -y] po.addPoint[x, -y] } // Draw filled countries g.color[cc] g.add[p] // Draw country outlines g.color[0.2,0.2,0.2,.8] g.add[po] } } g.show[] g.write["Peters.svg", 1000, 500] g.write["Peters.png", 1000, 800] latLongToXYPeters[lat, long] := { s = sqrt[2] R = 1 x = R pi long / (180 degrees s) y = R s sin[lat] return [x,y] }