Download or view latitudeComparison2.frink in plain text format
/** This program allows you to draw multiple country outlines shifted by
longitude so you can compare how latitudes in each country compare. */
use Country.frink
use Grid.frink
drawCountry[g is graphics, code, longitudeOffset] :=
{
countries = Country.getCountryList[]
country = countries@code
firstPoly = true
for poly = country.borders
{
p = new polygon
for [x, y] = poly
p.addPoint[x degrees + longitudeOffset, -y degrees]
g.add[p]
// Label first (which will be the largest) polygon
if firstPoly
{
[cx, cy] = p.getCentroid[]
g.text[code, cx, cy]
firstPoly = false;
}
}
return g
}
g = new graphics
g.font["SansSerif", 1 degree]
g.drawCountry[g, "US", 0 degrees]
g.drawCountry[g, "DE", -120 degrees]
g.drawCountry[g, "GB", -120 degrees]
g.drawCountry[g, "PL", -120 degrees]
g.drawCountry[g, "UG", -120 degrees]
g.drawCountry[g, "JP", -238 degrees]
g.drawCountry[g, "BR", -60 degrees]
grid = new Grid
//grid.font["Monospaced", 1 degree]
grid.color[0,0,0,.2]
grid.makeHorizontalLines[g, 1 degrees, false]
grid.makeVerticalLines[g, 1 degrees, false]
grid.color[0,0,0,.3]
grid.makeHorizontalLines[g, 10 degrees, false]
grid.makeVerticalLines[g, 10 degrees, false]
grid.color[0,0,0]
grid.makeHorizontalLabels[g, 10 degrees, -degrees, false]
grid.makeVerticalLabels[g, 10 degrees, degrees, false]
g.add[grid.g2]
g.show[]
g.invertGrays[].show[]
g.write["latitudeComparison.png", 1024, 600]
//g.browse["latitudeComparison.png"]
Download or view latitudeComparison2.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20145 days, 12 hours, 42 minutes ago.