久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='7X3WG'></tfoot>

      <i id='7X3WG'><tr id='7X3WG'><dt id='7X3WG'><q id='7X3WG'><span id='7X3WG'><b id='7X3WG'><form id='7X3WG'><ins id='7X3WG'></ins><ul id='7X3WG'></ul><sub id='7X3WG'></sub></form><legend id='7X3WG'></legend><bdo id='7X3WG'><pre id='7X3WG'><center id='7X3WG'></center></pre></bdo></b><th id='7X3WG'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7X3WG'><tfoot id='7X3WG'></tfoot><dl id='7X3WG'><fieldset id='7X3WG'></fieldset></dl></div>

      <small id='7X3WG'></small><noframes id='7X3WG'>

      • <bdo id='7X3WG'></bdo><ul id='7X3WG'></ul>

      1. <legend id='7X3WG'><style id='7X3WG'><dir id='7X3WG'><q id='7X3WG'></q></dir></style></legend>
      2. 如何在 openweather API 中獲取地理位置

        How do I get geolocation in openweather API(如何在 openweather API 中獲取地理位置)

        <tfoot id='FZbQ3'></tfoot>

        <i id='FZbQ3'><tr id='FZbQ3'><dt id='FZbQ3'><q id='FZbQ3'><span id='FZbQ3'><b id='FZbQ3'><form id='FZbQ3'><ins id='FZbQ3'></ins><ul id='FZbQ3'></ul><sub id='FZbQ3'></sub></form><legend id='FZbQ3'></legend><bdo id='FZbQ3'><pre id='FZbQ3'><center id='FZbQ3'></center></pre></bdo></b><th id='FZbQ3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FZbQ3'><tfoot id='FZbQ3'></tfoot><dl id='FZbQ3'><fieldset id='FZbQ3'></fieldset></dl></div>
        1. <legend id='FZbQ3'><style id='FZbQ3'><dir id='FZbQ3'><q id='FZbQ3'></q></dir></style></legend>

          <small id='FZbQ3'></small><noframes id='FZbQ3'>

              <tbody id='FZbQ3'></tbody>
              • <bdo id='FZbQ3'></bdo><ul id='FZbQ3'></ul>
                  本文介紹了如何在 openweather API 中獲取地理位置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如何讓 mu openweather API 用于地理定位?這是我當前的 html 代碼:

                  How do I get mu openweather API to work with geolocation? This is my current html code:

                  <!DOCTYPE html>
                  <html>
                      <head>
                          <link rel="stylesheet" >
                          <link rel="stylesheet" href="main.css">
                          <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
                          <script type='text/javascript' src='app.js'></script>
                      </head>
                      <body>
                          <div class="jumbotron">
                              <button onclick="getLocation()">Get my location.</button>
                              <p id="demo"></p>
                  
                              <script>
                                  var x = document.getElementById("demo");
                                  function getLocation() {
                                      if (navigator.geolocation) {
                                          navigator.geolocation.getCurrentPosition(showPosition);
                                      } else { 
                                          x.innerHTML = "Geolocation is not supported by this browser.";
                                      }
                                  }
                  
                                  function showPosition(position) {
                                      x.innerHTML = "Latitude: " + position.coords.latitude + 
                                                    "<br>Longitude: " + position.coords.longitude;    
                                  }
                              </script>
                  
                              <p>The weather outside is: </p> 
                              <div class= "weather">
                                  Oops.. there is no temperature available for your location right now.
                              </div>
                          </div>                                  
                      </body>
                  </html>
                  

                  還有我的 JavaScript 代碼:

                  $(document).ready(function(){
                      $.getJSON( "http://api.openweathermap.org/data/2.5/weather?q=Eindhoven&appid=9334f947893792dcb9b2e2c05ae23eb0", function( data ) {
                          $('.weather').html(Math.round(data.main.temp-273)+ ' degrees Celcius');
                      });
                  
                  });
                  

                  我得到了埃因霍溫市的天氣工作,但我希望能夠將其調整為經緯度.有人可以為我修復我的代碼嗎?并幫助我?

                  I got the weather in Eindhoven city working, but I want to be able to adjust it to the latitude and longitude. Can someone fix my code for me? And help me?

                  我知道這與此鏈接有關:api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon} 但我不知道如何實現我自己的 fount經緯度在里面...

                  I know it has something to do with this link: api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon} but I don't know how to implement my own fount latitude and longitude in it...

                  推薦答案

                  您可以使用第三方API獲取有關位置的數據,例如:http://ip-api.com/

                  You can get data about the location with use third-party API, for example: http://ip-api.com/

                  var getIP = 'http://ip-api.com/json/';
                  $.getJSON(getIP).done(function(location) {
                      console.log(location)
                  })
                  

                  接下來使用我們上面得到的 ip-api 從 OpenWeatherMap 服務獲取 WeatherData

                  Next get WeatherData from OpenWeatherMap service using the ip-api that we got above

                  var getIP = 'http://ip-api.com/json/';
                  var openWeatherMap = 'http://api.openweathermap.org/data/2.5/weather'
                  $.getJSON(getIP).done(function(location) {
                      $.getJSON(openWeatherMap, {
                          lat: location.lat,
                          lon: location.lon,
                          units: 'metric',
                          APPID: 'APIKEY'
                      }).done(function(weather) {
                          console.log(weather)
                      })
                  })
                  

                  在這種情況下,攝氏溫度(公制)

                  In this case, the celsius temperature (metric)

                  或使用 HTML5 Geolocation API(在 Google Chrome 中只能使用 HTTPSlocalhost)

                  Or using HTML5 Geolocation API (in Google Chrome work only with HTTPS or on localhost)

                  var openWeatherMap = 'http://api.openweathermap.org/data/2.5/weather'
                  if (window.navigator && window.navigator.geolocation) {
                      window.navigator.geolocation.getCurrentPosition(function(position) {
                          $.getJSON(openWeatherMap, {
                              lat: position.coords.latitude,
                              lon: position.coords.longitude,
                              units: 'metric',
                              APPID: 'APIKEY'
                          }).done(function(weather) {
                              console.log(weather)
                          })
                      })
                  }
                  

                  這篇關于如何在 openweather API 中獲取地理位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                  1. <legend id='cLuLK'><style id='cLuLK'><dir id='cLuLK'><q id='cLuLK'></q></dir></style></legend>

                      <tbody id='cLuLK'></tbody>
                  2. <small id='cLuLK'></small><noframes id='cLuLK'>

                    <i id='cLuLK'><tr id='cLuLK'><dt id='cLuLK'><q id='cLuLK'><span id='cLuLK'><b id='cLuLK'><form id='cLuLK'><ins id='cLuLK'></ins><ul id='cLuLK'></ul><sub id='cLuLK'></sub></form><legend id='cLuLK'></legend><bdo id='cLuLK'><pre id='cLuLK'><center id='cLuLK'></center></pre></bdo></b><th id='cLuLK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cLuLK'><tfoot id='cLuLK'></tfoot><dl id='cLuLK'><fieldset id='cLuLK'></fieldset></dl></div>
                      <tfoot id='cLuLK'></tfoot>

                            <bdo id='cLuLK'></bdo><ul id='cLuLK'></ul>
                          • 主站蜘蛛池模板: 99久久精品国产一区二区三区 | 成人在线小视频 | 干干干操操操 | 日韩一区精品 | 亚洲视频在线观看 | 99免费在线观看 | 欧美日在线 | 偷派自拍 | 久久不卡 | 欧美4p| 国产伦精品一区二区三区照片91 | 国产在线视频在线观看 | 国产精品毛片一区二区在线看 | 在线一区视频 | 99精品欧美一区二区三区综合在线 | 在线2区| 亚洲精品女优 | 国产成人精品一区 | 亚洲综合婷婷 | 国产精品久久久亚洲 | 色狠狠一区 | 亚洲大片在线观看 | 国产精品久久久久久久久久软件 | 亚洲国产一区视频 | 男女爱爱福利视频 | 国产一区二区av | 精品国产亚洲一区二区三区大结局 | 黄色网络在线观看 | 91久久| 国产精品一二区 | 国产精品久久久久久吹潮日韩动画 | 综合国产 | 天天色图| 夜夜艹 | 国产成人精品久久二区二区91 | 亚洲 一区 | 免费精品 | 日韩中文字幕免费在线 | 日韩视频在线观看 | 一区二区伦理电影 | 亚洲精品久久久久久一区二区 |