openlayers學習記錄

2021-08-25 13:39:11 字數 4595 閱讀 1236

openlayers.util.getelement:

以陣列的形式返回所有引數在document中的dom元素

openlayers.util.getelement的別名

openlayers.util.extend(目標物件,原物件):

將原物件中的所有非「undefined」屬性拷貝到目標物件(包括"tostring"函式)

openlayers.util.removeitem:

從陣列中移除所有指定的物件

openlayers.util.cleararray:

陣列長度置0,清除陣列所有內容

openlayers.util.indexof:

查詢元素在陣列中第一次出現的位置,若找不到返回「-1」

openlayers.util.modifydomelement:

修改dom元素屬性。引數:1,dom元素;2,新的id;3,左上角位置;4,寬頻和高度;5,定位方式(絕對或相對);6,邊界寬度;7,當物件的內容超過其指定高度及寬度時如何管理內容;8,透明度

openlayers.util.creatediv:

建立dom元素div。引數:1,div元素的id,若未指定則使用openlayers.util.createuniqueid("openlayersdiv")建立乙個;2,左上角位置;3,寬頻和高度;4,imgurl:背景url;5,定位方式(絕對或相對);6,邊界寬度;7,當物件的內容超過其指定高度及寬度時如何管理內容;8,透明度

openlayers.util.createimage:

openlayers.util.setopacity:

設定dom元素透明度

openlayers.util.onimageload:

繫結到(由createimage或createalphaimagediv建立的)image載入事件,img元素載入完成後清除背景顏色將顯示出來

openlayers.util.onimageloaderror:

嘗試指定次數(預設1次)仍未成功後將背景顏色設定為指定顏色(「pink」),將display設為「」

openlayers.util.alphahack:

檢測瀏覽器是否支援png透明

openlayers.util.modifyalphaimagediv:

修改div及其中img的屬性。引數:1,要修改的dom元素div;2,新的id;3,左上角位置;4,div和img新的寬頻和高度;5,imgurl:div中img新的url;6,定位方式(絕對或相對);7,div中新的邊界寬度;8,sizing:設定div縮放屬性;9,設定div透明度

openlayers.util.createalphaimagediv:

openlayers.util.uppercaseobject:

將陣列的索引轉化為大寫(值不變)

將原物件中存在而目標物件中不存在的屬性拷貝到目標物件中

openlayers.util.getparameterstring:

將陣列轉化為url引數部分(&連線)形式的字串

openlayers.util.getimageslocation:

取儲存img檔案的相對路徑

openlayers.util.try:

依次執行引數中的函式,當有乙個成功執行後,便返回其結果

openlayers.util.getnodes:

以陣列的形式返回指定元素的所有子元素中nodename為指定名字的所有元素。引數:1,p:待掃瞄的父元素;2,要比對的結點名稱

openlayers.util._getnodes:

返回一堆元素中nodename為指定名稱的所有元素

openlayers.util.gettagtext:

返回被掃瞄物件「parents」的第「index」個指定「item」結點名稱的結點的第2個(如只有1個則是第1個)子結點的值

openlayers.util.getxmlnodevalue:

依次嘗試取值node.text,node.textcontent,node.firstchild.nodevalue

openlayers.util.mouseleft(evt,div):

如果evt的物件或物件的祖先物件是div,則返回true

openlayers.util.rad:

由半徑得到對應的1°弧長

openlayers.util.distvincenty:

測量兩點之間的距離。wgs-84座標系是目前gps所採用的座標系統,gps所發布的星曆引數就是基於此座標系統的。 wgs-84座標系統的全稱是world geodical system-84(世界大地座標系-84),它是乙個地心地固座標系統。wgs-84座標系統由美國國防部製圖局建立,於2023年取代了當時gps所採用的座標系統―wgs-72座標系統而成為gps的所使用的座標系統。wgs-84座標系的座標原點位於地球的質心,z軸指向bih1984.0定義的協議地球極方向,x軸指向bih1984.0的啟始子午面和赤道的交點,y軸與x軸和z軸構成右手系。採用橢球引數為: a = 6378137m f = 1/298.257223563

openlayers.util.getparameters:

提取url引數部分,並解析成陣列的形式返回

openlayers.util.getargs:

openlayers.util.getparameters的別名,3.0版本中將移除

openlayers.util.createuniqueid:

建立全域性唯一的id。引數:prefix,id字首,若未指定則為「id_」

openlayers.util.normalizescale:

若引數大於1則返回其倒數,否則直接返回原引數

openlayers.util.getresolutionfromscale:

由比例得解析度

openlayers.util.getscalefromresolution:

由解析度的比例

openlayers.util.safestoppropagation:

安全的停止事件傳遞,但沒有防止瀏覽器預設動作。此函式已停用。改用openlayers.event.stop(evt, true)。

openlayers.util.pageposition:

計算dom元素在頁面中的位置

openlayers.util.isequivalenturl:

根據給定的引數options(預設ignorecase,ignoreport80,ignorehash)比對兩個url是否等值

openlayers.util.createurlobject:

由url位址和options建立urlobject

openlayers.util.removetail:

移除url位址在「?」和「#」之後的部分

openlayers.util.getbrowsername:

檢測瀏覽器名稱

openlayers.util.getrendereddimensions:

計算要彈出內容要占用的空間大小

openlayers.util.getscrollbarwidth:

取滾動條寬度

openlayers 學習筆記(一)

拷貝目錄下的openlayer.js 根目錄下的lib目錄 根目錄下的img目錄到你 的scripts目錄下 當然,這個只是例子,您 的目錄結構您自己說得算,只要保證openlayers.js,lib,img在同一目錄中即可 然後,建立乙個 html作為檢視地圖的頁面。環境 geoserver1.7...

OpenLayers開發學習(一)

由於專案需要,最近開始學習openlayers開發gis客戶端,它的優勢咱就不說了。以前基本上沒學習過js之類的東西,這次突然要立馬就上,開發起來顯得很吃力,而且網上的api寫的也不是很清楚,那只有靠自己並摸索和並學習了。在開發中遇到的第一問題是 openlayers如何呼叫arcgis serve...

openlayers學習小知識 持續更新

1 限制地圖縮放級別 在view中定義屬性minzoom和maxzoom,可以設定地圖縮放的最小級別和最大級別 2 動態設定地圖的縮放級別 使用map.getview 方法獲取地圖當前的view,view.getzoom獲取當前檢視的縮放級別,view.setzoom設定檢視的縮放級別,map.se...