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?

asked Dec 2, 2016 at 10:40
1
  • Does anyone know of any workarounds to this, please? Commented Dec 6, 2016 at 8:22

1 Answer 1

1

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}"
});
answered Dec 13, 2016 at 23:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.