use tianditu

This commit is contained in:
wlx 2014-06-15 07:22:56 +00:00
parent 83a42c50b8
commit a43b45863d
1 changed files with 30 additions and 21 deletions

View File

@ -18,6 +18,7 @@ h3.gs_rt{font-size:110%;}
#file-list li:hover {background-color: #f5f5f5;}
#file-list li li:hover {background-color: #dedede;}
#file-list li li li:hover {background-color: #eeeeee;}
#watermap img {max-width:none;}
</style>
<?php $md=$this->metadata;if ($md):?>
<h3><?php echo $this->escape($md->title);
@ -498,15 +499,7 @@ endforeach;
</div>
<script src="/js/metadata-view.js"></script>
<script type="text/javascript" charset="utf-8">
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
//script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
//document.body.appendChild(script);
}
window.onload = loadScript;
$(function() {
//google.maps.event.addDomListener(window, 'load', initialize);
$(".colorbox").colorbox({photo:"true"});
$('.googlesearch').click(function(){googleSearch('<?php echo $ev;?>');});
$('.bingsearch').click(function(){bingSearch('<?php echo $ev;?>');});
@ -555,26 +548,42 @@ function ajaxpage(page){
ajaxpage_get(page,'<?= $md->uuid; ?>');
}
var map;
var zoom = 12;
var config = { projection: "EPSG:4326"}
//初始化地图对象
map=new TMap("watermap",config);
//设置显示地图的中心点和级别
zoom=<?php if ($md->north==$md->south) { ?> 10 <?php }else {?> 6 <?php }?>;
var map=new TMap("watermap",config);
var lat=<?= ($md->south+$md->north)/2; ?>;
var lng=<?= ($md->east+$md->west)/2; ?>;
map.centerAndZoom(new TLngLat(lng,lat),zoom);
map.centerAndZoom(new TLngLat(lng,lat),12);
map.setMapType(TMAP_HYBRID_MAP);
<?php if ($md->north==$md->south && $md->east==$md->west) :?>
var marker=new TMarker(new TLngLat(lng,lat));
map.addOverLay(marker);
<?php else :?>
var p1=new TLngLat(<?= $md->west ?>,<?= $md->south ?>);
var p2=new TLngLat(<?= $md->west ?>,<?= $md->north ?>);
var p3=new TLngLat(<?= $md->east ?>,<?= $md->north ?>);
var p4=new TLngLat(<?= $md->east ?>,<?= $md->south ?>);
map.setViewport(new Array(p1,p2,p3,p4));
var bounds = new TBounds(<?= $md->west; ?>,<?= $md->south; ?>,<?= $md->east; ?>,<?= $md->north; ?>);
var config = {
strokeColor:"blue", //折线颜色
fillColor:"#FFFFFF", //填充颜色。当参数为空时,折线覆盖物将没有填充效果
strokeWeight:"5px", //折线的宽度,以像素为单位
opacity:0.5, //折线的透明度取值范围0 - 1
strokeStyle:"solid" //折线的样式solid或dashed
strokeWeight:"3px", //折线的宽度,以像素为单位
opacity:0.3, //折线的透明度取值范围0 - 1
strokeStyle:"dashed" //折线的样式solid或dashed
};
var rect = new TRect(bounds,config);
map.addOverLay(rect);
//map.zoomOut();
<?php endif; ?>
var config = {
type:"TMAP_NAVIGATION_CONTROL_SMALL", //缩放平移的显示类型
anchor:"TMAP_ANCHOR_TOP_LEFT", //缩放平移控件显示的位置
offset:[0,0], //缩放平移控件的偏移值 showZoomInfo:true //是否显示级别提示信息true表示显示false表示隐藏。
};
//创建缩放平移控件对象
control=new TNavigationControl(config);
//添加缩放平移控件
map.addControl(control);
function addfavorite(url,title){
var fav_url = url;