buche / leaflet-openweathermap Goto Github PK
View Code? Open in Web Editor NEWA JavaScript library for including OpenWeatherMap's layers and OWM's current city/station data in leaflet based maps without hassle.
A JavaScript library for including OpenWeatherMap's layers and OWM's current city/station data in leaflet based maps without hassle.
leaflet.js:6 Uncaught TypeError: Cannot read property 'call' of undefined
at e.whenReady (leaflet.js:6)
at e.addLayer (leaflet.js:6)
at e._onInputClick (leaflet.js:9)
at HTMLInputElement.h (leaflet.js:6)
leaflet-openweathermap.js:319 Uncaught TypeError: Cannot read property 'removeControl' of null
at e.onRemove (leaflet-openweathermap.js:319)
at e.removeLayer (leaflet.js:6)
at e._onInputClick (leaflet.js:9)
at HTMLInputElement.h (leaflet.js:6)
Everything is working as expected. I need, however, a forecast (+xx hours option) which looks feasible from the OWM api http://openweathermap.org/forecast5 Are you planning something?
Is it possibile to set default map, level tile and current weather on load map?
Thanks
They both lead to websites whose hosting appears to have expired
Hello @buche! Great package.
I saw that it's not registered in bower. Can you register it?
I'd rather not have to fork and register it.
Thanks!
var humanitarian = L.tileLayer('https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
maxZoom: 17, attribution: ''
});
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attribution: '' });
var clouds = L.OWM.clouds({showLegend: false, opacity: 0.5, appId: 'xxxx'});
var rain = L.OWM.rain({opacity: 0.5, appId: 'xxxx'});
var city = L.OWM.current({intervall: 15, lang: 'en'});
var map = L.map('weatherradarmap', { center: new L.LatLng(app.location.latitude, app.location.longitude), zoom: 6, layers: [humanitarian] });
var baseMaps = { "OSM Humanitarian": humanitarian };
var overlayMaps = { "Rain": rain, "Cities": city };
var layerControl = L.control.layers(baseMaps, overlayMaps).addTo(map);
Hi Buche,
I like your leaflet-openweathermap very much but unfortunately it works only with leaflet as the name says. However I would like to have it for openlayer3. I try several things but I was not able to make it work. I just need the current data for cities and stations.
Could you help me to integrate it in openlayer3 as well? Maybe it's a good issue to have it on both libraries. On the other hand I could help to translate into german.
Guido
@buche
I just downloaded and viewed it through localhost, I checked the Temperature
checkbox, and console throws errors more than 100 errors, saying that
Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
from http://b.tile.openweathermap.org/map/temp/11/1481/947.png
I opened up the url in new tab and it keeps spinning. Is there a bug or a temporary server problem?
Also the loading of overlay tiles is really very slow.
leaflet-openweathermap has an option of switching temperature unit. When I set the temperature unit to F. Everything in map changed accordingly. However, the image that indicate temperature scale remains unchanged.
Overall, great code! Thanks.
Here's a good start for leaflet-openweathermap.d.ts
If this is something you'd like to do, let me know if a pull request is preferred.
Hi, is it possible to prevent mouse wheel to zoom in out over the map?
on google map is possible using scrollwheel: false
Thanks
Have you had any issue using this and dramatically overstepping the 60 calls per minute rule? I just got flagged for 745/60 calls per minute when there was only two users and the functions are run once.
It looks like the script is querying the API 12 times per layer toggle.
GET https://c.tile.openweathermap.org/map/precipitation/2/1/1.png?appid=KEY 429 ()...
On line 200/201:
for (var idx in this._legendContainer) {
var imgPath = this._legendContainer[idx];
//...
If the Array
prototype has been extended to have additional functions, those functions are returned by name as idx
values. You then end up with broken image src
attributes containing javascript source code from that function, for example in my case:
<div class="owm-legend-item" style="float: left; margin-right: 10px;">
<img src="function (callback) {
var arrayClone, sections;
sections = [];
arrayClone = this.slice(0);
$.each(arrayClone, (function(_this) {
// ... etc
}" border="0">
</div>
You could fix this pretty easily though with an isNaN
check:
for (var idx in this._legendContainer) {
if (isNan(idx)) { continue; }
//...
via-
https://github.com/buche/leaflet-openweathermap/blob/master/leaflet-openweathermap.js#L200-L201
My user gives me a feedback that markers on the map block the city names on the map. They also like your markers, they are informative. Would it be possible to increase transparency of the marker and use heavy border to resolve this user issue?
Thanks
Yong Liu
The Demo Site is actually not available. Where else can users see how it works as a demo?
Approx 2 weeks ago this stopped working. Anytime I try now, it comes back with a "syntax error - unexpected character:"
Hi,
EDIT: I may have spoke too soon. It seems to have come back up. But I was curious if the library can be ported to use the latest version of the API anyway ?
I was trying to load your sample example page here and turn on the Cities/Stations checkbox and it does not bring up weather for cities. This used to work just fine up until last week.
http://map.comlu.com/openweathermap/
Looked at the json request and its not returning data. I suspect they killed the old end point. I tried to change the api version to 2.5 (seems like thats the current) but there is no example on their site to construct a bounding box query for v2.5. I was wondering if you would know about it?
Example query that does not work:
http://api.openweathermap.org/data/2.1/find/city?bbox=-89.4561767578125,41.76106872528616,-85.9405517578125,42.69252994883861,10&callback=L.OWM.Utils.callbacks[0]
Great leaflet port by the way!
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.