2012-03-12 3 views
2

Google 내지도와 마찬가지로 날씨 오버레이 옵션을 Google지도에 추가하려면 어떻게해야하나요? 검색해 보았지만 답변을 찾을 수 없습니다.google map api v3 날씨 정보

날씨 웹 서비스에 전화해야합니까?

+1

WeatherLayer는 http://googlegeodevelopers.blogspot.com.au/2014/06/sunsetting-javascript-api-weather-panoramio.html – yulie

답변

3

당신은 두 단계를 고려하여지도에 WeatherLayer dev-guide을 표시 할 수 있습니다

첫째, URL에 libraries 매개 변수를 추가하면지도로드를 사용하여 WeatherLayer 라이브러리를로드 :

<script type="text/javascript" 
    src="http://maps.googleapis.com/maps/api/js?libraries=weather&sensor=false"> 
</script> 

을 그런 다음 WeatherLayerOptionsapi-doc 객체의 모든 옵션을 전달하는 google.maps.weather.WeatherLayerapi-doc 클래스의 인스턴스를 생성하고 맵에 WeatherLayer를 첨부해야합니다

WeatherLayer 외에도
var weatherLayer = new google.maps.weather.WeatherLayer({ 
    temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT 
}); 
weatherLayer.setMap(map); 

가 있는데, 별도의 google.maps.weather.CloudLayer는 비슷한 방법으로 만들 수 있습니다 api-doc 클래스 :

var cloudLayer = new google.maps.weather.CloudLayer(); 
cloudLayer.setMap(map); 

을 당신이 CloudLayer를 사용하여로드해야합니다 별도의 라이브러리가 없습니다; 지도를로드하는 URL에 libraries=weather 매개 변수를 추가하면지도에서 WeatherLayer와 CloudLayer를 모두 사용할 수 있습니다. 거기에 Google Maps JavaScript API v3 Example: Weather Layer으로 두 레이어의 사용법을 보여줍니다.

1

날씨 레이어와 함께 Google지도 apiv3을 사용하려고하면 같은 문제가 발생합니다. 그러나 운좋게도이 사이트가 모든 Google map api v3 샘플을 제공하며 작동하는이 사이트 http://code.google.com/p/gmaps-samples-v3/을 발견했습니다. 희망이 도움이됩니다.

쿠옹 Vo에

+0

게시물에 관련 코드를 추가하십시오 더 이상 사용할 수 없습니다 . –