MSCBSC 移動(dòng)通信論壇
搜索
登錄注冊
網(wǎng)絡(luò)優(yōu)化工程師招聘專欄 4G/LTE通信工程師最新職位列表 通信實(shí)習(xí)生/應(yīng)屆生招聘職位

  • 閱讀:2456
  • 回復(fù):0
天地圖在基于OpenLayers的服務(wù)器端進(jìn)行部署的方法
南方姑娘
初級(jí)會(huì)員
鎵嬫満鍙風(fēng)爜宸查獙璇? style=


 發(fā)短消息    關(guān)注Ta 

積分 88
帖子 18
威望 2938 個(gè)
禮品券 0 個(gè)
專家指數(shù) -2
注冊 2015-8-14
專業(yè)方向  gis地理信息
回答問題數(shù) 0
回答被采納數(shù) 0
回答采納率 0%
 
發(fā)表于 2015-08-31 15:37:41  只看樓主 

一、準(zhǔn)備工作

1、 到OpenLayers的官方網(wǎng)站下載壓縮包,如下圖所示。





2、到水經(jīng)注軟件官方網(wǎng)站下載《天地圖衛(wèi)星地圖下載器》。

軟件下載地址:http://www.rivermap.cn/


二、下載示例數(shù)據(jù)

這里以《天地圖衛(wèi)星地圖下載器》為你說明如何下載天地圖衛(wèi)星地圖。

安裝天地圖衛(wèi)星地圖下載器以后,啟動(dòng)軟件,如下圖所示。





由于只是為了作演示說明如何在OpenLayers中使用離線衛(wèi)星地圖,這里我們只需要框選中國范圍,即點(diǎn)擊工具欄上的“框選下載區(qū)域”,然后在視圖中繪制選擇范圍,如下圖所示。





在范圍中雙擊鼠標(biāo)左鍵,顯示新建任務(wù)對話框,在該對話框中我們只選擇3到7級(jí)進(jìn)行下載即可,如下圖所示。




下載完成后,導(dǎo)出ArcGIS Server瓦片,如下圖所示。




點(diǎn)擊“輸出”按鈕,開始導(dǎo)出。

等待導(dǎo)出完畢,會(huì)在D盤Test目錄看到“中國_ArcgisServerTiles”這個(gè)文件夾,如下圖所示。





然后將“中國_ArcgisServerTiles”文件夾重命名為“data”,如下圖所示。






三、服務(wù)器端地圖引擎配置

第一步:將下載的OpenLayers-2.13.1.zip解壓到D盤Test目錄。如下圖所示。





第二步:新建網(wǎng)站

在IIS中新建網(wǎng)站,如下圖所示。





這里我們將網(wǎng)站命名為“TEST”,物理路徑設(shè)置為“D:\Test”,端口設(shè)置為“8080”,如下圖所示。




第三步:將以下代碼復(fù)制并保存為html文件(如“Example_ArcGIS Server.html”),放到“D:\Test\OpenLayers-2.13.1\examples”目錄中。


==============================代碼開始=============================

<!DOCTYPE html>

<html>

<head>

<title>ArcGIS Server Map Cache Example (Direct Access)</title>

<meta http-equiv="Content-Type" c>

<link rel="stylesheet" href="OpenLayers-2.13.1/theme/default/style.css" type="text/css">

<link rel="stylesheet" href="style.css" type="text/css">

<script src="../lib/OpenLayers.js"></script>

<script src="../lib/OpenLayers/Layer/ArcGISCache.js" type="text/javascript"></script>

<script type="text/javascript">

/* First 4 variables extracted from conf.xml file */


/* Tile layers & map MUST have same projection */

var proj = 'EPSG:4326';



/* Layer can also accept serverResolutions array

* to deal with situation in which layer resolution array & map resolution

* array are out of sync*/

var mapResolutions = [

1.40625,

0.703125,

0.3515625,

0.17578125,

0.087890625,

0.0439453125,

0.02197265625,

0.010986328125,

0.0054931640625,

0.00274658203125,

0.001373291015625,

0.0006866455078125,

0.00034332275390625,

0.000171661376953125,

0.0000858306884765625,

0.00004291534423828125,

0.000021457672119140625,

0.0000107288360595703125,

0.00000536441802978515625,

0.000002682209014892578125,

0.0000013411045074462890625,

0.00000067055225372314453125

];


/* For this example this next line is not really needed, 256x256 is default.

* However, you would need to change this if your layer had different tile sizes */

var tileSize = new OpenLayers.Size(256, 256);


/* Tile Origin is required unless it is the same as the implicit map origin

* which can be affected by several variables including maxExtent for map or base layer

*/

var agsTileOrigin = new OpenLayers.LonLat(-180, 90);


/* This can really be any valid bounds that the map would reasonably be within */

/*var mapExtent = new OpenLayers.Bounds

(293449.454286,4307691.661132,314827.830376,4323381.484178); */

var mapExtent = new OpenLayers.Bounds(-180, -90, 180, 90);


var aerialsUrl = 'http://localhost:8080/data/_alllayers';


var map;

function init() {

map = new OpenLayers.Map('map', {

maxExtent: mapExtent,

controls: [

new OpenLayers.Control.Navigation(),

new OpenLayers.Control.LayerSwitcher(),

new OpenLayers.Control.PanZoomBar(),

});


var baseLayer = new OpenLayers.Layer.ArcGISCache('Aerials', aerialsUrl, {

tileOrigin: agsTileOrigin,

resolutions: mapResolutions,

sphericalMercator: false,

maxExtent: mapExtent,

useArcGISServer: false,

isBaseLayer: true,

type: 'jpg',

projection: proj

});

map.addLayers([baseLayer]);


//map.zoomToExtent(new OpenLayers.Bounds(295892.34, 4308521.69, 312825.71, 4316988.37));

map.setCenter(new OpenLayers.LonLat(103,31).transform

(map.displayProjection, map.getProjectionObject()), 3);

}

</script>

</head>

<body >

<h1 id="title">

ArcGIS Server Map Cache Example (Direct Access)</h1>

<div id="tags">

</div>

<p id="shortdesc">

Demonstrates the basic initialization of the ArcGIS Cache layer using a prebuilt

configuration, and direct tile access from a file store.

</p>

<div id="map" class="smallmap">

</div>

<div id="docs">

<p>

This example demonstrates using the ArcGISCache layer for accessing ESRI's ArcGIS

Server (AGS) Map Cache tiles directly via the folder structure and HTTP. Toggle

the visibility of the AGS layer to demonstrate how the two maps are lined up

correctly.</p>

<h2>

Notes on this Layer</h2>

<p>

It's important that you set the correct values in your layer, and these values will

differ between tile sets. You can find these values for your layer in conf.xml at

the root of your cache. (ie. <a

href="http://serverx.esri.com/arcgiscache/dgaerials/Layers/conf.xml">

http://serverx.esri.com/arcgisca ... /conf.xml</a>)</p>

<p>

For fused map caches this is often

http:<i>ServerName</i>/arcgiscache/<i>MapServiceName</i>/Layers

<br>

For individual layer caches this is often

http:<i>ServerName</i>/arcgiscache/<i>LayerName</i>/Layers

</p>

<h2>

Other Examples

</h2>

<p>

This is one of three examples for this layer. You can also configure this layer

to use <a href="arcgiscache_ags.html">prebuilt tiles from a live server.</a> It

is also possible to let this <a href="arcgiscache_jsonp.html">layer 'auto-configure'

itself using the capabilities json object from the server itself when using a live

ArcGIS server.</a>

</p>

</div>

</body>

</html>

==============================代碼結(jié)束=============================


第四步:雙擊打開剛才保存的文件,如果部署正確,則將會(huì)顯示離線WGS84衛(wèi)星地圖的瀏覽結(jié)果,如下圖所示。




當(dāng)然,你也可以通過以下網(wǎng)址進(jìn)行訪問,效果也是一樣的。

http://localhost:8080/OpenLayers-2.13.1/examples/Example_ArcGIS%20Server.html

以上即是如何將天地圖基于OpenLayers在服務(wù)器端進(jìn)行部署的全部過程及示例源碼,你可以基于此平臺(tái)并根據(jù)自己的實(shí)際需求作進(jìn)一步開發(fā)了。

掃碼關(guān)注5G通信官方公眾號(hào),免費(fèi)領(lǐng)取以下5G精品資料
  • 1、回復(fù)“YD5GAI”免費(fèi)領(lǐng)取《中國移動(dòng):5G網(wǎng)絡(luò)AI應(yīng)用典型場景技術(shù)解決方案白皮書
  • 2、回復(fù)“5G6G”免費(fèi)領(lǐng)取《5G_6G毫米波測試技術(shù)白皮書-2022_03-21
  • 3、回復(fù)“YD6G”免費(fèi)領(lǐng)取《中國移動(dòng):6G至簡無線接入網(wǎng)白皮書
  • 4、回復(fù)“LTBPS”免費(fèi)領(lǐng)取《《中國聯(lián)通5G終端白皮書》
  • 5、回復(fù)“ZGDX”免費(fèi)領(lǐng)取《中國電信5G NTN技術(shù)白皮書
  • 6、回復(fù)“TXSB”免費(fèi)領(lǐng)取《通信設(shè)備安裝工程施工工藝圖解
  • 7、回復(fù)“YDSL”免費(fèi)領(lǐng)取《中國移動(dòng)算力并網(wǎng)白皮書
  • 8、回復(fù)“5GX3”免費(fèi)領(lǐng)取《 R16 23501-g60 5G的系統(tǒng)架構(gòu)1
  • 對本帖內(nèi)容的看法? 我要點(diǎn)評

     
    [充值威望,立即自動(dòng)到帳] [VIP貴賓權(quán)限+威望套餐] 另有大量優(yōu)惠贈(zèng)送活動(dòng),請光臨充值中心
    充值擁有大量的威望和最高的下載權(quán)限,下載站內(nèi)資料無憂

    快速回復(fù)主題    
    標(biāo)題
    內(nèi)容
     上傳資料請點(diǎn)左側(cè)【添加附件】

    當(dāng)前時(shí)區(qū) GMT+8, 現(xiàn)在時(shí)間是 2025-02-02 16:12:22
    渝ICP備11001752號(hào)  Copyright @ 2006-2016 mscbsc.com  本站統(tǒng)一服務(wù)郵箱:mscbsc@163.com

    Processed in 0.387733 second(s), 14 queries , Gzip enabled
    TOP
    清除 Cookies - 聯(lián)系我們 - 移動(dòng)通信網(wǎng) - 移動(dòng)通信論壇 - 通信招聘網(wǎng) - Archiver