Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Tesla Winds and Elevation Web Browser App

SomeJoe7777

Marginally-Known Member
Mar 28, 2015
2,195
5,788
Houston, TX
I've been a fan of mochouinard's Tesla Headwind Estimator for a long time. However, a problem is that the app relies on another web site to obtain the wind data, and that web site (and all others like it) will charge you if you obtain weather information from them too often. mochouinard ran into this problem (because his app is quite popular) and had to disable it.

I've come up with a replacement web app to estimate winds (and elevation) for the Tesla while driving, and I'm using a method that can get around this limitation. Each person who wants to use the app can obtain their own API keys from OpenWeatherMap.org (for winds) and Geonames.org (for elevation). That way, no one API key will run into the limitations and the app can be free.

I believe the app is ready for use, and it is now live at http://teslawinds.com. When you first browse to the app, it will ask you to type in the two API keys you can register for and obtain for free from OpenWeatherMap.org and Geonames.org. I recommend you obtain the API keys on a desktop or laptop browser rather than in the car.

Once you have obtained the API keys (the Geonames site calls it the "username" or "handle"), bring up the web site in the car, type in the API keys, click the Verify button and the app will verify that both API keys work properly. If they do, you'll be redirected to the app, if not you can correct your keys and hit Verify again.

Once you are redirected to the app, bookmark it to save the API keys, that way you will not have to enter them again.

The main app looks like this:

TWE-screenshot.png



Center Pane (Course): Your course is shown at the top of the rotating compass both in degrees (0-360), and a 16-compass-point direction. Your ground speed (computed by GPS) is at the bottom. The air speed is the ground speed with the headwind or tailwind added in. This is the equivalent speed at which the car will use energy. Tailwinds reduce the air speed, headwinds increase it. The blue arrow in the compass is the wind direction for your area. The compass and wind arrow will rotate as you drive. The cars position, and therefore the course, compass, and speeds are updated every 30 seconds.

Left Pane (Winds): The direction that the local winds are coming from and their speed is shown at the top in blue. This direction is shown on the compass in the center pane as well by the blue arrow. The weather station that reported the winds is also shown above the wind direction and speed. The components of the wind (crosswind and head/tail wind) are shown surrounding your car. Crosswinds appear with a yellow arrow, headwinds appear with an orange arrow (they cause increased energy usage), and tailwinds appear with a green arrow (they reduce energy usage). The crosswind and head/tailwind speeds are also shown. The arrows size themselves dynamically, so stronger winds will appear with larger arrows. Winds under 1 MPH are not shown. Also at the bottom of this pane are the position, wind, and elevation update timers. WInds are updated every 5 minutes.

Right Pane (Elevation): The current elevation based on your location is shown at the top in feet, and is updated every 1 minute. The graphic in the middle will show your Model S on an incline if there is a measurable grade that you are driving on. If the model S is climbing, the grade is shown in orange (climbing increases energy use), if the model S is descending, the grade is shown in green (descents decrease energy use). Your ground speed must average at least 30 MPH over a 1 minute interval for the app to compute the grade and elevation change rate. This is to ensure that noise and minor errors in the elevation mapping database are smoothed out. Note that the incline that your model S is shown on is exaggerated for visibility. At the bottom of this pane is the current version of the app, which as of this writing is 1.0.0.197.


Current Limitations:

- I've made considerable effort to reduce the required CPU power for this app, but as we all know, sometimes the Tesla browser is just slow. I haven't had any real trouble but please let me know if you do.
- Right now, the app displays imperial units only. I will work on allowing the switch to SI units in a future version.
- Elevation is from a mapping database, thus it represents the ground level. Elevation is not altitude, and will not take into account bridges, overpasses, or tunnels.
- All computations other than course and speed rely on the API calls, which require Internet connectivity. If you are driving in an area where you do not have a data connection, errors will appear in the app that say "No wind/elevation data obtained". These errors will clear when Internet connectivity returns.


I hope this app helps you on any driving trips where winds and elevation can be a consideration for energy use. I appreciate any feedback you have.
 

SomeJoe7777

Marginally-Known Member
Mar 28, 2015
2,195
5,788
Houston, TX
Tried it but my accounts did not verify.:(

Make sure you are using the actual API keys, not your account username or password. For OpenWeatherMap.org, you create a new account. After that, log in with your newly-created account, go to the API Keys tab to see your API key:


TWE-OWM.png


For Geonames.org, they call the API key your "username". There are two steps. First, create an account along with a username:

TWE-GN1.png


Now, once the account is created, you go to the manage your account page, and you need to click on the link at the bottom to enable your account for the free web services:

TWE-GN2.png



In the Tesla Winds app, you will type in the OpenWeatherMap.org API key, and the Geonames username.
 

shs1

Member
Apr 5, 2016
207
203
Mariposa CA
Joe,

All working now. Thanks. I could not find the manage account on the Geonames site, but your link worked. Wonderful app and getting the elevation is a real plus as well. Thanks again.
 

SomeJoe7777

Marginally-Known Member
Mar 28, 2015
2,195
5,788
Houston, TX
still having no luck with openweathermap. Made a new key, still won't verify. any ideas?

Log into the OpenWeatherMap account and check the "My Services" tab. Make sure is says that you're subscribed to the Current Weather and Forecast, and that it's the free plan, as shown below:

TWE-OWMSvcs.png


If yours doesn't show this, you may need to find a way to add it, or you may need to create a new account from the link I posted above.
 
  • Helpful
Reactions: scottf200

SomeJoe7777

Marginally-Known Member
Mar 28, 2015
2,195
5,788
Houston, TX
If your OpenWeatherMap.org key does not verify on a desktop/laptop, you may want to try it in the car. If your desktop browser doesn't provide geo locations, it's conceivable that the key may not verify on the desktop browser.

Edit: I made a modification to the Javascript to account for desktop browsers that may not have geolocation available. If this was the problem, your key should now verify properly on such desktop browsers. Reload the page on the desktop browser to ensure you have the current version.
 
Last edited:

Peter_M

Member
Oct 10, 2013
975
291
Ottawa, Canada
If your OpenWeatherMap.org key does not verify on a desktop/laptop, you may want to try it in the car. If your desktop browser doesn't provide geo locations, it's conceivable that the key may not verify on the desktop browser.

Edit: I made a modification to the Javascript to account for desktop browsers that may not have geolocation available. If this was the problem, your key should now verify properly on such desktop browsers. Reload the page on the desktop browser to ensure you have the current version.
Yup, works now. Thanks!
 

ZBB

Emperor
Feb 27, 2013
1,574
294
Scottsdale
I set up API accounts this morning and got it working. Went for a quick drive and a it works great.

The geonames.org activate link is easy to miss. Their activate email also went to my junk folder... Once those steps were done, it worked like a charm. Nice way to easily add the API accounts!
 

bmah

Moderator
Supporting Member
Mar 17, 2015
4,256
8,070
Lafayette, CA, USA
Very cool, thanks for making this available! Tried this on a Sunday drive, just for kicks. It looks like this would be most useful on drives where you hold a roughly constant heading and rate of ascent/descent, and where you don't have a lot of terrain affecting the winds locally. (That was not the case for the drive I took, but that was a good experiment to understand the capabilities and limitations of the app.) I liked the presentation of data, lots of information presented in an easy-to-understand way. Once again thanks for sharing this!

Bruce.
 

Products we're discussing on TMC...

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top