我的安静不安静 2015-12-23 07:42 采纳率: 0%
浏览 9856
已结题

利用arcgis api for javascript实现在地图上点的弹出(我的信息弹出不了)

<!DOCTYPE html>




Simple Map
<style>
  html, body, #map {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  body {
    background-color: #FFF;
    overflow: hidden;
    font-family: "Trebuchet MS";
  }
</style>
<script type="text/javascript" src="http://192.168.1.187:8080/arcgis_js_api/library/3.9/3.9/init.js"></script>

<script>
    var map, graphic1, pointlayer, myPoint1;

    require([
        "dojo/dom", "dojo/_base/array", "dojo/promise/all", "dojo/json",
        "esri/map", "esri/domUtils", "esri/graphic", "esri/graphicsUtils",
        "esri/geometry/Polygon", "esri/tasks/GeometryService", "esri/geometry/Point", "esri/tasks/Geoprocessor",
        "esri/tasks/FeatureSet", "esri/tasks/RelationParameters", "esri/symbols/PictureMarkerSymbol",
        "esri/Color", "esri/symbols/SimpleLineSymbol", "esri/SpatialReference",
        "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleFillSymbol",
        "esri/layers/GraphicsLayer", "esri/geometry/Extent", "esri/InfoTemplate", "dojo/domReady!"
    ], function (dom, array, all, JSON,
        Map, domUtils, Graphic, graphicsUtils,
        Polygon, GeometryService, Point, Geoprocessor,
        FeatureSet, RelationParameters, PictureMarkerSymbol,
        Color, SimpleLineSymbol, SpatialReference,
        SimpleMarkerSymbol, SimpleFillSymbol,
        GraphicsLayer, InfoTemplate
        ) {
        map = new Map("map", {
            basemap: "topo",
            center: [113.33, 36.33],
            zoom: 13
        });


        pointlayer = new GraphicsLayer();
        map.addLayer(pointlayer);

        var attributes = {
            "省份": "安徽",
            "录取率": 43.04,
            "未录取率": 56.96
        };
        myPoint1 = esri.geometry.geographicToWebMercator(new esri.geometry.Point
        (
        {
            "x": 113.33,
            "y": 36.33,
            "spatialReference": { "wkid": 4326 }
        }));

       var symbol = new esri.symbol.PictureMarkerSymbol('image/chaoren.png', 20, 20);

       var infoTemplate = new InfoTemplate("标题${省份}", "${省份}的录取率为${录取率},未录取率为${未录取率}");
        graphic1 = new esri.Graphic(myPoint1, symbol, attributes, infoTemplate);

        pointlayer.add(graphic1);

    });
</script>              




  • 写回答

1条回答 默认 最新

  • devmiao 2016-02-07 23:32
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?