new CMapDocument(EPSGNum)
地圖文件
| Name | Type | Description |
|---|---|---|
EPSGNum |
number |
預設坐標系統編碼 |
Example
var a = new CMapDocument(3826);
a.NewXXXXXX();
Members
-
readonlyBaseLayer
-
取得底圖
Properties:
Name Type Description retCLayer2D 回傳值
-
readonlyBoundary
-
所有圖層邊界的總和
Properties:
Name Type Description 圖層邊界GeoBoundary -
readonlyHasBaseLayer
-
是否有底圖
Properties:
Name Type Description retbool 回傳值
-
readonlyIsBind
-
是否已綁定
Properties:
Name Type Description retboolean 回傳值
-
readonlyLayerNames
-
所有圖層名稱
Properties:
Name Type Description 圖層名稱陣列Array.<string> -
readonlyLayers
-
所有圖層Id
Properties:
Name Type Description 圖層陣列Array.<Layer2D> | null -
readonlylength
-
圖層的數量
Properties:
Name Type Description retnumber 回傳值
-
readonlyMaxResolution
-
所有圖層中,最大的最大解析度
Properties:
Name Type Description MaxResolutionnumber 最大解析度
-
readonlyMinResolution
-
所有圖層中,最小的最小解析度
Properties:
Name Type Description MinResolutionnumber 最小解析度
Methods
-
DoCommand(url, Parm, callback, FastMode){object}
openlayers/MapDocument.js, line 4699 -
執行指令
Name Type Description urlstring 指令完整網址
Parmobject 參數物件
callbackcallback 回呼函式,有給值(不為null)會進入非同步模式,結果會由Callback返回;無給值為同步模式,結果會由DoCommand返回。
FastModeboolean 快速模式,只能在非同步下運作,傳輸會是Bindary比較少,預設為false傳JSON物件。
Returns:
Type Description object 同步時回傳答案,失敗回傳null,若非同步則不會回傳。 -
DoCommandAsync(Url, Command, Parm){object}
openlayers/MapDocument.js, line 4751 -
用PilotGaea習慣的參數執行非同步指令
Name Type Description Urlstring IP(含port)字串,如:http://140.110.20.147:8080
Commandstring 指令名稱
Parmobject 參數物件
Returns:
Type Description object 回傳的值有[sucess],[ID]可取得值。 -
DoCommandAsync_Abort(Url, Id){object}
openlayers/MapDocument.js, line 4785 -
要求停止非同步指令
Name Type Description Urlstring IP(含port)字串,如:http://140.110.20.147:8080
Idnumber 非同步指令目標的ID
Returns:
Type Description object 同步時回傳答案,失敗回傳null,若非同步則不會回傳。 -
DoCommandAsync_GetData(Url, Id){object}
openlayers/MapDocument.js, line 4774 -
取得非同步指令的資料(無論是否完成)
Name Type Description Urlstring IP(含port)字串,如:http://140.110.20.147:8080
Idnumber 非同步指令目標的ID
Returns:
Type Description object 同步時回傳答案,失敗回傳null,若非同步則不會回傳。 -
DoCommandAsync_GetProgress(Url, Id){object}
openlayers/MapDocument.js, line 4763 -
取得非同步的進度
Name Type Description Urlstring IP(含port)字串,如:http://140.110.20.147:8080
Idnumber 非同步指令目標的ID
Returns:
Type Description object 同步時回傳答案,失敗回傳null,若非同步則不會回傳。 -
DoCommandFromPilotGaea(IP, Port, Command, Parm, callback, FastMode){object}
openlayers/MapDocument.js, line 4720 -
用PilotGaea習慣的參數執行指令
Name Type Description IPstring IP字串
Portnumber 埠號數字
Commandstring 指令名稱
Parmobject 參數物件
callbackcallback 回呼函式,非同步必給,同步可不給或給null
FastModeboolean 快速模式,只能在非同步下運作,傳輸會是Bindary比較少,預設為false傳JSON物件
Returns:
Type Description object 同步時回傳答案,失敗回傳null,若非同步則不會回傳。 -
DoCommandFromPilotGaea2(Url, Command, Parm){object}
openlayers/MapDocument.js, line 4739 -
用PilotGaea習慣的參數執行指令
Name Type Description Urlstring IP(含port)字串,如:http://140.110.20.147:8080
Commandstring 指令名稱
Parmobject 參數物件
Returns:
Type Description object 同步時回傳答案,失敗回傳null,若非同步則不會回傳。 -
FindLayerByName(Name){CLayer2D}
openlayers/MapDocument.js, line 4680 -
依圖層名稱尋找圖層
Name Type Description Namestring 指定圖層名稱
Returns:
Type Description CLayer2D 若圖層不存在,回傳null -
GetLayerInfoJson(LayerNames){string}
openlayers/MapDocument.js, line 4811 -
取得列印所需的圖層資訊以json字串表示
Name Type Description LayerNamesstring | undefined 圖層名用逗號分隔,若undefined 就拿所有顯示的圖層資訊
Returns:
Type Description string 列印所需的圖層資訊以Json字串表示 -
GetShowLayersName(){Array.<string>}
openlayers/MapDocument.js, line 4795 -
取得當前所有顯示的圖層名陣列
Returns:
Type Description Array.<string> 圖層名陣列 -
MoveLayer(pLayer, Index){bool}
openlayers/MapDocument.js, line 4631 -
移動圖層順序
Name Type Description pLayerCLayer2D 指定要更動順序的圖層
Indexnumber 新的圖層順序
Returns:
Type Description bool 更動是否成功,不論是沒有指定圖層、Index為-1或超出索引都會造成失敗 -
NewSingleTileLayer(Name, Url, Box, index){CSingleTileLayer|number}
openlayers/MapDocument.js, line 3897 -
新增單一影像地圖圖層
Name Type Description Namestring 客戶端自訂的圖層名稱
Urlstring 圖層來源網址
BoxGeoBoundary 圖層範圍的GeoBoundary
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
Returns:
Type Description CSingleTileLayer | number 圖層本身(失敗回傳0) Example
var layer1Id = MapDoc.NewSingleTileLayer("rabbit", "兔子.png", new GeoBoundary(13149614,2504688, 13775786, 3130860));
-
NewSingleTileLayerByWorldFile(Name, Url, Epsg, WorldFile, Callback, index)
openlayers/MapDocument.js, line 4035 -
使用WorldFile新增單一影像地圖圖層
Name Type Description Namestring 客戶端自訂的圖層名稱
Urlstring 圖層來源網址
Epsgnumber WorldFile所使用的EPSG
WorldFileobject World File參數
Name Type Description Anumber x方向比例(World File第1行)
Dnumber y方向偏斜(World File第2行)
Bnumber x方向偏斜(World File第3行)
Enumber y方向比例,通常為負值(World File第4行)
Cnumber 圖片左上角x座標(World File第5行)
Fnumber 圖片左上角y座標(World File第6行)
Callbackfunction 圖層新增完成後的回呼函式,function(layer)
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
-
NewSingleTileLayerRotate(Name, Url, Box, Angle, Callback, index)
openlayers/MapDocument.js, line 3933 -
新增單一旋轉影像地圖圖層
Name Type Description Namestring 客戶端自訂的圖層名稱
Urlstring 圖層來源網址
BoxGeoBoundary 圖層範圍的GeoBoundary
AngleNumber 以左上為基準的旋轉角度
Callbackfunction 圖層新增完成後的回呼函式,function(layer)
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
Example
var layer1Id = MapDoc.NewSingleTileLayerRotate("rabbit", "兔子.png", new GeoBoundary(13149614,2504688, 13775786, 3130860), 90);
-
NewTileMapLayerByMatrixSet(Name, UrlPatterns, MatrixSet, index, WMTSProxy, Token){CTileMapLayer|number}
openlayers/MapDocument.js, line 4304 -
用矩陣資訊新增圖磚圖層
Name Type Description Namestring 客戶端自訂的圖層名稱
UrlPatternsArray.<string> 圖層來源字串陣列
MatrixSetCMatrixSet 矩陣資訊
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
WMTSProxyboolean 是否使用代理,若輸入為字串則會當作代理網址直接串接,預設為false
Tokenstring 若有需要提供,Token
Returns:
Type Description CTileMapLayer | number 成功回傳圖層本身(失敗回傳0) Example
var m = CMatrixSet.MakeByEPSG(3826)
var vLayerId = myMapDoc.NewTileMapLayerByMatrixSet("我的行政區界圖", ["http://127.0.0.1/wmts?Layer=行政區界圖&style=default&TileMatrixSet=EPSG%3A3826&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={TileZ}&TileCol={TileC}&TileRow={TileR}"],m , 0, "test") -
NewTileMapLayerByPatternName(Name, URL, Identifier, index, WMTSProxy, Token){CTileMapLayer|number}
openlayers/MapDocument.js, line 4194 -
加入PilotGaea內建支援的外部服務圖層
Name Type Description Namestring 客戶端自訂的圖層名稱
URLstring 服務項目,目前支援:"BING_MAP"、"OSM"
Identifierstring | null 服務類型,BING_MAP:支援"VECTOR"、"IMAGE"和"VECTOR_IMAGE",OSM則給null即可
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
WMTSProxyboolean 是否使用代理,若輸入為字串則會當作代理網址直接串接,預設為false
Tokenstring 若有需要提供,Token
Returns:
Type Description CTileMapLayer | number 圖層本身(失敗回傳0) -
NewTileMapLayerFromPilotGaea(Name, IP, Port, ID, ImageFormat, index, Token){CTileMapLayer|number}
openlayers/MapDocument.js, line 4363 -
用PilotGaea習慣的方式給WMTS參數,非PGMapServer也許無法正常取到圖
Name Type Description Namestring 客戶端自訂的圖層名稱
IPstring IP字串
Portnumber 埠號數字
IDstring 伺服器端的真實圖層名稱
ImageFormatnumber 影像列舉ENUM_IMAGE_FORMAT,非必要。(預設是ENUM_IMAGE_FORMAT.PNG)
indexnumber 插入索引,非必要。(預設是-1,也就是Add)
Tokenstring 若有需要提供,Token
Returns:
Type Description CTileMapLayer | number 圖層本身(失敗回傳0) -
NewVectorLayer(options, index){CVectorLayer|number}
openlayers/MapDocument.js, line 4547 -
新增向量圖層
Name Type Description optionsstring | object 圖層名稱或設定選項
Name Type Description Namestring optional 圖層名稱
Indexnumber optional 插入索引
UseClusterboolean | undefined optional 是否使用叢集機制,使用叢集只能加入"點"幾何,否則會有例外
ClusterDistancenumber optional 叢集的距離
indexnumber 插入索引,非必要。(預設是-1,也就是Add)
Returns:
Type Description CVectorLayer | number 圖層本身(失敗回傳0) -
NewVectorTileLayer(Name, UrlPatterns, index, Token){CVectorTileLayer|number}
openlayers/MapDocument.js, line 4438 -
新增向量圖磚圖層
Name Type Description Namestring 客戶端自訂的圖層名稱
UrlPatternsArray.<string> 圖層來源字串陣列
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
Tokenstring 若有需要提供,Token
Returns:
Type Description CVectorTileLayer | number 圖層本身(失敗回傳0) Example
var vLayerId = myMapDoc.NewVectorTileLayer("向量圖磚", ["http://127.0.0.1:8080/WMTS/{z}/{x}/{y}.vector.mvt"],0)
var vLayerId = myMapDoc.NewVectorTileLayer("向量圖磚", ["http://127.0.0.1:8080/3826/WMTS/{z}/{x}/{y}.vector.mvt"],0) -
NewVectorTileLayerFromPilotGaea(Name, IP, Port, ID, EPSGCode, index, Token){CVectorTileLayer|number}
openlayers/MapDocument.js, line 4500 -
用PilotGaea習慣的方式給VectorTile參數,非PGMapServer也許無法正常取到圖
Name Type Description Namestring 客戶端自訂的圖層名稱
IPstring IP字串
Portnumber 埠號數字
IDstring 伺服器端的真實圖層名稱
EPSGCodenumber | undefined EPSG代碼,非必要。(預設跟MapDocument相同)
indexnumber 插入索引,非必要。(預設是-1,也就是Add)
Tokenstring 若有需要提供,Token
Returns:
Type Description CVectorTileLayer | number 圖層本身(失敗回傳0) Example
var vLayerId = myMapDoc.NewVectorTileLayerFromPilotGaea("向量圖磚", '127.0.0.1', 8080, 'WMTS')
var vLayerId = myMapDoc.NewVectorTileLayerFromPilotGaea("向量圖磚", '127.0.0.1', 8080, 'WMTS', 3826) -
NewWMSLayer(Name, Url, LayerName, ImageFormat, Box, index, Token){CWMSLayer|number}
openlayers/MapDocument.js, line 3860 -
新增網路地圖圖層
Name Type Description Namestring 客戶端自訂的圖層名稱
Urlstring 圖層來源網址
LayerNamestring | Array.<string> 伺服器端的真實圖層名稱,可給單一字串或字串陣列(會依序合併作畫)
ImageFormatENUM_IMAGE_FORMAT | int 影像列舉ENUM_IMAGE_FORMAT,非必要。(預設是ENUM_IMAGE_FORMAT.PNG)
Boxnull | GeoBoundary 圖層範圍的GeoBoundary,非必要。不給會用MapDocument預設EPSG的整體範圍,建議給的出還是給吧,效能會比較好。
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
Tokenstring 若有需要提供,Token
Returns:
Type Description CWMSLayer | number 圖層本身(失敗回傳0) Example
var layer1Id = MapDoc.NewWMSLayer("我的行政區界圖", "http://127.0.0.1:8080/wms?", ["行政區界圖"], ENUM_IMAGE_FORMAT.JPEG);
-
NewWMSLayerFromPilotGaea(Name, IP, Port, LayerName, ImageFormat, Box, index, Token){CWMSLayer|number}
openlayers/MapDocument.js, line 4137 -
用PilotGaea習慣的方式給WMS參數,非PGMapServer也許無法正常取到圖
Name Type Description Namestring 客戶端自訂的圖層名稱
IPstring IP字串
Portnumber 埠號數字
LayerNamestring | Array.<string> 伺服器端的真實圖層名稱,可給單一字串或字串陣列(會依序合併作畫)
ImageFormatENUM_IMAGE_FORMAT | int 影像列舉ENUM_IMAGE_FORMAT,非必要。(預設是ENUM_IMAGE_FORMAT.PNG)
Boxnull | GeoBoundary 圖層範圍的GeoBoundary,非必要。不給會用MapDocument預設EPSG的整體範圍,建議給的出還是給吧,效能會比較好。
indexnull | int 插入索引,非必要。(預設是-1,也就是Add)
Tokenstring 若有需要提供,Token
Returns:
Type Description CWMSLayer | number 圖層本身(失敗回傳0) -
RemoveAllLayers(){void}
openlayers/MapDocument.js, line 4658 -
移除所有圖層
Returns:
Type Description void -
RemoveLayer(Layer){bool}
openlayers/MapDocument.js, line 4617 -
移除指定圖層
Name Type Description LayerCLayer2D 圖層
Returns:
Type Description bool 若找不到指定圖層,return false -
RemoveLayerByName(Name){bool}
openlayers/MapDocument.js, line 4598 -
依圖層名稱移除圖層
Name Type Description Namestring 圖層名稱
Returns:
Type Description bool 若找不到指定圖層,return false -
SetBaseTileMapLayerByMatrixSet(UrlPatterns, MatrixSet, WMTSProxy, Token){CTileMapLayer|number}
openlayers/MapDocument.js, line 4281 -
指定圖台底圖為TileMapLayer
Name Type Description UrlPatternsArray.<string> 圖層來源字串陣列
MatrixSetCMatrixSet 矩陣資訊
WMTSProxyboolean 是否使用代理,若輸入為字串則會當作代理網址直接串接,預設為false
Tokenstring 若有需要提供,Token
Returns:
Type Description CTileMapLayer | number 圖層本身(失敗回傳0) -
SetBaseTileMapLayerByPatternName(URL, Identifier, WMTSProxy, Token){CTileMapLayer|number}
openlayers/MapDocument.js, line 4174 -
指定圖台底圖為TileMapLayer
Name Type Description URLstring 服務項目,目前支援:"BING_MAP"、"OSM"
Identifierstring | null 服務類型,BING_MAP:支援"VECTOR"、"IMAGE"和"VECTOR_IMAGE",OSM則給null即可
WMTSProxyboolean | string 是否使用代理,若輸入為字串則會當作代理網址直接串接,預設為false
Tokenstring 若有需要提供,Token
Returns:
Type Description CTileMapLayer | number 圖層本身(失敗回傳0) -
SetBaseTileMapLayerFromPilotGaea(IP, Port, ID, ImageFormat, Token){CTileMapLayer|number}
openlayers/MapDocument.js, line 4342 -
指定圖台底圖為TileMapLayer
Name Type Description IPstring IP字串
Portnumber 埠號數字
IDstring 伺服器端的真實圖層名稱
ImageFormatnumber 影像列舉ENUM_IMAGE_FORMAT,非必要。(預設是ENUM_IMAGE_FORMAT.PNG)
Tokenstring 若有需要提供,Token
Returns:
Type Description CTileMapLayer | number 圖層本身(失敗回傳0) -
SetBaseVectorTileLayer(UrlPatterns, Token){CVectorTileLayer|number}
openlayers/MapDocument.js, line 4417 -
指定圖台底圖為VectorTileLayer
Name Type Description UrlPatternsArray.<string> 圖層來源字串陣列
Tokenstring 若有需要提供,Token
Returns:
Type Description CVectorTileLayer | number 圖層本身(失敗回傳0) -
SetBaseVectorTileLayerFromPilotGaea(IP, Port, ID, EPSGCode, Token){CVectorTileLayer|number}
openlayers/MapDocument.js, line 4476 -
指定圖台底圖為VectorTileLayer
Name Type Description IPstring IP字串
Portnumber 埠號數字
IDstring 伺服器端的真實圖層名稱
EPSGCodenumber | undefined EPSG代碼,非必要。(預設跟MapDocument相同)
Tokenstring 若有需要提供,Token
Returns:
Type Description CVectorTileLayer | number 圖層本身(失敗回傳0) -
SetBaseWMSLayer(Url, LayerName, ImageFormat, Box, Token){CWMSLayer|number}
openlayers/MapDocument.js, line 3837 -
指定圖台底圖為WMSLayer
Name Type Description Urlstring 圖層來源網址
LayerNamestring | Array.<string> 伺服器端的真實圖層名稱,可給單一字串或字串陣列(會依序合併作畫)
ImageFormatENUM_IMAGE_FORMAT | int 影像列舉ENUM_IMAGE_FORMAT,非必要。(預設是ENUM_IMAGE_FORMAT.PNG)
Boxnull | GeoBoundary 圖層範圍的GeoBoundary,非必要。不給會用MapDocument預設EPSG的整體範圍,建議給的出還是給吧,效能會比較好。
Tokenstring 若有需要提供,Token
Returns:
Type Description CWMSLayer | number 圖層本身(失敗回傳0) -
SetBaseWMSLayerFromPilotGaea(IP, Port, LayerName, ImageFormat, Box, Token){CWMSLayer|number}
openlayers/MapDocument.js, line 4115 -
指定圖台底圖為WMSLayer
Name Type Description IPstring IP字串
Portnumber 埠號數字
LayerNamestring | Array.<string> 伺服器端的真實圖層名稱,可給單一字串或字串陣列(會依序合併作畫)
ImageFormatENUM_IMAGE_FORMAT | int 影像列舉ENUM_IMAGE_FORMAT,非必要。(預設是ENUM_IMAGE_FORMAT.PNG)
Boxnull | GeoBoundary 圖層範圍的GeoBoundary,非必要。不給會用MapDocument預設EPSG的整體範圍,建議給的出還是給吧,效能會比較好。
Tokenstring 若有需要提供,Token
Returns:
Type Description CWMSLayer | number 圖層本身(失敗回傳0)