|
|
Country Borders |
||
|
|||
|
Download the latitude and longitude co-ordinates of each point on each country's border in countryborders.txt. Version 2 is available here. it has not yet been documented, although the format is the same as version one. About the file
Sample from the top of the fileHow I made itRemember that PowerPoint presentation that Google accidentally released? On slide 68 you may notice there's a world map. What's more, it's displayed as a series of freeform shapes, one for each country, that have been grouped together. What I did was I used VBA to extract the x and y co-ordinates of each point on the countries' borders, saved this data to a file then imported it into Access (it was too big for Excel). I discovered that the map was in Mercator projection, and I found an equation to convert the x and y co-ordinates on the map to latitude and longitude. However, this equation would only work when the map I had was a certain size, to make the trigonometry work properly. Therefore, I had to first of all scale the map down to that size. To work out the equation needed to do that, I found the x and y co-ordinates on my map for a particular point (e.g. the South-West corner of Egypt's border) and then found out the real latitude and longitude for that point on the Internet. I then applied the formula to work out what x and y should be from the latitude and longitude. I repeated this with three other locations. Once I had found four locations, I had to work out the relationship between my x and y co-ordinates, and what the co-ordinates should be. I found this using Excel's trend line tool, which displayed the equation on the graph. I applied this equation to the x co-ordinates, and another, similar equation to the y co-ordinates in the database. I was then able to apply the main equation to convert from Mercator projection to latitude/longitude. Unfortunately, Access's range of functions was not as wide as Excel's so I often found myself hard-coding in values like pi. The equation was inserted into a query that output the latitude and longitude co-ordinates, which were then exported as a comma delimited text file. Limitations
| |||
|
Written by Toby. This work is licensed under a Creative Commons License. Privacy | |||