AnsweredAssumed Answered

add a custom image and a label for features

Question asked by mallareddy2271 on Dec 10, 2018
Latest reply on Dec 11, 2018 by rscheitlin

i was trying to add a custom picture.png file for features and a label  to it

for example:

buildingImage.png+(Building Id)

 

went to through some examples, but didn't helped me.

 

Any suggestions

Thanks

 

 

<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
  <title>FeatureTable - Custom Menu Items</title>
  <link rel="stylesheet" href="https://js.arcgis.com/3.26/dijit/themes/claro/claro.css">
  <link rel="stylesheet" href="https://js.arcgis.com/3.26/esri/css/esri.css">
  <script src="https://js.arcgis.com/3.26/"></script>

  <style>
    html, body, #map {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
    }
  </style>

  <script>
    require([
      "esri/layers/FeatureLayer",
      "esri/geometry/Extent",
      "esri/graphicsUtils",
      "esri/tasks/query",
      "esri/map",
      "dojo/dom",
      "dojo/parser",
      "dojo/ready",
      "dojo/on",
      "dijit/layout/ContentPane",
      "dijit/layout/BorderContainer"
    ], function (
      FeatureLayer, Extent, graphicsUtils, Query, Map,
      dom, parser, ready, on, ContentPane, BorderContainer
    ) {

      parser.parse();

      ready(function(){
        var map = new Map("map",{
          basemap: "dark-gray",
          extent: new Extent({xmax: -13035353.854156237, xmin: -13053431.211345658,
            ymax: 4038351.1313028745, ymin: 4034089.766975982,
            "spatialReference":{"wkid":102100,"latestWkid":3857}
          })
        });

        //Load a FeatureTable to the application once map loads
        map.on("load", loadTable);

        function loadTable(){
   
          // editable FeatureLayer
          var myFeatureLayer = new FeatureLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/RedlandsEmergencyVehicles/FeatureServer/1", {
            mode: FeatureLayer.MODE_ONDEMAND,
            outFields: ["*"],
            visible: true,
            id: "fLayer2"
          });

      
        
        
     
          map.addLayer(myFeatureLayer);

     
       
        }
      });
    });
  </script>
</head>
<body class="claro esri">
  <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;">
    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center', splitter:true" style="height:50%">
      <div id="map"></div>
    </div>
    <div id="bot" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'bottom', splitter:true">
   
    </div>
  </div>
</body>
</html>

Outcomes