# new GeometryServer(options)
地ç†å‡ 何æœåŠ¡
傿•°
åç§° | 类型 | 默认值 | æè¿° |
---|---|---|---|
options |
Object | æž„é€ å‚æ•° |
|
url |
String | æ— | æœåŠ¡åŸºåœ°å€ |
示例
// ES5引入方å¼
const { GeometryServer } = Zondy.Service
// ES6引入方å¼
import { GeometryServer } from "@mapgis/webclient-common"
const geometryServer = new GeometryServer({
url: 'http://localhost:8089/igs/rest/services/system/GeometryServer',
requestInterceptor: {
before: function (config) {
return config;
},
failure: function (error) {
console.log("请求å‘é€å¤±è´¥(拦截器):", error)
}
},
responseInterceptor: {
success: function (result) {
console.log("请求æˆåŠŸæ‹¦æˆªå“应")
return result;
},
failure: function (result) {
console.log("请求失败拦截å“应")
return result;
}
}
});
继承关系
æˆå‘˜å˜é‡
æˆå‘˜å˜é‡æ¦‚è¿°
åç§° | 类型 | æè¿° |
---|---|---|
clientId |
Boolean
|
|
enableGlobeFetch |
Boolean
|
|
headers |
String
|
|
requestInterceptor |
function
|
|
requestTimeout |
String
|
|
responseInterceptor |
function
|
|
tokenAttachType |
TokenAttachType
|
|
tokenKey |
String
|
|
tokenValue |
String
|
|
url |
String
|
|
æˆå‘˜å˜é‡è¯¦æƒ…
# enableGlobeFetch
是å¦ä½¿ç”¨ç¡®æ®å”¯ä¸€çš„fetch对象,默认为true,当设为falseæ—¶ï¼Œä¼šä½¿ç”¨è‡ªå·±ç§æœ‰çš„fetch对象,所有的请求设置ä¸ä¼šå½±å“全局
- Inherited From:
示例
//设置请求基地å€
// ES5引入方å¼
const { BaseServer } = Zondy.Service
// ES6引入方å¼
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求基地å€
url: 'ä½ çš„URL',
//ä½¿ç”¨ç§æœ‰çš„fetch对象
enableGlobeFetch: false,
//æ¤æ—¶è®¾ç½®tokenç‰å±žæ€§ï¼Œä¸ä¼šå½±å“全局的fetch对象
tokenValue: 'ä½ çš„token'
});
//ç»§ç»ä½¿ç”¨å…¨å±€fetch
BaseServer.enableGlobeFetch = true;
# headers
è¯·æ±‚å¤´å‚æ•°
- Inherited From:
示例
//è®¾ç½®è¯·æ±‚å¤´å‚æ•°
// ES5引入方å¼
const { BaseServer } = Zondy.Service
// ES6引入方å¼
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求头
headers: {
//设置Content-Type为multipart/form-data
'Content-Type': 'multipart/form-data',
//设置token
'token': 'ä½ çš„token'
}
});
//动æ€ä¿®æ”¹
BaseServer.headers.token = 'æ–°token';
# requestInterceptor
请求å‘逿‹¦æˆªå™¨
- Inherited From:
示例
//设置拦截器,任何一个继承自BaseServer的对象都å¯ä»¥è®¾ç½®ï¼Œå…¨å±€å”¯ä¸€
// ES5引入方å¼
const { BaseServer,RequestInterceptor } = Zondy.Service
// ES6引入方å¼
import { BaseServer,RequestInterceptor } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//设置请求å‘逿‹¦æˆªå™¨
requestInterceptor: new RequestInterceptor({
//请求å‘é€å‰è¿›è¡Œç»Ÿä¸€å¤„ç†
before: function(config) {
//æ‰§è¡Œä½ çš„ä¸šåŠ¡é€»è¾‘
//注æ„必须显示返回config对象,如果返回为空,则ä¸å‘é€è¯·æ±‚
return config;
},
//请求å‘é€å¤±è´¥æ—¶è¿›è¡Œç»Ÿä¸€å¤„ç†
failure: function(error) {
//æ‰§è¡Œä½ çš„ä¸šåŠ¡é€»è¾‘
}
})
});
//动æ€ä¿®æ”¹
BaseServer.requestInterceptor.before = function() {};
# requestTimeout
请求超时时间,默认45000ms,å³45s
- Inherited From:
示例
//设置超时时间
//åˆå§‹åŒ–AddressServeræœåŠ¡å¯¹è±¡
// ES5引入方å¼
const { BaseServer } = Zondy.Service
// ES6引入方å¼
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//è¶…æ—¶æ—¶é—´
requestTimeout: 2000
});
//动æ€ä¿®æ”¹
BaseServer.requestTimeout = 3000;
# responseInterceptor
请求å“应拦截器
- Inherited From:
示例
//设置拦截器,任何一个继承自BaseServer的对象都å¯ä»¥è®¾ç½®ï¼Œå…¨å±€å”¯ä¸€
// ES5引入方å¼
const { BaseServer,ResponseInterceptor } = Zondy.Service
// ES6引入方å¼
import { BaseServer,ResponseInterceptor } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//设置请求å“应拦截器
responseInterceptor: new ResponseInterceptor({
//执行请求å“应,接å£è°ƒç”¨æˆåŠŸæ—¶ä¼šæ‰§è¡Œçš„å›žè°ƒ
success: function(result) {
//æ‰§è¡Œä½ çš„ä¸šåŠ¡é€»è¾‘
//注æ„必须显示返回resultå¯¹è±¡ï¼Œå¦‚æžœè¿”å›žä¸ºç©ºï¼Œåˆ™ä¸æ‰§è¡Œè¯·æ±‚å“应æˆåŠŸå›žè°ƒ
return result;
},
//请求å“应æˆåŠŸï¼ŒæŽ¥å£è°ƒç”¨å¤±è´¥æ—¶ä¼šæ‰§è¡Œçš„函数
failure: function(result) {
//æ‰§è¡Œä½ çš„ä¸šåŠ¡é€»è¾‘
//注æ„必须显示返回resultå¯¹è±¡ï¼Œå¦‚æžœè¿”å›žä¸ºç©ºï¼Œåˆ™ä¸æ‰§è¡Œå›žè°ƒéŸ©å¼
return result;
}
})
});
//动æ€ä¿®æ”¹
BaseServer.responseInterceptor.success = function() {};
# tokenAttachType
指定tokené™„åŠ åˆ°ä½•å¤„
- Inherited From:
示例
//设置token值
// ES5引入方å¼
const { BaseServer } = Zondy.Service
const { TokenAttachType } = Zondy.Enum
// ES6引入方å¼
import { BaseServer,TokenAttachType } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//tokenå
tokenValue: 'ä½ çš„token值',
//token值
tokenValue: 'ä½ çš„token值',
//指定tokené™„åŠ åˆ°urlåŽé¢
tokenAttachType: TokenAttachType.url
});
//动æ€ä¿®æ”¹
BaseServer.tokenAttachType = TokenAttachType.header;
# tokenKey
tokenå
- Inherited From:
示例
//设置tokenå
// ES5引入方å¼
const { BaseServer } = Zondy.Service
// ES6引入方å¼
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//tokenå
tokenKey: 'ä½ çš„tokenKey'
});
//动æ€ä¿®æ”¹
BaseServer.tokenKey = 'æ–°tokenKey';
# tokenValue
token值
- Inherited From:
示例
//设置token值
// ES5引入方å¼
const { BaseServer } = Zondy.Service
// ES6引入方å¼
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//token值
tokenValue: 'ä½ çš„token值'
});
//动æ€ä¿®æ”¹
BaseServer.tokenValue = '新token值';
# url
æœåŠ¡åŸºåœ°å€
- Inherited From:
示例
//设置请求基地å€
// ES5引入方å¼
const { BaseServer } = Zondy.Service
// ES6引入方å¼
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求基地å€
url: 'ä½ çš„URL'
});
//动æ€ä¿®æ”¹
BaseServer.url = 'æ–°URL';
方法
方法概述
åç§° | 返回值类型 | æè¿° |
---|---|---|
bufferAnalyse |
|
|
calculateArea |
|
|
calculateAreasAndLengths |
|
|
calculateDifference |
|
|
calculateDistance |
|
|
calculateIntersect |
|
|
calculateLabelPoints |
|
|
calculateLength |
|
|
calculateLengths |
|
|
calculateTopologyRelation |
|
|
calculateUnion |
|
|
geometryProject |
|
|
projectInExtent |
|
|
queryServerInfo |
|
|
smoothLineString |
|
|
方法详情
# bufferAnalyse(options)
缓冲分æž
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
polygon |
Polygon | è¦è®¡ç®—的多边形 |
distance |
Number | 缓冲åŠå¾„ |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { Polygon } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { Polygon, FetchMethod } from "@mapgis/webclient-common"
geometryServer.bufferAnalyse({
geometries: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
}),
method: FetchMethod.post,
distance: 1,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.bufferAnalyse({
geometries: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
}),
distance: 100,
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateArea(options)
计算é¢ç§¯
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
polygon |
Polygon | è¦è®¡ç®—的多边形,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
projectInfo |
ProjectInfo | 投影å‚考信æ¯ï¼ŒprojectInfo或projectInfoBySrsID二选一 |
projectInfoBySrsID |
ProjectInfoBySrsID | æºæŠ•å½±å‚考系ID,projectInfo或projectInfoBySrsID二选一 |
# calculateAreasAndLengths(options)
计算é¢ç§¯å’Œå‘¨é•¿
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
polygons |
Polygon | è¦è®¡ç®—的多边形,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { Polygon } = Zondy.Geometry
// ES6引入方å¼
import { Polygon } from "@mapgis/webclient-common"
geometryServer.calculateAreasAndLengths({
polygons: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
}),
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.calculateAreasAndLengths({
polygons: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
})
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateDifference(options)
求差计算
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
geometry1 |
Geometry | è¦è®¡ç®—的多边形1,必填 |
geometry2 |
Geometry | è¦è®¡ç®—的多边形2,必填 |
tolerance |
Number | 容差,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { Polygon } = Zondy.Geometry
// ES6引入方å¼
import { Polygon } from "@mapgis/webclient-common"
geometryServer.calculateDifference({
geometry1: new Polygon({
coordinates: [
[
[105.0, 0.0],
[164.0, 0.0],
[164.0, 10.0],
[105.0, 10.0],
[105.0, 0.0]
]
]
}),
geometry2: new Polygon({
coordinates: [
[
[110.0, 5.0],
[170.0, 5.0],
[170.0, 20.0],
[110.0, 20.0],
[110.0, 5.0]
]
]
}),
tolerance: 1,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.calculateDifference({
geometry1: new Polygon({
coordinates: [
[
[105.0, 0.0],
[164.0, 0.0],
[164.0, 10.0],
[105.0, 10.0],
[105.0, 0.0]
]
]
}),
geometry2: new Polygon({
coordinates: [
[
[110.0, 5.0],
[170.0, 5.0],
[170.0, 20.0],
[110.0, 20.0],
[110.0, 5.0]
]
]
}),
tolerance: 1
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateDistance(options)
求è·ç¦»
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
geometry1 |
Geometry | è¦è®¡ç®—的多边形1,必填 |
geometry2 |
Geometry | è¦è®¡ç®—的多边形2,必填 |
srs |
Geometry | å‚考系,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { Point,LineString } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { Point,LineString,FetchMethod } from "@mapgis/webclient-common"
geometryServer.calculateDistance({
geometry1: new Zondy.Geometry.Point({
coordinates: [
105.380859375, 31.57853542647338
]
}),
geometry2: new LineString({
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
srs: "EPSG:4326",
method: FetchMethod.post,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.calculateDistance({
geometry1: new Point({
coordinates: [
105.380859375, 31.57853542647338
]
}),
geometry2: new LineString({
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
srs: "EPSG:4326"
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateIntersect(options)
求交计算
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
geometry1 |
Geometry | è¦è®¡ç®—的多边形1,必填 |
geometry2 |
Geometry | è¦è®¡ç®—的多边形2,必填 |
tolerance |
Number | 容差,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// ES5引入方å¼
const { Polygon } = Zondy.Geometry
const { Polygon,FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { Polygon,FetchMethod } from "@mapgis/webclient-common"
geometryServer.calculateIntersect({
geometry1: new Polygon({
coordinates: [[ [105.0, 0.0],[164.0, 0.0],[164.0, 10.0],[105.0, 10.0],[105.0, 0.0] ]]
}),
geometry2: new Polygon({
coordinates: [[ [110.0, 5.0],[170.0, 5.0],[170.0, 20.0],[110.0, 20.0],[110.0, 5.0] ]]
}),
tolerance: 1,
method: FetchMethod.post,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.calculateIntersect({
geometry1: new Polygon({
coordinates: [[ [105.0, 0.0],[164.0, 0.0],[164.0, 10.0],[105.0, 10.0],[105.0, 0.0] ]]
}),
geometry2: new Polygon({
coordinates: [[ [110.0, 5.0],[170.0, 5.0],[170.0, 20.0],[110.0, 20.0],[110.0, 5.0] ]]
}),
tolerance: 1
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateLabelPoints(options)
求label点
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
polygons |
Polygon | è¦è®¡ç®—的多边形,å•åŒºæˆ–å¤šåŒºå‡ ä½•ï¼Œå¿…å¡« |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { Polygon } = Zondy.Geometry
const { Polygon,FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { Polygon,FetchMethod } from "@mapgis/webclient-common"
geometryServer.calculateLabelPoints({
polygons: new Polygon({
coordinates: [[ [100.0, 0.0],[101.0, 0.0],[101.0, 1.0],[100.0, 1.0],[100.0, 0.0] ]]
}),
method: FetchMethod.post,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.calculateLabelPoints({
polygons: new Polygon({
coordinates: [[ [100.0, 0.0],[101.0, 0.0],[101.0, 1.0],[100.0, 1.0],[100.0, 0.0] ]]
})
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateLength(options)
计算长度
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
lineString |
LineString | è¦è®¡ç®—的线,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
projectInfo |
ProjectInfo | 投影å‚考信æ¯ï¼ŒprojectInfo或projectInfoBySrsID二选一 |
projectInfoBySrsID |
ProjectInfoBySrsID | æºæŠ•å½±å‚考系ID,projectInfo或projectInfoBySrsID二选一 |
# calculateLengths(options)
求长度
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
lineString |
LineString | MultiLineString | è¦è®¡ç®—的线,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { LineString } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { LineString,FetchMethod } from "@mapgis/webclient-common"
geometryServer.calculateLengths({
polylines: new LineString({
spatialReference: 'EPSG:4326',
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
method: FetchMethod.post,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.calculateLengths({
polylines: new LineString({
spatialReference: 'EPSG:4326',
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateTopologyRelation(options)
计算拓扑关系
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
geometry1 |
Geometry | è¦è®¡ç®—的多边形1,必填 |
geometry2 |
Geometry | è¦è®¡ç®—的多边形2,必填 |
tolerance |
Number | 容差,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { LineString,Polygon } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { LineString,Polygon,FetchMethod } from "@mapgis/webclient-common"
geometryServer.calculateTopologyRelation({
geometry1: new LineString({
coordinates: [ [117,0],[117,44] ]
}),
geometry2: new Polygon({
coordinates: [[ [110.0, 5.0],[170.0, 5.0],[170.0, 20.0],[110.0, 20.0],[110.0, 5.0] ]]
}),
tolerance: 1,
method: FetchMethod.post,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
//promiseæ–¹å¼
geometryServer.calculateTopologyRelation({
geometry1: new LineString({
coordinates: [ [117,0],[117,44] ]
}),
geometry2: new Polygon({
coordinates: [[ [110.0, 5.0],[170.0, 5.0],[170.0, 20.0],[110.0, 20.0],[110.0, 5.0] ]]
}),
tolerance: 1
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# calculateUnion(options)
求并
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
geometry1 |
Geometry | è¦è®¡ç®—的多边形1,必填 |
geometry2 |
Geometry | è¦è®¡ç®—的多边形2,必填 |
tolerance |
Number | 容差,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { Polygon } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { Polygon,FetchMethod } from "@mapgis/webclient-common"
geometryServer.calculateUnion({
geometry1: new Polygon({
coordinates: [[ [105.0, 0.0],[164.0, 0.0],[164.0, 10.0],[105.0, 10.0],[105.0, 0.0] ]]
}),
geometry2: new Polygon({
coordinates: [[ [110.0, 5.0],[170.0, 5.0],[170.0, 20.0],[110.0, 20.0],[110.0, 5.0] ]]
}),
tolerance: 1,
method: FetchMethod.post,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.calculateUnion({
geometry1: new Polygon({
coordinates: [[ [105.0, 0.0],[164.0, 0.0],[164.0, 10.0],[105.0, 10.0],[105.0, 0.0] ]]
}),
geometry2: new Polygon({
coordinates: [[ [110.0, 5.0],[170.0, 5.0],[170.0, 20.0],[110.0, 20.0],[110.0, 5.0] ]]
}),
tolerance: 1,
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# geometryProject(options)
å‡ ä½•æŠ•å½±
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
geometries |
Geometry | è¦è®¡ç®—çš„æŠ•å½±å‡ ä½•å¯¹è±¡ï¼Œå¿…å¡« |
inSrs |
String | 原始å‚考系,必填 |
outSrs |
String | ç›®æ ‡å‚考系,必填 |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
示例
// 回调方å¼
// ES5引入方å¼
const { LineString } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方å¼
import { Polygon,FetchMethod } from "@mapgis/webclient-common"
geometryServer.geometryProject({
geometries: new LineString({
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
inSrs: 'EPSG:4326',
outSrs: 'EPSG:3857',
method: FetchMethod.post,
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promiseæ–¹å¼
geometryServer.geometryProject({
geometries: new LineString({
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
inSrs: 'EPSG:4326',
outSrs: 'EPSG:3857'
}).then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
})
# projectInExtent(options)
å¯¹çŸ©å½¢èŒƒå›´åæ ‡ç‚¹è¿›è¡ŒæŠ•影转æ¢
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
gdbsvrName |
String | æ•°æ®æºå称,必填 |
gdbName |
String | åœ°ç†æ•°æ®åº“å称,必填 |
srefID |
String | æºæŠ•å½±å‚考系ID,必填 |
desfID |
String | 目的投影å‚考系ID,必填 |
extent |
Extent | 矩形范围,必填 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
userName |
String | åœ°ç†æ•°æ®æº/åœ°ç†æ•°æ®åº“账户å |
password |
String | åœ°ç†æ•°æ®æº/åœ°ç†æ•°æ®åº“密ç |
# queryServerInfo(options)
èŽ·å–æœåŠ¡ä¿¡æ¯ï¼ŒIGS2.0新增æœåŠ¡
傿•°
åç§° | 类型 | 默认值 | æè¿° |
---|---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
||
success |
function | æ— | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | æ— | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
- Inherited From:
示例
èŽ·å–æœåŠ¡ä¿¡æ¯-回调方å¼
server.queryServerInfo({
success: function (result) {
console.log('请求æˆåŠŸï¼š', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
èŽ·å–æœåŠ¡ä¿¡æ¯-promiseæ–¹å¼
server.queryServerInfo({
})
.then(function (result) {
console.log('请求æˆåŠŸï¼š', result);
}).catch(function (result) {
console.log('请求失败:', result);
});
# smoothLineString(options)
计算光滑曲线,igs1.0æœåŠ¡
傿•°
åç§° | 类型 | æè¿° |
---|---|---|
options |
æŸ¥è¯¢å‚æ•° |
|
type |
Number | æ’值方å¼ï¼Œ0ä¸ºäºŒæ¬¡æ ·æ¡ã€1ä¸ºä¸‰æ¬¡æ ·æ¡ã€2为三次Beizeræ ·æ¡ã€3为三次Bæ ·æ¡ï¼Œå¿…å¡« |
lineString |
LineString | è¦è®¡ç®—çš„çº¿å‡ ä½•ï¼Œå¿…å¡« |
success |
function | 查询æˆåŠŸå›žè°ƒå‡½æ•°ï¼Œè‹¥ä½¿ç”¨Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
failure |
function | 查询失败回调函数,若使用Promiseæ–¹å¼åˆ™ä¸å¿…填写 |
tolerance |
Number | step |