-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Dyck
committed
Nov 11, 2014
0 parents
commit 6ed7658
Showing
4 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
Country,Capital City,Latitude,Longitude,lat,lon | ||
Afghanistan,Kabul,34.28N,69.11E,34.28,69.11 | ||
Albania,Tirane,41.18N,19.49E,41.18,19.49 | ||
Algeria,Algiers,36.42N,03.08E,36.42,3.08 | ||
American Samoa,Pago Pago,14.16S,170.43W,-14.16,-170.4 | ||
Andorra,Andorra la Vella,42.31N,01.32E,42.31,1.32 | ||
Angola,Luanda,08.50S,13.15E,-8.5,13.15 | ||
Antigua and Barbuda,W. Indies,17.20N,61.48W,17.2,-61.48 | ||
Argentina,Buenos Aires,36.30S,60.00W,-36.3,-60 | ||
Armenia,Yerevan,40.10N,44.31E,40.1,44.31 | ||
Aruba,Oranjestad,12.32N,70.02W,12.32,-70.02 | ||
Australia,Canberra,35.15S,149.08E,-35.15,149 | ||
Austria,Vienna,48.12N,16.22E,48.12,16.22 | ||
Azerbaijan,Baku,40.29N,49.56E,40.29,49.56 | ||
Bahamas,Nassau,25.05N,77.20W,25.05,-77.2 | ||
Bahrain,Manama,26.10N,50.30E,26.1,50.3 | ||
Bangladesh,Dhaka,23.43N,90.26E,23.43,90.26 | ||
Barbados,Bridgetown,13.05N,59.30W,13.05,-59.3 | ||
Belarus,Minsk,53.52N,27.30E,53.52,27.3 | ||
Belgium,Brussels,50.51N,04.21E,50.51,4.21 | ||
Belize,Belmopan,17.18N,88.30W,17.18,-88.3 | ||
Bhutan,Thimphu,27.31N,89.45E,27.31,89.45 | ||
Bolivia,La Paz,16.20S,68.10W,-16.2,-68.1 | ||
Bosnia and Herzegovina,Sarajevo,43.52N,18.26E,43.52,18.26 | ||
Botswana,Gaborone,24.45S,25.57E,-24.45,25.57 | ||
Brazil,Brasilia,15.47S,47.55W,-15.47,-47.55 | ||
British Virgin Islands,Road Town,18.27N,64.37W,18.27,-64.37 | ||
Brunei Darussalam,Bandar Seri Begawan,04.52N,115.00E,4.52,115 | ||
Bulgaria,Sofia,42.45N,23.20E,42.45,23.2 | ||
Burkina Faso,Ouagadougou,12.15N,01.30W,12.15,-1.3 | ||
Burundi,Bujumbura,03.16S,29.18E,-3.16,29.18 | ||
Cambodia,Phnom Penh,11.33N,104.55E,11.33,104.5 | ||
Cameroon,Yaounde,03.50N,11.35E,3.5,11.35 | ||
Canada,Ottawa,45.27S,75.42W,-45.27,-75.42 | ||
Cape Verde,Praia,15.02N,23.34W,15.02,-23.34 | ||
Cayman Islands,George Town,19.20N,81.24W,19.2,-81.24 | ||
Central African Republic,Bangui,04.23N,18.35E,4.23,18.35 | ||
Chad,N'Djamena,12.10N,14.59E,12.1,14.59 | ||
Chile,Santiago,33.24S,70.40W,-33.24,-70.4 | ||
China,Beijing,39.55N,116.20E,39.55,116.2 | ||
Colombia,Bogota,04.34N,74.00W,4.34,-74 | ||
Comros,Moroni,11.40S,43.16E,-11.4,43.16 | ||
Congo,Brazzaville,04.09S,15.12E,-4.09,15.12 | ||
Costa Rica,San Jose,09.55N,84.02W,9.55,-84.02 | ||
Cote d'Ivoire,Yamoussoukro,06.49N,05.17W,6.49,-5.17 | ||
Croatia,Zagreb,45.50N,15.58E,45.5,15.58 | ||
Cuba,Havana,23.08N,82.22W,23.08,-82.22 | ||
Cyprus,Nicosia,35.10N,33.25E,35.1,33.25 | ||
Czech Republic,Prague,50.05N,14.22E,50.05,14.22 | ||
Congo,Kinshasa,04.20S,15.15E,-4.2,15.15 | ||
Denmark,Copenhagen,55.41N,12.34E,55.41,12.34 | ||
Djibouti,Djibouti,11.08N,42.20E,11.08,42.2 | ||
Dominica,Roseau,15.20N,61.24W,15.2,-61.24 | ||
Dominica Republic,Santo Domingo,18.30N,69.59W,18.3,-69.59 | ||
East Timor,Dili,08.29S,125.34E,-8.29,125.3 | ||
Ecuador,Quito,00.15S,78.35W,-0.15,-78.35 | ||
Egypt,Cairo,30.01N,31.14E,30.01,31.14 | ||
El Salvador,San Salvador,13.40N,89.10W,13.4,-89.1 | ||
Equatorial Guinea,Malabo,03.45N,08.50E,3.45,8.5 | ||
Eritrea,Asmara,15.19N,38.55E,15.19,38.55 | ||
Estonia,Tallinn,59.22N,24.48E,59.22,24.48 | ||
Ethiopia,Addis Ababa,09.02N,38.42E,9.02,38.42 | ||
Falkland Islands,Stanley,51.40S,59.51W,-51.4,-59.51 | ||
Faroe Islands,Torshavn,62.05N,06.56W,62.05,-6.56 | ||
Fiji,Suva,18.06S,178.30E,-18.06,178.3 | ||
Finland,Helsinki,60.15N,25.03E,60.15,25.03 | ||
France,Paris,48.50N,02.20E,48.5,2.2 | ||
French Guiana,Cayenne,05.05N,52.18W,5.05,-52.18 | ||
French Polynesia,Papeete,17.32S,149.34W,-17.32,-149.3 | ||
Gabon,Libreville,00.25N,09.26E,0.25,9.26 | ||
Gambia,Banjul,13.28N,16.40W,13.28,-16.4 | ||
Georgia,T'bilisi,41.43N,44.50E,41.43,44.5 | ||
Germany,Berlin,52.30N,13.25E,52.3,13.25 | ||
Ghana,Accra,05.35N,00.06W,5.35,-0.06 | ||
Greece,Athens,37.58N,23.46E,37.58,23.46 | ||
Greenland,Nuuk,64.10N,51.35W,64.1,-51.35 | ||
Guadeloupe,Basse-Terre,16.00N,61.44W,16,-61.44 | ||
Guatemala,Guatemala,14.40N,90.22W,14.4,-90.22 | ||
Guernsey,St. Peter Port,49.26N,02.33W,49.26,-2.33 | ||
Guinea,Conakry,09.29N,13.49W,9.29,-13.49 | ||
Guinea-Bissau,Bissau,11.45N,15.45W,11.45,-15.45 | ||
Guyana,Georgetown,06.50N,58.12W,6.5,-58.12 | ||
Haiti,Port-au-Prince,18.40N,72.20W,18.4,-72.2 | ||
Honduras,Tegucigalpa,14.05N,87.14W,14.05,-87.14 | ||
Hungary,Budapest,47.29N,19.05E,47.29,19.05 | ||
Iceland,Reykjavik,64.10N,21.57W,64.1,-21.57 | ||
India,New Delhi,28.37N,77.13E,28.37,77.13 | ||
Indonesia,Jakarta,06.09S,106.49E,-6.09,106.4 | ||
Iran,Tehran,35.44N,51.30E,35.44,51.3 | ||
Iraq,Baghdad,33.20N,44.30E,33.2,44.3 | ||
Ireland,Dublin,53.21N,06.15W,53.21,-6.15 | ||
Israel,Jerusalem,31.71N,35.10E,31.71,35.1 | ||
Italy,Rome,41.54N,12.29E,41.54,12.29 | ||
Jamaica,Kingston,18.00N,76.50W,18,-76.5 | ||
Jordan,Amman,31.57N,35.52E,31.57,35.52 | ||
Kazakhstan,Astana,51.10N,71.30E,51.1,71.3 | ||
Kenya,Nairobi,01.17S,36.48E,-1.17,36.48 | ||
Kiribati,Tarawa,01.30N,173.00E,1.3,173 | ||
Kuwait,Kuwait,29.30N,48.00E,29.3,48 | ||
Kyrgyzstan,Bishkek,42.54N,74.46E,42.54,74.46 | ||
Latvia,Riga,56.53N,24.08E,56.53,24.08 | ||
Lebanon,Beirut,33.53N,35.31E,33.53,35.31 | ||
Lesotho,Maseru,29.18S,27.30E,-29.18,27.3 | ||
Liberia,Monrovia,06.18N,10.47W,6.18,-10.47 | ||
Liechtenstein,Vaduz,47.08N,09.31E,47.08,9.31 | ||
Lithuania,Vilnius,54.38N,25.19E,54.38,25.19 | ||
Luxembourg,Luxembourg,49.37N,06.09E,49.37,6.09 | ||
"Macao, China",Macau,22.12N,113.33E,22.12,113.3 | ||
Madagascar,Antananarivo,18.55S,47.31E,-18.55,47.31 | ||
Malawi,Lilongwe,14.00S,33.48E,-14,33.48 | ||
Malaysia,Kuala Lumpur,03.09N,101.41E,3.09,101.4 | ||
Maldives,Male,04.00N,73.28E,4,73.28 | ||
Mali,Bamako,12.34N,07.55W,12.34,-7.55 | ||
Malta,Valletta,35.54N,14.31E,35.54,14.31 | ||
Martinique,Fort-de-France,14.36N,61.02W,14.36,-61.02 | ||
Mauritania,Nouakchott,20.10S,57.30E,-20.1,57.3 | ||
Mayotte,Mamoudzou,12.48S,45.14E,-12.48,45.14 | ||
Mexico,Mexico,19.20N,99.10W,19.2,-99.1 | ||
Micronesia,Palikir,06.55N,158.09E,6.55,158 | ||
Moldova,Chisinau,47.02N,28.50E,47.02,28.5 | ||
Mozambique,Maputo,25.58S,32.32E,-25.58,32.32 | ||
Myanmar,Yangon,16.45N,96.20E,16.45,96.2 | ||
Namibia,Windhoek,22.35S,17.04E,-22.35,17.04 | ||
Nepal,Kathmandu,27.45N,85.20E,27.45,85.2 | ||
Netherlands,Amsterdam,52.23N,04.54E,52.23,4.54 | ||
Netherlands Antilles,Willemstad,12.05N,69.00W,12.05,-69 | ||
New Caledonia,Noumea,22.17S,166.30E,-22.17,166.3 | ||
New Zealand,Wellington,41.19S,174.46E,-41.19,174.4 | ||
Nicaragua,Managua,12.06N,86.20W,12.06,-86.2 | ||
Niger,Niamey,13.27N,02.06E,13.27,2.06 | ||
Nigeria,Abuja,09.05N,07.32E,9.05,7.32 | ||
Norfolk Island,Kingston,45.20S,168.43E,-45.2,168.4 | ||
Northern Mariana Islands,Saipan,15.12N,145.45E,15.12,145.4 | ||
Norway,Oslo,59.55N,10.45E,59.55,10.45 | ||
Oman,Masqat,23.37N,58.36E,23.37,58.36 | ||
Pakistan,Islamabad,33.40N,73.10E,33.4,73.1 | ||
Palau,Koror,07.20N,134.28E,7.2,134.2 | ||
Panama,Panama,09.00N,79.25W,9,-79.25 | ||
Papua New Guinea,Port Moresby,09.24S,147.08E,-9.24,147 | ||
Paraguay,Asuncion,25.10S,57.30W,-25.1,-57.3 | ||
Peru,Lima,12.00S,77.00W,-12,-77 | ||
Philippines,Manila,14.40N,121.03E,14.4,121 | ||
Poland,Warsaw,52.13N,21.00E,52.13,21 | ||
Portugal,Lisbon,38.42N,09.10W,38.42,-9.1 | ||
Puerto Rico,San Juan,18.28N,66.07W,18.28,-66.07 | ||
Qatar,Doha,25.15N,51.35E,25.15,51.35 | ||
Korea,Seoul,37.31N,126.58E,37.31,126.5 | ||
Romania,Bucuresti,44.27N,26.10E,44.27,26.1 | ||
Russian Federation,Moskva,55.45N,37.35E,55.45,37.35 | ||
Rawanda,Kigali,01.59S,30.04E,-1.59,30.04 | ||
Saint Kitts and Nevis,Basseterre,17.17N,62.43W,17.17,-62.43 | ||
Saint Lucia,Castries,14.02N,60.58W,14.02,-60.58 | ||
Saint Pierre and Miquelon,Saint-Pierre,46.46N,56.12W,46.46,-56.12 | ||
Samoa,Apia,13.50S,171.50W,-13.5,-171.5 | ||
San Marino,San Marino,43.55N,12.30E,43.55,12.3 | ||
Sao Tome and Principe,Sao Tome,00.10N,06.39E,0.1,6.39 | ||
Saudi Arabia,Riyadh,24.41N,46.42E,24.41,46.42 | ||
Senegal,Dakar,14.34N,17.29W,14.34,-17.29 | ||
Sierra Leone,Freetown,08.30N,13.17W,8.3,-13.17 | ||
Slovakia,Bratislava,48.10N,17.07E,48.1,17.07 | ||
Slovenia,Ljubljana,46.04N,14.33E,46.04,14.33 | ||
Solomon Islands,Honiara,09.27S,159.57E,-9.27,159.5 | ||
Somalia,Mogadishu,02.02N,45.25E,2.02,45.25 | ||
South Africa,Pretoria,25.44S,28.12E,-25.44,28.12 | ||
Spain,Madrid,40.25N,03.45W,40.25,-3.45 | ||
Sudan,Khartoum,15.31N,32.35E,15.31,32.35 | ||
Suriname,Paramaribo,05.50N,55.10W,5.5,-55.1 | ||
Swaziland,Mbabane,26.18S,31.06E,-26.18,31.06 | ||
Sweden,Stockholm,59.20N,18.03E,59.2,18.03 | ||
Switzerland,Bern,46.57N,07.28E,46.57,7.28 | ||
Syrian Arab Republic,Damascus,33.30N,36.18E,33.3,36.18 | ||
Tajikistan,Dushanbe,38.33N,68.48E,38.33,68.48 | ||
Thailand,Bangkok,13.45N,100.35E,13.45,100.3 | ||
Togo,Lome,06.09N,01.20E,6.09,1.2 | ||
Tonga,Nuku'alofa,21.10S,174.00W,-21.1,-174 | ||
Tunisia,Tunis,36.50N,10.11E,36.5,10.11 | ||
Turkey,Ankara,39.57N,32.54E,39.57,32.54 | ||
Turkmenistan,Ashgabat,38.00N,57.50E,38,57.5 | ||
Tuvalu,Funafuti,08.31S,179.13E,-8.31,179.1 | ||
Uganda,Kampala,00.20N,32.30E,0.2,32.3 | ||
Ukraine,Kiev,50.30N,30.28E,50.3,30.28 | ||
United Arab Emirates,Abu Dhabi,24.28N,54.22E,24.28,54.22 | ||
United Kingdom,London,51.36N,00.05W,51.36,-0.05 | ||
Tanzania,Dodoma,06.08S,35.45E,-6.08,35.45 | ||
United States of America,Washington DC,39.91N,77.02W,39.91,-77.02 | ||
Uruguay,Montevideo,34.50S,56.11W,-34.5,-56.11 | ||
Uzbekistan,Tashkent,41.20N,69.10E,41.2,69.1 | ||
Vanuatu,Port-Vila,17.45S,168.18E,-17.45,168.1 | ||
Venezuela,Caracas,10.30N,66.55W,10.3,-66.55 | ||
Viet Nam,Hanoi,21.05N,105.55E,21.05,105.5 | ||
Yugoslavia,Belgrade,44.50N,20.37E,44.5,20.37 | ||
Zambia,Lusaka,15.28S,28.16E,-15.28,28.16 | ||
Zimbabwe,Harare,17.43S,31.02E,-17.43,31.02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import csv | ||
|
||
# Read in raw data from csv | ||
rawData = csv.reader(open('sample.csv', 'rb'), dialect='excel') | ||
|
||
# the template. where data from the csv will be formatted to geojson | ||
template = \ | ||
''' \ | ||
{ "type" : "Feature", | ||
"id" : %s, | ||
"geometry" : { | ||
"type" : "Point", | ||
"coordinates" : ["%s","%s"]}, | ||
"properties" : { "name" : "%s", "value" : "%s"} | ||
}, | ||
''' | ||
|
||
# the head of the geojson file | ||
output = \ | ||
''' \ | ||
{ "type" : "Feature Collection", | ||
{"features" : [ | ||
''' | ||
|
||
# loop through the csv by row skipping the first | ||
iter = 0 | ||
for row in rawData: | ||
iter += 1 | ||
if iter >= 2: | ||
id = row[0] | ||
lat = row[1] | ||
lon = row[2] | ||
name = row[3] | ||
pop = row[4] | ||
output += template % (row[0], row[1], row[2], row[3], row[4]) | ||
|
||
# the tail of the geojson file | ||
output += \ | ||
''' \ | ||
] | ||
} | ||
''' | ||
|
||
# opens an geoJSON file to write the output to | ||
outFileHandle = open("output.geojson", "w") | ||
outFileHandle.write(output) | ||
outFileHandle.close() | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
*** csvToGeoJSON converter *** | ||
|
||
This python script takes data in csv format and converts to geoJSON format for use in mapping applications on the web. | ||
|
||
CSV data must be in the format specified in the sample data 'sample.csv'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
id,lat,lon,name,pop | ||
4,65.216,33.677,Afghanistan,25067407 | ||
8,20.068,41.143,Albania,3153731 | ||
894,26.32,-14.614,Zambia,11478317 |