OpenWeatherMap and WebTileLayer, issue with tile download

885
1
10-28-2017 08:27 PM
NachiChidambaram
New Contributor II

I am trying to integrate OpenWeatherMap weather layers into esri map. So that I can see some real time weather data on the map.  

I am trying to integrate OpenWeatherMap weather layers into esri map. So that I can see some real time weather data on the map.  

When I create a weather layer using WebTiledLayer , it creates the layer and adds it to the map just fine no errors in console, but it doesn't display anything except basemap.  When I watch the network traffic, it looks like 1 request is made to OpenWeatherMap layer and then no request are made for that layer.  If  I zoom or pan, I can see the basemap requests are made and redrawn, but nothing for my OpenWeatherMap- WebTiledLayer. Am I missing something very basic here ? 

 

I am following the code sample from : WebTileLayer | ArcGIS API for JavaScript 4.5 

 

Here is my code : 

 

<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>WebTileLayer - 4.5</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.5/esri/css/main.css">
<script src="https://js.arcgis.com/4.5/"></script>
<script>
var tiledLayer;
require([
"esri/config",
"esri/layers/WebTileLayer",
"esri/Map",
"esri/views/MapView",
"dojo/dom",
"dojo/domReady!"
], function(esriConfig, WebTileLayer, Map, MapView, dom) {

esriConfig.request.corsEnabledServers
.push("http://tile.openweathermap.org/");

var map = new Map({
basemap: "dark-gray"
});

var view = new MapView({
container: "viewDiv",
map: map
});

tiledLayer = new WebTileLayer({
urlTemplate: "http://tile.openweathermap.org/map/pressure_new/{z}/{x}/{y}.png?appid={my_app_id}" 
});
map.add(tiledLayer);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>

Tags (1)
0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus
0 Kudos