A与B相交后的图形查询
按照A与B图形得到相交后的图斑
<!--
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="相交测试._Default" %>
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" >
<title>相交测试服务</title>
<link rel="stylesheet" type="text/css" href="http://10.0.0.55/jsapi/dijit/themes/tundra/tundra.css" />
<link rel="stylesheet" type="text/css" href="http://10.0.0.55/jsapi/esri/css/esri.css" />
<script type="text/javascript" src="http://10.0.0.55/jsapi/init.js"></script>
<style>
#info {
top: 20px;
color: #444;
height: auto;
font-family: arial;
right: 20px;
margin: 5px;
padding: 10px;
position: absolute;
width: 115px;
z-index: 40;
border: solid 2px #666;
border-radius: 4px;
background-color: #fff;
}
html, body, #mapDiv {
padding:0;
margin:0;
height:100%;
}
button {
display: block;
}
</style>
</head>
<body>
<div>
<script type="text/javascript">
//定义地图
var map, tb, drawEvt;
require([
"esri/map",
"esri/toolbars/draw",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/PictureFillSymbol",
"esri/symbols/CartographicLineSymbol",
"esri/graphic",
"esri/Color",
"dojo/dom",
"dojo/on",
"esri/tasks/GeometryService",
"esri/tasks/QueryTask",
"esri/tasks/query",
"dojo/domReady!"
],
function (
Map, Draw,
SimpleMarkerSymbol, SimpleLineSymbol,
PictureFillSymbol, CartographicLineSymbol,
Graphic,
Color, dom, on, GeometryService, QueryTask, Query
) {
map = new Map("mapDiv", { "spatialReference": { "wkid": 2359 } });
console.log(map);
var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://10.0.0.55:6080/arcgis/rest/services/xj/MapServer");
map.addLayer(layer);
map.on("load", initToolbar);
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setColor(new Color("#0099FF"));
// lineSymbol used for freehand polyline, polyline and line.
var lineSymbol = new CartographicLineSymbol(
CartographicLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]), 10,
CartographicLineSymbol.CAP_ROUND,
CartographicLineSymbol.JOIN_MITER, 1
);
// fill symbol used for extent, polygon and freehand polygon, use a picture fill symbol
// the images folder contains additional fill images, other options: sand.png, swamp.png or stiple.png
var fillSymbol = new PictureFillSymbol(
"images/mangrove.png",
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color('#050'),
1
),
42,
42
);
function initToolbar() {
tb = new Draw(map);
tb.on("draw-end", addGraphic);
// event delegation so a click handler is not
// needed for each individual button
on(dom.byId("info"), "click", function (evt) {
if (evt.target.id === "info") {
return;
}
var tool = evt.target.id.toLowerCase();
map.disableMapNavigation();
tb.activate(tool);
});
}
function addGraphic(evt) {
tb.deactivate();
map.enableMapNavigation();
var symbol;
if (evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
symbol = markerSymbol;
} else if (evt.geometry.type === "line" || evt.geometry.type === "polyline") {
symbol = lineSymbol;
}
else {
symbol = fillSymbol;
}
//显示用户所绘图形
map.graphics.add(new Graphic(evt.geometry, symbol));
alert("显示用户所绘图形");
//1、先进行相交查询
var queryTask = new QueryTask("http://10.0.0.55:6080/arcgis/rest/services/xj/MapServer/1");
var query = new Query();
query.geometry = evt.geometry;
query.returnGeometry = true;
drawEvt = evt;
queryTask.execute(query, showResults);
}
function showResults(featureSet) {
map.graphics.clear();
//2、将相交的图形置入数组
var geos = [];
dojo.forEach(featureSet.features, function (feature) {
var graphic = feature;
graphic.setSymbol(lineSymbol);
geos.push(feature.geometry);
map.graphics.add(graphic);
});
alert("2、将相交的图形置入数组");
console.log(featureSet, "geos");
//3、调用系统相交服务进行分析,结果得到相交后的图形
geo = new GeometryService("http://10.0.0.55:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer/");
geo.intersect(geos, drawEvt.geometry, output);
}
//这里返回的是数组
function output(geos) {
//4、讲相交后的图形变换,绘制到图上
alert("4、讲相交后的图形变换,绘制到图上");
// map.graphics.clear();
for (a = 0; a < geos.length; a++) {
var graphic = new Graphic();
graphic.setSymbol(fillSymbol);
graphic.geometry = geos[a];
map.graphics.add(graphic);
}
}
});
</script>
</div>
<div id="info">
<button id="Polygon">Polygon</button>
</div>
<div id="mapDiv" style="width: 900px; height: 600px; border: 1px solid #000;"></div>
</body>
</html>
A与B相交后的图形查询的更多相关文章
- ArcGIS Engine开发之图形查询
图形查询是以用户通过鼠标操作生成的图形几何体为输入条件进行查询的查询,其查询结果为该几何体空间范围内的所有要素.常用的查询方式包括点选.线选.多边形选择.圆形选择和矩形选择等. 相关类与接口 图像查询 ...
- mysql(4)—— 表连接查询与where后使用子查询的性能分析。
子查询就是在一条查询语句中还有其它的查询语句,主查询得到的结果依赖于子查询的结果. 子查询的子语句可以在一条sql语句的FROM,JOIN,和WHERE后面,本文主要针对在WHERE后面使用子查询与表 ...
- 矢量图面层和线层相交得到相交后的线层文件(gis相交)
目的:将arcgis里的面层和线层相交(重叠)部分的线单独生成一个shp文件,用于道路路网密度计算等. 注意:进行相交运算后生成的是线要素文件,相当于把面线相交部分的线单独拿了出来. 操作例子:将图示 ...
- 图形查询属性(IdentifyTask实现查询)//查询本地服务
主页代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tit ...
- C#根据域名查询IP(CMD命令参数输入或者启动程序后再输入查询)
有时因为需要,希望知道域名的IP,那用C#怎么实现呢?以下是实现代码 using System; using System.Collections.Generic; using System.Linq ...
- Spring(五):Spring&Struts2&Hibernate整合后,实现查询Employee信息
背景: 基于之前两篇文章<Spring(三):Spring整合Hibernate>.<Spring(四):Spring整合Hibernate,之后整合Struts2>,了解了如 ...
- 分库分表后跨分片查询与Elastic Search
携程酒店订单Elastic Search实战:http://www.lvesu.com/blog/main/cms-610.html 为什么分库分表后不建议跨分片查询:https://www.jian ...
- Centos7.1 mini版安装后安装图形界面教程
[1]GNOME安装 1.执行下面命令安装GNOME Desktop Environment yum -y groups install "GNOME Desktop" 2.安装完 ...
- Hibernate更新删除数据后,再查询数据依然存在的解决办法
删除数据后,重新查询了数据库,DB中记录已经删除了,但是数据依然能查询到,网上都说是Hibernate的缓冲问题. 我对session进行了clear,flush,并且在事务和查询中都对session ...
随机推荐
- (49) odoo context操作
* context 这是一个上下文,运用很灵活 * 得到整个context V7 context=dict(context or {}) 这个版本是明传 V8 self.context_ ...
- find / -type f -name "*fetion*" |xargs rm -rf {}\
find / -type f -name "*fetion*" |xargs rm -rf {}\
- 如何刷新DNS缓存
经常换空间的朋友一定知道,域名解析到新空间后,要一段时间才会生效到新空间,这是由于本地的DNS生效不及时导致的.这里青互联教大家一个即时更新本地DNS的方法. 在不同的系统中刷新DNS缓存的方法如下. ...
- Deployment failure on Tomcat 6.x. Could not copy all resources to
在myeclipse总部署项目,一直有问题,提示如下的错误,经过研究在网上需求帮助,解决方案如下: Deployment failure on Tomcat 6.x. Could not copy ...
- Python笔记总结week3
Set集合: 无序,不重复的序列 a. 创建 se = {"123,"456" } print(type(se)) #创建集合方式 s1 = se = {"12 ...
- js Date 函数方法 和 移动端数字键盘调用
var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFullYear(); //获取完整的年份(4位,1970-???? ...
- PHP分页代码
} <a href="fenye.php?page=<?php echo <?php } <a href="fenye ...
- 临界区 TRTLCriticalSection 和 TCriticalSection
临界区对象TCriticalSection(Delphi) 与 TRtlCriticalSection 的区别 TRtlCriticalSection 是一个结构体,在windows单元中定义: 是I ...
- github上面建立分支
首先是有一个github的账户,然后随便开个项目. 好了,现在把git命令行打开,输入下面几行代码. git clone https://github.com/user/repository.git ...
- UIImagePickerController和UIAlertController结合使用
在处理个人资料 - 头像的时候,通常有两个选项,一个是调用系统相机,一个是调用系统相册.这里要使用的就是UIImagePickerController方法. 在头像位置的imageView添加一个手势 ...