<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<link rel="stylesheet" href="//js.arcgis.com/3.13/esri/css/esri.css">
<style>
html, body, #map {
height: 100%; width: 100%; margin: 0; padding: 0;
}
</style> <script src="//js.arcgis.com/3.13/"></script>
<script>
var map; require([
"esri/map",
"esri/geometry/Extent",
"esri/layers/FeatureLayer", "esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/TextSymbol",
"esri/renderers/SimpleRenderer", "esri/layers/LabelLayer", "esri/Color",
"dojo/domReady!"
], function(
Map, Extent, FeatureLayer,
SimpleLineSymbol, SimpleFillSymbol, TextSymbol, SimpleRenderer,
LabelLayer,
Color
) {
// load the map centered on the United States
var bbox = new Extent({"xmin": -1940058, "ymin": -814715, "xmax": 1683105, "ymax": 1446096, "spatialReference": {"wkid": 102003}});
map = new Map("map", {
extent: bbox
}); var labelField = "STATE_NAME"; // create a renderer for the states layer to override default symbology
var statesColor = new Color("#f00");
var statesLine = new SimpleLineSymbol("solid", statesColor, 1);
var statesSymbol = new SimpleFillSymbol("solid", statesLine, null);
var statesRenderer = new SimpleRenderer(statesSymbol);
// create a feature layer to show country boundaries
var statesUrl = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3";
var states = new FeatureLayer(statesUrl, {
id: "states",
outFields: [labelField]
});
states.setRenderer(statesRenderer);
map.addLayer(states); // create a text symbol to define the style of labels
var statesLabel = new TextSymbol().setColor(new Color("#00f"));
statesLabel.font.setSize("12pt");
statesLabel.font.setFamily("arial");
var statesLabelRenderer = new SimpleRenderer(statesLabel);
var labels = new LabelLayer({ id: "lab" });
// tell the label layer to label the countries feature layer
// using the field named "admin"
labels.addFeatureLayer(states, statesLabelRenderer, "{" + labelField + "}");
// add the label layer to the map
map.addLayer(labels);
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>

five application :Labeling features的更多相关文章

  1. OpenCms Application dev-ref

    OpenCms Application Overview Before undertaking development, it will be helpful to understand the ba ...

  2. IIS 7.0 Features and Vista Editions

    原文 IIS 7.0 Features and Vista Editions Overview of IIS 7.0 differences Across Windows Vista Editions ...

  3. 4: 模块化应用程序开发 Modular Application Development Using Prism Library 5.0 for WPF (英汉对照版)

    A modular application is an application that is divided into a set of loosely coupled functional uni ...

  4. 学习ASP.NET Core, 怎能不了解请求处理管道[3]: 自定义一个服务器感受一下管道是如何监听、接收和响应请求的

    我们在<服务器在管道中的"龙头"地位>中对ASP.NET Core默认提供的具有跨平台能力的KestrelServer进行了介绍,为了让读者朋友们对管道中的服务器具有更 ...

  5. 如果你想深刻理解ASP.NET Core请求处理管道,可以试着写一个自定义的Server

    我们在上面对ASP.NET Core默认提供的具有跨平台能力的KestrelServer进行了详细介绍(<聊聊ASP.NET Core默认提供的这个跨平台的服务器——KestrelServer& ...

  6. ASP.NET Core 中文文档 第三章 原理(16).NET开放Web接口(OWIN)

    原文:Open Web Interface for .NET (OWIN) 作者:Steve Smith. Rick Anderson 翻译:谢炀(kiler398) 校对:孟帅洋(书缘) ASP.N ...

  7. Feature Flag

    know more from here: https://www.youtube.com/watch?v=WMRjj06R6jg&list=UUkQX1tChV7Z7l1LFF4L9j_g F ...

  8. apk反编译(6)ProGuard 工具 android studio版官方教程[作用,配置,解混淆,优化示例]

    ProGuard In this document Enabling ProGuard (Gradle Builds) Configuring ProGuard Examples Decoding O ...

  9. session问题

    如果 <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424&q ...

随机推荐

  1. hash和encrypt区别及应用_转

    转自:哈希(Hash)与加密(Encrypt)的基本原理.区别及工程应用 0.摘要 今天看到吉日嘎拉的一篇关于管理软件中信息加密和安全的文章,感觉非常有实际意义.文中作者从实践经验出发,讨论了信息管理 ...

  2. 日志系统之扩展Flume-LineDeserializer

    本人博客文章如未特别注明皆为原创.如有转载请注明出处:http://blog.csdn.net/yanghua_kobe/article/details/46595401 继续闲聊日志系统,在之前的博 ...

  3. 大数据(4) - HDFS常用的shell操作

    注意:这次使用的是第二部分安装的集群,不是高可用集群 为了方便,开发,必须写集群脚本,试想集群的机器是100台以上,而不是3台的情况.... 集群启动脚本 vim /home/admin/tools/ ...

  4. 配置LANMP环境(2)-- 安装ifconfig命令与安装SecureCRT

    一.安装ifconfig命令 yum whatprovides ifconfig yum install net-tools 安装这个命令就是为了查看虚拟机的ip地址,SecureCRT连接必须要ip ...

  5. jxta 2.8x启动了

    http://chaupal.github.io/ ———————————————————————————————————————————————————————————————————— 至少两个月 ...

  6. 集合映射中的映射列表(使用xml文件)

    如果持久化类具有List对象,我们可以通过映射文件中的类的<list>元素或注释来映射List. 在这里,我们正在使用论坛的场景,其中一个问题有多个答案. 在这里,我们使用论坛的场景,其中 ...

  7. [转]Maven2中snapshot快照库的使用

    Post by 铁木箱子 in Java, 技术杂谈 on 2011-10-28 12:12. [转载声明] 转载时必须标注:本文来源于铁木箱子的博客http://www.mzone.cc[原文地址] ...

  8. html 模版

    使用后台开发语言的都很了解语言的动态性给开发带来的好处,PHP,aspx,jsp页面都可以直接使用相应的语法和变量,输出的事就交给解释器或编译器了,用起来方便快捷,但需要额外的解释工作: 例如php模 ...

  9. db2将原表列notnull属性修改为null属性的方法

    今天把自己遇到的一个小问题跟大家分享一下如何修改db2数据库表中列的属性--将列的非空属性改为允许空的属性,修改数据表的某一列属性其实很简单但是里面有需要细节需要dba注意,毕竟数据的安全才是最重要的 ...

  10. Linux 的字符串截取很有用。有八种方法。

    假设有变量 var=http://www.aaa.com/123.htm 1. # 号截取,删除左边字符,保留右边字符. echo ${var#*//} 其中 var 是变量名,# 号是运算符,*// ...