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 ...
随机推荐
- Python中文乱码
1,注意:请使用智慧型浏览器 "CHROME" 配合理解和运作本文中提到的程序. 2,提示:谷歌的CHROME浏览器是迄今为止最智慧的浏览器,没有之一,只有第一. 3,谷歌的CHR ...
- TensorFlow之Varibale 使用方法
------------------------------------------- 转载请注明: 来自博客园 xiuyuxuanchen 地址:http://www.cnblogs.com/gre ...
- ajax和sap以及网络安全
1.sap(single page applaction)一个页面通过众多ajax请求完成的一个app 优点是:减少页面跳转,UI公用部分的重复加载 缺点: 1.ajax过多的请求,对服务器性能有所 ...
- 一个会Flash的人来说CSS3
以前在上大学的时候学过Flash,而且以前做一些网页效果都是用的Flash,现在才知道以前我所用的方法是有多麻烦.在学过CSS3之后,我发现以前要用Flash写半天的效果,现在用几句CSS3代码就搞定 ...
- Linux vi
修改linux服务器中的文件内容,使用vi编辑器 1.#vi [文件名] 2.点击i,进入编辑模式 3.要退出按ESC,进入中间模式,按冒号 :后面跟命令 :q! (不保存并退出) :wq (保存 ...
- MySql学习(五) —— 数据库优化理论篇(一)
一.数据库管理系统 数据库管理系统(Database Management System, DBMS) 衡量是否是数据库的标准: ACID:是指在数据库管理系统(DBMS)中事务所具有的四个特性: 1 ...
- 安装CAD2006装好了为什么不能用,显示系统错误无法启动此程序,因计算机丢失aclst.dll。尝试重新安装该程序以解
我的电脑,右键 属性——>高级选项卡(win7的是高级系统设置)——>环境变量——>系统变量——>然后新建系统变量 变量名为:AutoCAD 变量值为:c:\program f ...
- JAVA中的类和接口
1.类: 类是具有相同属性和方法的一组对象的集合,它为属于该类的所有对象提供了统一的抽象描述,其内部包括属性和方法两个主要部分.在面向对象的编程语言中,类是一个独立的程序单位,它应该有一个类名并包括属 ...
- Adapter 启动时报错
如果把Adapter安装到C盘,有时在启动Adapter的时候会抛出java.io.IOException: Cannot run program "C:\tibco\adapter\adr ...
- iosOpenDev-install 失败官方wiki无法解决看这里(尝试有效)
https://github.com/kokoabim/iOSOpenDev/wiki/Troubleshoot http://blog.csdn.net/bluesky_03/article/det ...