<!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. python中SQL的使用

    # 常用的关系型数据库有 mysql postgresql sqlite 等(具体区别上课再说) # # 传统数据库以表的形式存储数据 # 一张表可以有很多个字段 # 以用户表为例, 存储 4 个数据 ...

  2. Nodejs各种功能Module的收集整理

    收集整理接触过的各种常用的nodejs modules,不断更新~~~ ================================================================ ...

  3. JavaBean属性

    一个JavaBean对象的属性应该是可访问的.这个属性可以是任意合法的Java数据类型,包括自定义Java类. 一个JavaBean对象的属性可以是可读写,或只读,或只写.JavaBean对象的属性通 ...

  4. Hibernate标准查询语言

    Hibernate标准(Criteria)查询语言(HCQL)用于根据具体条件获取记录.Criteria接口提供了应用标准的方法,例如检索薪水大于50000的表的所有记录. HCQL的优势 HCQL提 ...

  5. Spring MVC文本框

    以下示例显示如何使用Spring Web MVC框架在表单中使用文本框.首先使用Eclipse IDE来创建一个Web工程,按照以下步骤使用Spring Web Framework开发基于动态表单的W ...

  6. Eclipse 运行配置(Run Configuration)

    Eclipse 运行配置(Run Configuration) 创建和使用 Eclipse 运行配置 在运行配置(Run Configuration)对话框中可以创建多个运行配置.每个配置可以在应用中 ...

  7. linux中使用vi 打开文件时,能显示行号

    方法一: 1.显示当前行行号,在VI的命令模式下输入 :nu 2.显示所有行号,在VI的命令模式下输入     :set nu方法二: 使用vi编辑~/.vimrc文件,在该文件中加入一行" ...

  8. (四)DIH导入结构化数据

    (四)DIH导入结构化数据 目前大多数的应用程序将数据存储在关系数据库(如oracle.sql server .mysql等).xml文件中.对这样的数据进行搜索是很常见的应用.所谓的DataImpo ...

  9. easy 正则表达式验证 封装

    基于EasyUI ValidateBox 的表单验证,可以直接写正则表达式. 在页面加载时执行下面代码 if ($.fn.form) { $.extend($.fn.validatebox.defau ...

  10. 二维码及二维码接合短URL的应用

    二维码 1.什么是二维码? 二维条形码,最早发明于日本,它是用某种特定的几何图形按一定规律在平面(二维方向上)分布的黑白相间的图形记录数据符号信息的,在代码编制上巧妙地利用构成计算机内部逻辑基础的“0 ...