arcgis毛总最新地图底座获取视角
1拖动位置,打开控制台
2.mapUtil.util.getMapExtent()
3.复制object
arcgis取地图的定位坐标
1拖动位置,打开控制台
2. 输入命令 map.regionLayer.view.extent
3.复制object
:::details
:::
cesuim 地图视角位置
(1) 地图选好视角后,打开浏览器, 在浏览器控制台运行回车
(2) 获取那个视角脚本代码
{position :$viewer.camera.position,up:$viewer.camera.up,heading:$viewer.camera.heading,pitch:$viewer.camera.pitch,roll:$viewer.camera.roll,direction:$viewer.camera.direction}
(3) 获取到数据 定义变量
const camera = {
"position": {
"x": -1585101.2595351234,
"y": 5320992.392833537,
"z": 3130477.613761266
},
"up": {
"x": -0.1643710147599397,
"y": 0.9677301027921298,
"z": 0.19099899909874302
},
"heading": 3.50224042963928,
"pitch": -0.3432502762666627,
"roll": 6.283177516957298,
"direction": {
"x": 0.27784807743680634,
"y": 0.23121586737611863,
"z": -0.9323838632978263
}
}
// 视角定位
viewer.camera.flyTo(
{
destination: new Cartesian3(...camera.position),
orientation: {
direction: new Cartesian3(...camera.direction),
up: new Cartesian3(...camera.up),
heading: camera.heading,
pitch: camera.pitch,
roll: camera.roll,
}
}
)
页面编辑器 加载蒙版
function() {
planMap.mapComponents[0].view.zoom = 7
setTimeout(() => {
try {
window.planMap.addEsriLayerToMap(planMap.createEsriLayer(planMap.getLayerObjByCatalogIdAndLayerId('95a13841-b21e-4d75-8db3-8ac89a35a59d', 'bcdcd7d9-2b50-450e-9752-f8cc09f6d581')[0]))
window.planMap.addEsriLayerToMap(planMap.createEsriLayer(planMap.getLayerObjByCatalogIdAndLayerId('95a13841-b21e-4d75-8db3-8ac89a35a59d', '388df312-d559-44d6-92c1-304f724a9248')[0]))
const resource = window.planMap.serviceStore.query({ id: '6f2b0169-3512-4931-aa2c-7f3c325ceb54' })[0]
resource.checked = true
window.planMap.setLayerSwitch(true, resource)
} catch (e) { console.error(e) }
try {
const userInfo = JSON.parse(localStorage.userInfo)
const org = userInfo.orgFullName.split('-')
// planMap.locateByAreaname(org[1], true)
mengban(org[1])
} catch (e) { console.error(e) }
}, 500)
console.log('test123')
// 区县定位和蒙版
function mengban(name) {
// const url = 'http://23.36.123.160:10000/multApp/datamanager/service/ad1feab5-2cde-4885-95ea-670725591bee/cfd30e93-ece5-48c1-aacf-509ee2a3dc29/33d8f0c2-5e4c-41cb-9742-4b25cb994446/MapServer/0'
const url = 'http://10.10.6.211/cqgtorg_xxzxadmin_site04/rest/services/%E5%B9%B3%E5%8F%B0/syfztc/FeatureServer/8'
const mapComponent = planMap.mapComponents[0]
planMap.createEsriQueryTask(url, {
where: `管理区名称 like '%${name}%'`,
returnGeometry: true
}).then(({ features }) => {
if (!features.length) return
// 区县定位
planMap.mapComponents[0].view.goTo(features)
const maskLayer = new window.Esri.GraphicsLayer({
id: `mask-layer`,
listMode: 'hide',
title: '蒙版图层'
})
mapComponent.map.add(maskLayer)
const extent = new window.Esri.Polygon({
spatialReference:
mapComponent.view.spatialReference,
rings: [
[
[-180, -90],
[180, -90],
[180, 90],
[-180, 90]
]
]
})
const geos = features.map((item) => item.geometry)
const geo =
geos.length > 1 ? window.Esri.geometryEngine.union(geos) : geos[0]
if (geo) {
//高亮定位
planMap.highlightByGeometrys([geo], true, true)
const geometry = window.Esri.geometryEngine.difference(extent, geo)
const gra = new window.Esri.Graphic({
geometry: geometry,
symbol: {
type: 'simple-fill',
color: '#0b1b49',
outline: {
color: '#0b1b49'
}
}
})
maskLayer.graphics.add(gra)
}
})
mapComponent.map.layers.on('after-add', e => {
const maskLayer = mapComponent.map.findLayerById(`mask-layer`)
if (maskLayer && e.item && e.item.id !== `mask-layer`) {
// 计算排序号
let order = mapComponent.map.layers.items.length - 1
// 如果包含标记图层 则再减1
if (mapComponent.map.layers.items.filter(ly => ly.id.indexOf('markerLayer_') !== -1).length > 0) {
order = order - 1
}
mapComponent.map.layers.reorder(maskLayer, order)
}
})
}
}