1.发布地图服务。

url:http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer

2.添加样式引用:

link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.5/js/dojo/dijit/themes/tundra/tundra.css">
此样式用来定义body的样式。引用后就可以在body中利用class=“tundra”

link标签的用法具体见:http://www.w3school.com.cn/tags/tag_link.asp

3.添加js引用,此引用必须有,javascript API就是依此包完成GIS功能的。

引用地址为:<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.5"></script>

4.添加层div,用来显示地图:

<div id="map" style="width:900px; height:600px; border:1px solid #000;"></div>

5.添加JavaScript初始化地图,并加载本地图层。

function init() {
        var map = new esri.Map("map");   //注册map控件

var imageParameters = new esri.layers.ImageParameters();
        imageParameters.format = "png24";  //set the image type to PNG24, note default is PNG8.
        //Takes a URL to a non cached map service.
        var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer", {"opacity":0.5, "imageParameters":imageParameters});
        map.addLayer(dynamicMapServiceLayer);
      }

本例全部代码如下

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>Create Map</title>
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.5/js/dojo/dijit/themes/tundra/tundra.css">
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.5"></script>
    <script type="text/javascript">
      dojo.require("esri.map");

function init() {
        var map = new esri.Map("map");

var imageParameters = new esri.layers.ImageParameters();
        imageParameters.format = "png24";  //set the image type to PNG24, note default is PNG8.
        //Takes a URL to a non cached map service.
        var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer", {"opacity":0.5, "imageParameters":imageParameters});
        map.addLayer(dynamicMapServiceLayer);
      }

dojo.addOnLoad(init);
    </script>
  </head>
  <body class="tundra">
    <div id="map" style="width:900px; height:600px; border:1px solid #000;"></div>
    Creates a map and adds an ArcGISDynamicMapServiceLayer.<br />
    Map navigation using mouse:
    <ul>
      <li>Drag to pan</li>
      <li>SHIFT + Click to recenter</li>
      <li>SHIFT + Drag to zoom in</li>
      <li>SHIFT + CTRL + Drag to zoom out</li>
      <li>Mouse Scroll Forward to zoom in</li>
      <li>Mouse Scroll Backward to zoom out</li>
      <li>Use Arrow keys to pan</li>
      <li>+ key to zoom in a level</li>
      <li>- key to zoom out a level</li>
      <li>Double Click to Center and Zoom in</li>
    </ul>
  </body>
</html>

转载于:https://www.cnblogs.com/pandy/archive/2011/03/06/1972603.html

2.4 Add a dynamic map相关推荐

  1. Using jQuery to add a dynamic “Back To Top” floating button with smooth scroll

    Ever read a really long blog post or article and then had to scroll all the way up to the top of the ...

  2. list的add方法 ,foreach循环添加map---List.add(map)(通过一个java爬虫案例说明)

    案例:一个java爬虫程序 1.案例说明 做了一个爬取某程的旅游网站的java程序,程序主要爬取安庆酒店的某些相关信息. 材料准备:jsoup-1.8.1.jar(需要此架包的联系博主,有任何问题欢迎 ...

  3. Dynamic LAN-to-LAN ××× 之 Router-to-Router

    Router-to-Router Dynamic LAN-to-LAN ××× 1.拓扑 2.步骤 2.1基本连通性配置: R5: interface FastEthernet0/0 ip addre ...

  4. openlayers基础(一)——Map

    openlayers是一个开源免费的js库,用于在网页中实现地图的动态显示和交互.一起看看官方对openlayers的介绍. OpenLayers makes it easy to put a dyn ...

  5. GEE:DTW(Dynamic Time Warping)动态时间规整,Sentinel-2 时间序列分类

    时间动态规整算法(Dynamic Time Warping,DTW)是一种常用到的时间序列分析方法,常用于时间序列分类.模式发现. 卫星影像时间序列分类的动态时间规整介绍:https://medium ...

  6. Map与List数据操作

    为避免与数据库的多次连接,减少数据库的压力,先将所有的订货数据先从数据库中抽取出来,而后再将数据按门店进行分类汇总以备待用,Map与List混合操作,理解数据结构.提神醒脑哦. 以下是原始数据结构: ...

  7. Gson应用:利用map和list来拼装Json消息

    Gson应用:利用map和list来拼装Json消息 1 2 3 import java.util.ArrayList; 4 import java.util.HashMap; 5 import ja ...

  8. arcgis api for flex 开发入门(二)map 的创建

    arcgis api for flex 开发入门(二)map 的创建 在flex 中创建一个esri 的map ,你只需要使用<esri:Map>标签就可以轻松完成. 在<esri: ...

  9. flutter - dart基础之map

    Map定义 不指定泛型 var map1 = {'aa': 'aaa', 'bb': 'bbb', 'cc': true}; //直接赋值初始值print(map1); //{aa: aaa, bb: ...

最新文章

  1. ICML 2020 | 小样本学习首次引入领域迁移技术,屡获新SOTA结果
  2. linux获取网卡的ip,Windows和Linux系统下获取多网卡的ip地址
  3. 什么是工装服_王俊凯穿连体工装亮相跨年晚会,中国风满满的设计,尽显帅气...
  4. Scala伴生类和伴生对象
  5. Codeforces Round #620 (Div. 2) F2. Animal Observation (hard version) dp + 线段树
  6. python调用所有函数_python 调用函数
  7. Mysql插入中文的字段内容时乱码的解决方法
  8. 湘潭大学 计算机学院程诗婕,云南大学学生获得2019CCF大学生计算机系统与程序设计竞赛西...
  9. getset原子性 redis_RedisAPI原子性操作及原理解析
  10. JAVA的包装类 【转】
  11. iPad和iPhone上的应用程序图标
  12. 学习python的语法规则
  13. 凤凰系统 android 分辨率,凤凰系统如何修改屏幕分辨率[多图]
  14. 微信号可以一年内第二次修改技巧吗?
  15. 从高考到程序员——我一直在寻找答案
  16. PPT设置自动保存时间 mac_PPT又崩溃了?教你如何恢复文档
  17. 怎样使用Markdown输入数学公式
  18. STM32驱动_cc2420
  19. 小丸子学Docker系列之——实战Dockerfile
  20. 【RC延迟电路与缓慢泄放电路 】 multisim 14.0仿真 参数计算

热门文章

  1. c语言如何快速看懂别人的程序,探究如何快速看懂单片机程序方法
  2. openstack云主机无法绑定ip_智汇华云|OpenStack 虚拟机 GPU 性能优化
  3. POJ 2182 Lost Cows (求序列第k大)
  4. Python3.5+selenium操作Chrome浏览器的简单实例
  5. ubuntu-Linux下如何安装Tensorflow?
  6. 个人学习进度(第十三周)
  7. java9-6 内部类
  8. 上传图片配置文件长度和宽度大小的说明
  9. EasyUI中combotree允许多选的时候onSelect事件会重复触发onCheck事件
  10. JavaScript网站设计实践(五)编写photos.html页面,实现点击缩略图显示大图的效果...