javascriptmappingarcgis

Diff between sourceurl and linkurl and how to display image attachments for different features in 1 layer


What is the difference between the sourceURL and linkURL?

Also, I have a layer that has multiple features. Each feature has an attached image. How would I set up the popup to find and show the attachment unique to the feature?

  //define a popup template
        var popupTemplate = new esri.dijit.PopupTemplate({
          title: "{BUILDING}",
          fieldInfos: [
          {fieldName: "FLOOR", visible: true, label:"Floor:"},
          {fieldName: "BUILDING", visible: true, label:"Building Name:"},
          {fieldName: "CAMERA", visible: false, label:"Camera:"},
          ],
          mediaInfos: [{
            "title": "Image:",
            "caption": "",
            "type": "image",
            "value": {
              "sourceURL": "http://gis.aoscloud.net/aosmaps/rest/services/Test/Test/FeatureServer/0/1025/attachments/1201",
              }
          }],
        });

        //create a feature layer based on the feature collection
        var featureLayer = new esri.layers.FeatureLayer("http://gis.aoscloud.net/aosmaps/rest/services/Test/Test/MapServer/0", {
          mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
          infoTemplate: popupTemplate,
          outFields: ["*"],
        });

Solution

  • The source url of the image and the url of a related link. Clicking on the image opens the linkUrl. It's optional.