Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMasahiro Yasuda
25,702 PointsI want to make weather app covers not only United states but also world wide cities. Any idea?
I searched Latitude & Longitude and write the code like the video but it doesn't work. Do I need to change API itself if I make world-wide weather app? Please help me.
var cities = {
"chiba" : {coords: {latitude: 35.607267, longtitude: 140.106291}},
"brisbane" : {coords: {latitude: -27.471011, longtitude: 153.023449}},
"new york" : {coords: {latitude: 40.712784, longtitude: -74.005941}},
"current location" : ""
};
searched by this site. http://www.latlong.net/convert-address-to-lat-long.html
2 Answers
Carl Mungazi
9,071 PointsYou will only need to change the coordinates to ensure they match your target destination. I did one at http://carlmungazi.com/goodweather/index.html and the code for the cities is:
//create associative array for cities
var cities = {
"harare" : {coords: {latitude: 17.8639, longitude:-31.0297}},
"beijing" : {coords: {latitude: 39.9167, longitude: -116.3833}},
"minsk" : {coords: {latitude: 53.9000, longitude: -27.5667}},
"toronto" : {coords: {latitude: 43.7000, longitude: -79.4000}},
"panama city" : {coords: {latitude: 8.983333, longitude: -79.516670}},
"current location" : ""
};
Masahiro Yasuda
25,702 PointsCarl Thank you so much! it helps a lot. I want to make my own weather app!
Masahiro Yasuda
25,702 PointsMasahiro Yasuda
25,702 PointsThanks Carl! I will try! but I couldn't see your webpage. Could you upload the file again to your web server?
Carl Mungazi
9,071 PointsCarl Mungazi
9,071 PointsMasahiro Yasuda - I've just realised that I took this app down yesterday. Here's a link to the github code https://github.com/CarlMungazi/carlmungazi/blob/master/goodweather/index.html. You can copy/fork the code and run it on your own environment.