因此,我试图创建一个动态加载到雷达回路站点,该站点与Google Map API v3 混合
目前,我只想画一条从1到另一条的线,并希望在12倍上获得天气中心
function initialize() {
var myLatlng = new google.maps.LatLng(34.01115000,-84.27939000);
var mapOptions = {
zoom: 12,
center: new google.maps.LatLng(34.01115000,-84.27939000),
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var flightPlanCoordinates = [
new google.maps.LatLng(34.01115000,-84.27939000),
new google.maps.LatLng(34.03050000,-84.35833000),
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
geodesic: true,
strokeColor: '#0000FF',
strokeOpacity: 5.8,
strokeWeight: 10,
fillOpacity: 0.35
});
flightPath.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
但在这里,我想加载雷达循环并以某种方式更新纬度/经度,但仍然自动移动地图并调整雷达。
http://radblast.wunderground.com/cgi-bin/radar/WUNIDS_composite?maxlat=34.96496076302826&maxlon=-89.51954101562501&minlat=29.3895807652275&minlon=-98.30860351562501&type=00Q&帧=0&num=7&延迟=25&宽度=800&高度=600&png=0&smooth=1&min=0&noclutter=1&雨雪=1&nodebug=0&theext=.gif&merge=elev&repoj.automerc=1&时间标签=1&timelabel.x=200&timelabel.y=12&brand=神童地图&rand=4564
我可能正在接近
我试图不提供边界,并从默认的Zoom 中获取它们
bounds=新的OpenLayers.bounds(-150.620375523875420、21.652538062803、-80.517937876818、50.406626367301044);
defaultLatCenter = 32;
defaultLonCenter = -97;
defaultZoom = 6;
proj4326 = new OpenLayers.Projection("EPSG:4326");
proj900913 = new OpenLayers.Projection("EPSG:900913");
init = function() {
gphy = new OpenLayers.Layer.Google("Google Physical", {
});
osm = new OpenLayers.Layer.OSM("openstreetmap");
map = new OpenLayers.Map("map");
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addLayers([gphy, osm]);
map.setCenter(new OpenLayers.LonLat(defaultLonCenter, defaultLatCenter).transform(proj4326,map.getProjectionObject()), defaultZoom);
bounds = new OpenLayers.Bounds(-150.620375523875420, 21.652538062803, -80.517937876818, 50.406626367301044);
bounds.transform(proj4326, map.getProjectionObject());
var ol_proj;
var g_proj;
ol_proj = new OpenLayers.Projection("EPSG:4326");
g_proj = new OpenLayers.Projection("EPSG:900913");
var currentbounds; //OL.Bounds object
currentbounds = map.calculateBounds();
ol_currentbounds = currentbounds.clone().transform(g_proj,ol_proj);
var currentsize; //OL.Size object
currentsize = map.getCurrentSize();
var radblastUrl = "http://radblast.wunderground.com/cgi-bin/radar/WUNIDS_composite?" +
"maxlat=" + ol_currentbounds.top +
"&maxlon=" + ol_currentbounds.right +
"&minlat=" + ol_currentbounds.bottom +
"&minlon=" + ol_currentbounds.left +
"&type=N0R&frame=0&num=7&delay=10" +
"&width=" + currentsize.w +
"&height=" + currentsize.h +
"&png=0&smooth=1&min=0&noclutter=0&rainsnow=1&nodebug=0&theext=.gif&merge=elev" +
"&reproj.automerc=1&timelabel=1&timelabel.x=200&timelabel.y=12&brand=wundermap";
var radar_overlay2 = new OpenLayers.Layer.Image("Animated Radar", radblastUrl, currentbounds, currentsize, {
opacity: 0.7,
isBaseLayer: false
});
radar_overlay = new OpenLayers.Layer.Image('radar', 'http://radar.weather.gov/ridge/Conus/RadarImg/latest_radaronly.gif', bounds, new OpenLayers.Size(3400, 1600),
{
'isBaseLayer': false,
'alwaysInRange': true
});
map.addLayer(radar_overlay2);
// map.addLayers([radar_overlay]);
radar_overlay.setZIndex(150);
radar_overlay.setOpacity(0.7);
window.radar_overlay = radar_overlay;
};
不确定这是否能用Openlayer覆盖谷歌地图。我喜欢尝试并坚持使用谷歌地图,因为我知道如何设置标记/折线图/信息框,因为我不知道如何使用openlayers
你能使用叠加的添加到层吗