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

利用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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog