ArcGIS Scalebar 比例尺 充满div
说明:本篇博文地图充满div,上一篇博文是充满整个body
运行效果:

2、HTML代码
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Scalebar应用</title>
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js3_api/library/3.3/jsapi/js/dojo/dijit/themes/claro/claro.css"/>
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js3_api/library/3.3/jsapi/js/esri/css/esri.css" /> <style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{padding:0;}
</style> <script>var dojoConfig = { parseOnLoad: true };</script> <script type="text/Javascript" src="http://localhost/arcgis_js3_api/library/3.3/jsapi/init.js"></script>
<script type="text/Javascript">
var MyMap;
var MyTiledMapServiceLayer;
dojo.require("dojo.parser");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.dijit.Scalebar");
var map; function init() {
map = new esri.Map("map", {
basemap: "topo", // 指定的地图底图.有效选项:"streets","satellite","hybrid","topo","gray","oceans","national-geographic","osm".
center: [-116.093, 34.218],
zoom: 7
}); dojo.connect(map, "onLoad", function (theMap) {
var scalebar = new esri.dijit.Scalebar({
map: map, // 必须的
scalebarUnit: "english" // 指定比例尺单位,有效值是"english" or "metric".默认"english"
});
});
} dojo.ready(init); // 初始化加载
</script>
</head> <body class="claro">
<div style="width:700px;height:600px;">
<div data-dojo-type="dijit.layout.BorderContainer"
data-dojo-props="design:'headline', gutters:false"
style="width: 100%; height: 100%; margin: 0;"> <div id="map"
data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region:'center'"
style="overflow:hidden;">
</div> </div>
</div>
</body> </html>
其中代码
map = new esri.Map("map", {
basemap: "topo", // 指定的地图底图.有效选项:"streets","satellite","hybrid","topo","gray","oceans","national-geographic","osm".
center: [-116.093, 34.218],
zoom: 7
});
也可以改写为如下形式:
map = new esri.Map("map", { center: [-122.445, 37.752], zoom: 4 });
MyTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer
("http://localhost/arcgis/rest/services/DZDT2012/MapServer");
map.addLayer(MyTiledMapServiceLayer);
注意:直接拷贝代码的时候 要把引用文件的
arcgis_js3_api修改为
arcgis_js_api
例如:
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js3_api/library/3.3/jsapi/js/dojo/dijit/themes/claro/claro.css"/>修改为
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.3/jsapi/js/dojo/dijit/themes/claro/claro.css"/>
因为我本机IIS文件夹名称是
arcgis_js3_api
ArcGIS Scalebar 比例尺 充满div的更多相关文章
- ArcGIS Scalebar 比例尺
说明.这篇博文的示例代码 地图充满body arcgis api for javascript iis怎么离线部署 请参考我前面的博文 1.运行效果 3.HTML代码 <!DOCTYPE htm ...
- css背景图片充满DIV
最近接手前端页面,让给调样式.哥纯粹一个代码程序猿,表示那些个样式应该让前端人员或者美工小妹妹来实现. 书归正传,碰到了问题,页面要在手机上展现,众所周知,手机在中国的牌子很多,很难做到统一. 页面上 ...
- Arcgis Javascript API 开发笔记
JS API3.4的要求 à(1) IE9或以上版本 否则dijit1.8.3不匹配 1.如何发布ArcgisJavascript API应用 0.准备工作: (1).有web应用: (2).有js ...
- JS监听div的resize事件
原文地址:http://zhangyiheng.com/blog/articles/div_resize.html 需求 开发过程中经常遇到的一个问题就是如何监听一个div的size变化. 比如我用c ...
- ArcGIS API for JS4.7加载FeatureLayer,点击弹出信息并高亮显示
我加载的是ArcGIS Server本地发布的FeatureService,ArcGIS API for JS4.7记载FeatureLayer时,在二维需要通过代码启用WebGL渲染,在三维模式下, ...
- css background-size与背景图片填满div
background-size与背景图片填满div 在开发中,常有需要将一张图片作为一个div的背景图片充满div的需求 background-size的取值及解释 background-size共有 ...
- resize监听div的size变化
具体实现分两类, ie9-10 默认支持div的resize事件,可以直接通过div.attachEvent('onresize', handler);的方式实现 其它浏览器 通过在div中添加一个内 ...
- Openlayers3 WebGis二次开发包实例
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs& ...
- WebGis二次开发包实例
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs& ...
随机推荐
- Lock flag DX
https://msdn.microsoft.com/en-us/library/windows/desktop/bb322846(v=vs.85).aspx discard nooverwrite ...
- Unity3D导入外部任务模型无法触发鼠标事件解决方案
前几日 在做U3D测试的时候 导入了网上的一个人物模型 但是后来发现无论如何该模型都无法响应诸如:OnMouseDown 这些鼠标事件 又用U3D自带的水管工做了测试 发现不是我系统的问题= = 水管 ...
- 2017.5.9 java多线程总结
参考来自:http://www.cnblogs.com/lwbqqyumidi/p/3804883.html http://blog.csdn.net/gf771115/article/details ...
- DataSet之增删改查操作(DataGridView绑定)
DataSet数据集,数据缓存在客户端内存中,支持断开式连接.DataGridView控件绑定DataSet时,它自动的改变的DS的行的状态,而且在做增删改查的时候,可以借助SqlCommandBui ...
- Centos 7 搭建OpenStack 私有云——(1)基础环境配置
1.简介: OpenStack是一个由NASA(美国国家航空航天局)和Rackspace合作研发并发起的,以Apache许可证授权的自由软件和开放源代码项目. OpenStack是一个开源的云计算管理 ...
- ubuntu用su切换,输入密码提示认证失败解决办法
ubuntu用su切换,输入密码提示认证失败,经查阅原来Ubuntu安装后,root用户默认是被锁定了的,不允许登录,也不允许 su 到 root ,对于桌面用户来说这个可能是为了增强安全性. 终端下 ...
- AFN检測网络情况
问: I'm a bit lost on AFNetorking's Reachability and haven't found a lot of good information out ther ...
- Asp.net Mvc使用PagedList分页
git:https://github.com/troygoode/PagedList 1. Nuget 安装package watermark/2/text/aHR0cDovL2Jsb2cuY3Nkb ...
- Win10 导航窗口不能移动文件win10 资源管理器 无法拖动文件到左侧驱动器
Win10 导航窗口不能移动文件怎么办 Win10左侧导航栏不能移动文件怎么办 win10 资源管理器 无法拖动文件到左侧驱动器怎么办 在同一个文件夹可以拖动来移动文件,拖到地址栏的面包屑也可以移动文 ...
- Spring MVC 学习笔记 spring mvc Schema-based configuration
Spring mvc 目前支持5个tag,分别是 mvc:annotation-driven,mvc:interceptors,mvc:view-controller, mvc:resources和m ...