iMap
| 建構式 | 說明 |
| iMap(container) | 在指定的HTML container(HTML element,通常是一個DIV element)內建立一個地圖 |
| 函式 | 說明 |
| addControl(control: string) | 在地圖上新增控制類,有LargeScaleBar, SmallScaleBar, MidiumScaleBar, FunctionControl |
| freezeMap() | 使地圖無法平移 |
| unFreezeMap() | 使地圖可以平移 |
| resize(w: number , h: number) | 設定地圖在頁面上的顯示大小 |
| centerMap(pt: Point , level:number) | 使地圖中心點在pt,在第level層 |
| MoveTo(pt: Point) | 使地圖中心點移至pt點 |
| ZoomTo(level: number) | 地圖縮放至level層。最大為第12層,最小為第1層 |
| ZoomIn() | 地圖放大一層。最大為第12層 |
| ZoomOut() | 地圖縮小一層。最小為第1層 |
| setMapAction(v: number) | 設定功能,v=0 (地圖平移), v=1 (方形框選功能), v=3 (圓形框選功能), v=5 (筆型框選功能) 筆型框選參數: (v:number,m:Marker) |
| clearBound() | 移除方形框選 |
| clearIrregular() | 移除筆型框選 |
| clearCircleMar() | 移除圓形框選 |
| addOverlay(overlay: Object) | 新增套疊 |
| removeOverlay(overlay: Object) | 移除套疊 |
| removeAllOverlay() | 刪除所有套疊 |
| openTip(pt: Point, content: string/html) | 在pt點開啟簡易型訊息視窗,視窗內容為content,可使用html格式 |
| closeTip() | 隱藏簡易型訊息視窗 |
| setTipWindowPos(Position: string , setTipPos_X: float , setTipPos_Y: float) | 設定簡易型訊息視窗方向,提供「Top、Bottom、Left、Right」四個方位視窗位置,預設為Top。例:setTipWindowPos('Right',10,5) |
| openInfoWindow(pt: Point , content: string/html) | 在pt 點開啟訊息視窗,視窗內容為content ,可使用html格式 |
| setInfoWindowPos(pt: Point) | 將訊息視窗移至pt點 |
| closeInfoWindow() | 隱藏訊息視窗 |
| showInfoWindow() | 顯示訊息視窗 |
| setInfoWindowOffset(offset: string) | 讓訊息視窗向上移,(offset) pixel,例:setInfoWindowOffset('20px') |
| setInfoWindowOpacity(Opacity: number) | 設定訊息視窗的透明度。Opacity =100為完全不透明,0為完全透明 |
| getClick() | 回傳滑鼠點擊點座標(回傳型態為Point) |
| getBoundary() | 回傳地圖四個邊的座標(回傳型態為Box) |
| getCenter() | 回傳地圖中心點(回傳型態為Point) |
| getZoomLevel() | 回傳目前地圖層級 |
| ShowGridLayer(grid: string) | 套疊地圖網格,有BusDensity(公車資訊), BusinessDensity(商業活絡度), DPeo(白天人口), NPeo(夜間人口), Income(所得概況), TrafficDensity(交通便捷程度),例:ShowGridLayer('BusinessDensity') |
| RemoveGridLayer() | 移除地圖網格 |
| getMapSchoolDistrict(Y : string, X : string, addr : string, Form : string) | 查詢學區資訊,Y:緯度 X經度 addr查詢地址(空值代表不查詢地址為查詢經度緯度),From可以為格式(XML或JSON)。例:getMapSchoolDistrict('24.030', '120.50', '新北市中和區中正路716號', 'XML')、getMapSchoolDistrict('24.030', '120.50', , 'XML') |
| drawMapSchoolDistrictArea(city : string, town : string, school : string, move : boolean) | 顯示學區範圍,可以查詢國小或國中學區,city為縣市、town為鄉鎮、school學校名稱(國中或國小)、move為true為畫面會移動到學區,例:drawMapSchoolDistrictArea("台北市", "大安區", "大安國小", true) |
| removeMapSchoolDistrictArea() | 清除學區範圍 |
| drawPolylineBuffer (pl : Polyline, range : number, points : array) | Line Buffer 線段查詢,pl為Polyline物件、range為Buffer分析範圍,單位公尺、points為Point陣列。回傳符合在線段Buffer範圍內的points (回傳型態為Point Array)。 |
| removePolylineBuffer() | 清除Line Buffer。 |
| fitBounds(points : array) | Points為Point陣列,將地圖縮放移動到所有內容的可視範圍。 |
| getBounds() | 取得框選範圍時的Box物件 ,框選功能: map.setMapAction(1) |
ScaleBar
| 建構式 | 說明 |
| ScaleBar() | 建立地圖縮放控制項 |
| 函式 | 說明 |
| offset(x: float , y: float) | 設定地圖縮放控制項位置,預設x: 0,y: 0 |
Marker
| 建構式 | 說明 |
| Marker(pt: Point , content: string/html , contenttip: string , icon: string , MID: string, align: string) | 在pt點建立一個Marker;訊息(InfoWindow)內容為content,content可為html格式;圖形為icon url(“”,空值有預設Icon) ;contenttip,contenttip為字串格式;MID: 可自訂Marker ID;align: icon的對齊方式,有"center"、"top"、"bottom"、"left"、"right"、"top left"等9種(空值預設"center") |
| 函式 | 說明 |
| openInfoWindow(content:string/html) | 在Marker的pt點開啟訊息視窗 |
| closeInfoWindow() | 關閉訊息視窗 |
| openTip() | 顯示Marker物件contenttip參數字串 |
| closeTip() | 隱藏簡易型訊息視窗 |
| setImg(imgURL: string) | 設定Marker Icon |
| draggable(v: boolean) | 設定是否可拖曳Marker,型態: Boolean |
| setIndex(v: number) | 設定Marker的z-index |
| getLayerId() | 回傳Marker的ID(MID) |
| getLon() | 回傳Marker的Longitude |
| getLat() | 回傳Marker的Latitude |
| getImgUrl() | 回傳Marker的Icon Url |
| getContentInfo() | 回傳Marker的contentinfo |
| getContentTip() | 回傳Marker的contenttip |
| getDraggableValue() | 回傳Marker的拖曳狀態 |
CustomMarker
| 建構式 | 說明 |
| CustomMarker(pt: Point , content:string/html , ID:string) | 在pt點建立一個CustomMarker;CustomMarker內容為content,content可為html格式;ID: 可自訂CustomMarker ID |
| 函式 | 說明 |
| setIndex(v: number) | 設定CustomMarker的z-index |
| getLayerId() | 回傳CustomMarker的ID |
| getLon() | 回傳CustomMarker的Longitude |
| getLat() | 回傳CustomMarker的Latitude |
| getIndex() | 回傳CustomMarker的z-index |
MarkerClusterer
| 建構式 | 說明 |
| MarkerClusterer(arr: array , {parm}) | arr為標記集合,可為 CustomMarker 或 Marker 型態的陣列集合,parm為群聚參數設定 |
| parm 參數 | 說明 |
| gridSize | 型態: number,非必填,預設為120,是依像素(pixel)為群聚距離 |
| maxZoom | 型態: number,非必填,預設為12,設定後圖層等級若大於此數值,則不顯示群聚 |
| showOneStyle | 型態: boolean,非必填,預設為false,設定true,當數量為1時,則顯示原標記 |
| styles |
自訂群聚樣式: url(群聚圖片樣式URL) height(群聚圖片高度) width(群聚圖片寬度) anchor(群聚內文位置[左, 上]) textColor(群聚內文顏色) textSize(群聚內文大小) 例: styles: [{ url: 'http://api.map.com.tw/API_Sample/images/MarkerClusterer /blue_house.png', height: 32, width: 32, anchor: [15, 10], textColor: '#000099', textSize: 8, }] |
Polyline
| 建構式 | 說明 |
| Polyline(points: array , color: string , size: number , opacity: number, edit:boolean, radius:boolean) | points為Point陣列;color為Polyline的顏色;size為Polyline的寬度;opacity為Polyline的透明度(100 為完全不透明, 0為完全透明);edit為Polyline節點編輯設定;radius為Polyline線段圓弧設定 |
| 函式 | 說明 |
| setTransFigure(v: boolean) | 設定是否可以修改Polyline的形狀。v=true時,可以修改,v=false時,無法修改。當v=true時,會出現Polyline的節點,只要移動節點,Polyline形狀就會跟著改變,在節點上按右鍵即可刪除該節點;當v=false時,節點會消失,此時無法做修改 |
| setIndex(v: number) | 設定Polyline的z-index |
| returnAllNode() | 回傳Polyline所有節點陣列,(回傳型態為Point) Array |
| getLength() | 回傳Polyline的長度。單位為公尺 |
| getIndex() | 回傳Polyline的z-index |
| getColor() | 回傳Polyline的顏色 |
| getSize() | 回傳Polyline的線寬度 |
| getOpacity() | 回傳Polyline的透明度 |
| getTransFigure() | 回傳Polyline的編輯狀態 |
| getRadius() | 回傳Polyline的線段圓弧狀態 |
| setRadius (v: boolean) | Polyline的線段圓弧設定。v=true時,圓弧,v=false時,非圓弧。 |
Polygon
| 建構式 | 說明 |
| Polygon(points: array , color: string , size: number , opacity: number ,edit: boolean , strokecolor: string) | points為Point陣列;color為Polygon的顏色;size為Polygon的寬度;opacity為Polygon的透明度(100 為完全不透明, 0為完全透明);edit為Polygon節點編輯設定;strokecolor為Polygon框線顏色。第一點也是終點 |
| 函式 | 說明 |
| setTransFigure(v: boolean) | 設定是否可以修改Polygon的形狀。v=true時,可以修改,v=false時,無法修改。當v=true時,會出現Polygon的節點,只要移動節點,Polygon形狀就會跟著改變,在節點上按右鍵即可刪除該節點;當v=false時,節點會消失,此時無法做修改 |
| setIndex(v: number) | 設定Polygon的z-index |
| getArea() | 回傳Polygon的面積。單位為平方公尺 |
| getCenter() | 回傳面積中心點,(回傳型態為Point) |
| returnAllNode() | 回傳Polygon所有節點陣列,(回傳型態為Point Array) |
| getIndex() | 回傳Polygon的z-index |
| getColor() | 回傳Polygon的區塊顏色 |
| getStrokecolor() | 回傳Polygon的區塊框線顏色 |
| getSize() | 回傳Polygon的線寬度 |
| getOpacity() | 回傳Polygon的透明度 |
| getTransFigure() | 回傳Polygon的編輯狀態 |
Event
| 建構式 | 說明 |
| Event() | 建立event |
| 函式 | 說明 |
| addListener(obj: Obj , event: string , fun: function) | 新增觸發事件。obj為觸發對象,event為觸發事件名稱,fun為觸發後所執行的function。其中event 事件項目有:click, mouseup, mousedown, mousemove, mousemoveend, scaled, mouseout, mouseover, dblclick, focus |
| removeListener(obj: Obj , event: string) | 移除觸發事件。obj為移除觸發對象,event為移除觸發事件名稱。其中event事件項目與上相同 |
Point
| 建構式 | 說明 |
| Point(x , y) | 建立一個Point |
| 函式 | 說明 |
| setX(x: float) | 設定Point的X座標 |
| setY(y: float) | 設定Point的Y座標 |
| 屬性 | 類別 | 說明 |
| x | number | 這個點的x(水平)坐標 |
| y | number | 這個點的y(垂直)坐標 |
Box
| 建構式 | 說明 |
| Box() | 建立一個四邊形 |
| 函式 | 說明 |
| setLeft(left) | 設定Box的left座標 |
| setRight(right) | 設定Box的right座標 |
| setTop(top) | 設定Box的top座標 |
| setBottom(bottom) | 設定Box的bottom座標 |
| 屬性 | 類別 | 說明 |
| left | number | Box的左邊坐標(Longitude) |
| right | number | Box的右邊坐標(Longitude) |
| top | number | Box的上邊坐標 (Latitude) |
| bottom | number | Box的底邊坐標 (Latitude) |
getAddrXY2_Fetch <Application Service>
地址轉座標
| 函式 | 參數說明 | ||
| getAddrXY2_Fetch (add: string) |
|
getCroadXY2_Fetch <Application Service>
取得交叉路口座標
| 函式 | 參數說明 | ||||||
| getCroadXY2_Fetch (city: string , town: string , road: string , road: string) |
|
getMarkXY2_Fetch <Application Service>
取得地標座標
| 函式 | 參數說明 | ||||||
| getMarkXY2_Fetch (city: string , town: string , landmark: string) |
|
CaptureMap <Application Service>
取得靜態地圖
| 函式 | 參數說明 | ||||||||||||||||||||||||
| CaptureMap (centerX: float, centerY: float, zoomLevel: number , imageWidth: number , imageHeight: number , imageType:number , showSymbol:number , symbolType:number , symbolX: float , symbolY: float , back_function: function) |
【back_function(obj) 取得圖片的用法】
|
GetPOI.ashx <WebService>
取得生活周邊資訊
| Web服務 | 網址參數說明 | |||||||||||||||||||||
|
map.getPOI(Y : string, X : string, Radius : int, Name : string, Type : string, Form : string)
|
|
【生活周邊物件類別對照表】
| 類別名稱 | 代碼 |
| 地方政府 | government |
| 警憲消防 | Police_affair |
| 國際事務 | international_affairs |
| 小學 | primary_school |
| 中高級校 | senior_school |
| 大專院校 | university |
| 醫院 | hospital |
| 診所 | clinic |
| 動物醫院 | animal_hospital |
| 本國銀行 | domestic_bank |
| 麵包喜餅 | bread_chainstore |
| 超級市場 | supermarket |
| 便利商店 | convenience_store |
| 五金行 | hardware_store |
| 刻印行 | signet_store |
| 3C | 3c_electronic |
| 傢俱 | furniture |
| 連鎖鞋店 | Shoes_chainstore |
| 美容瘦身 | Beauty_and_fitness |
| 書局 | bookstore |
| 寵物店 | pets_shop |
| 房屋仲介 | Real_Estate |
| 生活藥妝 | drug_store |
| 一般旅館 | Hotel |
| 觀光旅館 | Tourist_Hotel |
| 國際觀光 旅館 | international_hotel |
| 鑽石/精品 專櫃 | diamond_channel |
| 外國銀行 | international_bank |
| 郵局 | post_office |
| ATM | atm |
| 遊樂園區 | amusement_park |
| 宗教聖地 | religion_landscape |
| 展演場所 | performance_space |
| 影視聽業 | video_amusement |
| 健身中心 | gym |
| 運動健身 | exercise_center |
| 休閒公園 | resort_park |
| 旅行社 | travel_agency |
| 咖啡 | coffee_shop |
| 加油站 | gas_station |
| 修車廠 | car_repairing |
| 停車場 | parking_lot |
| 租車服務 | car_rental |
| 自行車 | bicycle |
| 鐵路設施 | railway |
| 公車站 | bus_station |
| 航空站 | airport |
| 捷運設施 | MRT_station |
| 保險公司 | Insurance_company |
| 殯葬館 | funeral_service |
| 小型百貨 | small_department_store |
| 中型百貨 | general_department_store |
| 大型百貨 公司 | large_department_store |
| 大型連鎖 服飾 | large_chainstore |