arcgis javascript初使用

1:下载    ArcGIS API For Javascript 官网下载好像要有账号并且国内邮箱账号注册好像不支持, 我也没找免费下在的地方,好像看到有篇博客写了怎么免费下载的方法,下次在找看到在试下,我会把在csdn用币下载的都放到网盘分享出来

2:按照官网的方法(网上好多博客也写了)先把两个js中的地址配置成losthost:8080,然后放到tomcat中如下:

参考这个html改js文件中那mapserver地址,我使用其它版本的时候地图出不来,改的js在浏览器开发者模式下看到报错不知道什么原因,后来我使用这个版本并把https改成了http,版本无所谓,4版本只是多支持了3d等功能

放到tomcat位置

Html代码直接使用 的官网的例子

<!DOCTYPE HTML>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title>Simple Map</title>

    <link rel="stylesheet" type="text/css" href="http://localhost:8080/arcgis_js_api/library/3.22/3.22/esri/css/esri.css" />

    <script src="http://localhost:8080/arcgis_js_api/library/3.22/3.22/init.js"></script>

    <style>

      html, body, #map {

        height: 100%; width: 100%; margin: 0; padding: 0;

      }

    </style>

    <script>

      require(["esri/map",

          "esri/layers/ArcGISTiledMapServiceLayer",

          "dojo/domReady!"],

        function(Map, ArcGISTiledMapServiceLayer) {

          var map = new Map("map");

          //If you do not have Internet access then you will need to point this url to your own locally accessible tiled service.

          var tiled = new ArcGISTiledMapServiceLayer("https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer");

          map.addLayer(tiled);

        }

      );      

    </script>

  </head>

  <body>

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

  </body>

</html>

 

 

效果:

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值