Select to view content in your preferred language

i want render point symbol my code is not work

2762
1
08-21-2014 12:20 AM
lasinh
by
Occasional Contributor

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>

  <title>Create a Map</title>

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

  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

  <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.10/js/dojo/dijit/themes/claro/claro.css">

  <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.10/js/esri/css/esri.css" />

 

 

  <script type="text/javascript">      dojoConfig = { parseOnLoad: true };</script>

 

 

  <script type="text/javascript" src="http://js.arcgis.com/3.10/"></script>

  <style>

    html, body, #mapDiv, .map.container {

      padding: 0;

      margin: 0;

      height: 100%;

    }

  </style>

  <script type="text/javascript">

      dojo.require("esri.map");

      dojo.require("esri.layers.FeatureLayer");

      dojo.require("dojo.date.locale");

 

 

      function init() {

 

 

 

 

          var initialExtent = new esri.geometry.Extent({ "xmin": -163.01, "ymin": 3.52, "xmax": 51.96, "ymax": 64.17, "spatialReference": { "wkid": 4326} });

 

 

 

 

          var map = new esri.Map("mapDiv", {

              extent: esri.geometry.geographicToWebMercator(initialExtent)

          });

 

 

          dojo.connect(window, 'resize', map, map.resize);

 

 

          var basemapURL = "http://192.166.3.252:6080/arcgis/rest/services/NENCHUNG/Nen_chung1/MapServer";

         var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);

 

 

         map.addLayer(basemap);

 

 

          //define info window and format contents https://developers.arcgis.com/javascript/jsapi/infotemplate-amd.html

          var template = esri.InfoTemplate({

              title: "${ten}",

              content: "<br>${ten}, ${diaChi}"

          });

          var featureLayer = new esri.layers.FeatureLayer("http://192.166.3.252:6080/arcgis/rest/services/NENCHUNG/Nen_chung1/MapServer/2", {

              infoTemplate: template,

              outFields: ["*"]

          });

 

 

          //resize the info window

          map.infoWindow.resize(160, 80);

 

 

          //add a layer definition to filter to display the features

//          featureLayer.setDefinitionExpression("Tour = 'Unforgettable Fire 2nd Leg'");

 

 

          //define new symbol for feature layer - generated with https://developers.arcgis.com/javascript/jshelp/inside_renderers.html

          var symbol = new esri.symbol.PictureMarkerSymbol({

              "angle": 0,

              "xoffset": 0,

              "yoffset": 10,

              "type": "esriPMS",

              "url": "http://static.arcgis.com/images/Symbols/Shapes/BluePin1LargeB.png",

              "contentType": "image/png",

              "width": 24,

              "height": 24

          });

          featureLayer.setRenderer(new esri.renderer.SimpleRenderer(symbol));

 

 

          map.addLayer(featureLayer);

 

 

 

 

      }

 

 

      dojo.addOnLoad(init);

  </script>

 

 

</head>

<body class="claro">

<div id="mapDiv"></div>

</body>

</html>

0 Kudos
1 Reply
OwenEarley
Frequent Contributor

Check this source for this modified ESRI sample on JS Bin - Picture Marker Symbol

This uses the new AMD style of loading modules instead of the old dojo.require() style. See this page for more information Dojo and AMD | Guide | ArcGIS API for JavaScript

0 Kudos