Google web 加载自己发布的kml数据
2010-03-06 14:37
561 查看
官网实例http://code.google.com/apis/ajax/playground/?exp=earth#hello,_earth
APi查看http://code.google.com/intl/zh-CN/apis/earth/documentation/reference/index.html
//加载kml文件
function addKML(url) {
//DS_ge为整个web控件对象
google.earth.fetchKml(DS_ge,url,function(kmlObject)
{
/**
if (!kmlObject) {
// show error
setTimeout(function() {
alert('Error loading KML.');
}, 0);
return;
}
else
{
DS_ge.getFeatures().appendChild(kmlObject);
});
}
url为数据发布的路径
在初始化成功initCallback函数里加入addKML(url)
function initCallback(object) {
DS_ge = object;
tools= new Tools();
DS_ge.getWindow().setVisibility(true);
//这里发布的数据是geoserver发布的wms数据,也可以说kml文件
addKML("http://192.168.0.33:8080/geoserver/wms/kml?layers=nci:ORA_GIS_TRANS_LINE");
addKML("http://192.168.0.33:8080/test/pt.kml");
var la = DS_ge.createLookAt('');
la.set(defaultview.lat,defaultview.lng,
defaultview.altitude, //高度
DS_ge.ALTITUDE_RELATIVE_TO_GROUND,
0, // heading
0, // straight-down tilt
50000 // range (inverse of zoom)
);
DS_ge.getView().setAbstractView(la);
tool_operate("0","select");
addToolbar();
changeMapToOverviewMap();
createNativeHTMLButton(locationx-hawkeyeIframe_width, locationy-hawkeyeIframe_heigt, hawkeyeIframe_width,hawkeyeIframe_heigt); // x, y, width, height
}
APi查看http://code.google.com/intl/zh-CN/apis/earth/documentation/reference/index.html
//加载kml文件
function addKML(url) {
//DS_ge为整个web控件对象
google.earth.fetchKml(DS_ge,url,function(kmlObject)
{
/**
if (!kmlObject) {
// show error
setTimeout(function() {
alert('Error loading KML.');
}, 0);
return;
}
else
{
DS_ge.getFeatures().appendChild(kmlObject);
});
}
url为数据发布的路径
在初始化成功initCallback函数里加入addKML(url)
function initCallback(object) {
DS_ge = object;
tools= new Tools();
DS_ge.getWindow().setVisibility(true);
//这里发布的数据是geoserver发布的wms数据,也可以说kml文件
addKML("http://192.168.0.33:8080/geoserver/wms/kml?layers=nci:ORA_GIS_TRANS_LINE");
addKML("http://192.168.0.33:8080/test/pt.kml");
var la = DS_ge.createLookAt('');
la.set(defaultview.lat,defaultview.lng,
defaultview.altitude, //高度
DS_ge.ALTITUDE_RELATIVE_TO_GROUND,
0, // heading
0, // straight-down tilt
50000 // range (inverse of zoom)
);
DS_ge.getView().setAbstractView(la);
tool_operate("0","select");
addToolbar();
changeMapToOverviewMap();
createNativeHTMLButton(locationx-hawkeyeIframe_width, locationy-hawkeyeIframe_heigt, hawkeyeIframe_width,hawkeyeIframe_heigt); // x, y, width, height
}
相关文章推荐
- 使用 XSLT、KML 和 Google Maps API 在地图上覆盖数据,第 1 部分:利用 Google Geocoder Web 服务
- ArcGIS for Android 加载自己发布的地图却不显示
- 【iOS开发】SDWebImage框架,加载图片,失败之后,居然直接跳过不再去请求网络数据了?
- skyline无插件web的数据加载解析
- 如何利用自己的电脑做服务器发布tomcat的WEB项目供外网访问
- openLayers3加载GeoWebCache发布ArcGIS切片
- RaceWeb介绍(8):由500强公司数据快速生成百度地图——设置页面参数,并一键发布
- Service Worker让Web应用也能离线、即时加载(Google开发者大会演讲PPT&视频)
- 自己动手写web服务器四(web服务器是如何通过压缩数据,web服务器的gzip模块的实现)
- WEB数据传输——ajax加载数据
- 一步步DIY: OSM-Web服务器(七) 利用 Google WebService 批量下载遥感瓦片数据
- 关于pom.xml,加载自己的jar包,把本地jar包发布到服务器
- Web前台直接加载GIS格式数据分析
- 如何利用自己的电脑做服务器发布tomcat的WEB项目供外网、局域网访问
- 【Android调试】用手机加载自己刚刚发布成功的地图服务,显示空白
- 未能加载文件或程序集system.web.extensions解决方法(vs08(默认为3.5)发布成版本为2.0的方法)
- 自己兴趣使然设计并开发了一款web管理方式的远程数据增量备份/恢复软件
- 最新Google Web Toolkit发布
- 如何在自己的网页中调用外部的搜索引擎:google、百度web接口
- 一步步DIY: OSM-Web服务器(七) 利用 Google WebService 批量下载遥感瓦片数据