1

I'm using the ArcGIS Map API "Historic_National_Boundaries_NEW (FeatureServer) > Year_2000" present over here :

API Link

It has two pre-defined fields 'OBJECTID' and 'NAME_2' (for each country) which are displayed onclick of a country in map. I'm using PopupTemplate() object to create the popup.

//on-click popup functionality starts
        var popupOptions = {
        markerSymbol: new SimpleMarkerSymbol("circle", 32, null,
          new Color([0, 0, 0, 0.25])),
        marginLeft: "20",
        marginTop: "20"
      };
       var popup = new Popup(popupOptions, domConstruct.create("div"));
        var popupTemplate = new PopupTemplate({
        title: "{NAME_2}",
        fieldInfos: [
          {
            fieldName: "NAME_2",
            visible: true,
            label: "Country: ",

          },
          {
            fieldName: "OBJECTID",
            visible: true,
            label: "ID: ",

          }

        ],
        showAttachments: true
      });

Country Popup

I need to know if these fields can be customized or new fields can be added. I checked through the documentation but was not able to find any info. It mentioned adding fields, media elements and plain text but not external content or any method to manipulate the fields.

If fields cannot be manipulated, how can I display custom content (possibly fetched from JSON/XML file) in the popup for each country?

  • Does anyone know of any workarounds to this, please? – cakerusk Dec 6 '16 at 8:22
0

in order to add new fields, you'd need to publish a service of your own. this can be accomplished either using our web based tools or desktop software.

http://doc.arcgis.com/en/arcgis-online/share-maps/add-items.htm

an alternative option would be to write your own clientside logic to manipulate the attributes of individual features from the existing service using your own JSON.

http://jsbin.com/bibalu/edit?html,output

featureLayer.on("graphic-add", function (e) {
  e.graphic.attributes.FOO = 'bar';
})

new PopupTemplate({
  title: "Custom",
  description: "Foo: {FOO}"
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.