Does esri.arcgis.utils.createMap support feature layers?

619
2
Jump to solution
12-03-2012 03:53 PM
StephenLead
Regular Contributor III
The Create Web Map sample shows how to build an application using esri.arcgis.utils.createMap

1) Does this method support feature layers?

2) If so, what is the required JSON definition for a feature layer, including specifying its infoWindow?

3) Are there any samples showing utils.createMap with a feature layer?

Thanks,
Steve
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Frequent Contributor
Before answering your questions, I want to point out that the main use case for createMap is to create an ArcGIS API for JavaScript map from an ArcGIS.com webmap ID. Ideally, you use ArcGIS.com to author your web map (add layers, configure pop-ups, set the extent, etc.) and then use the webmap in your app by passing in the ArcGIS.com item id to createMap.

The approach you're talking about also valid, but it's more work for the developer. To answer your specific questions:

  1. Yes, feature layers are supported as operational layers and are stored in the webmap JSON as a feautreColleciton. For instance, here's a webmap with US Cities loaded from a zipped shapefile. The cities are displayed as as feature layer and stored in the webmap JSON as a feature collection.

  2. We haven't officially published the spec for the webmap, but it's coming. You can take a look at the JSON that comes back from a webmap request to see the structure for how a feature collection is stored as a operational layer. The popupInfo property of the layer definition defines what to display in a popup:  http://www.arcgis.com/sharing/content/items/a7fc556a1b5f470f9ea611d7424847f5/data?f=json&callback=do...

  3. We do not publish a sample showing how to use createMap with JSON that includes feature layers from a feature collection. You can take the Create Webmap by ID sample, drop in an ID to a webmap with a feature layer and createMap will give you an ArcGIS API for JavaScript map with a feature layer.

View solution in original post

0 Kudos
2 Replies
derekswingley1
Frequent Contributor
Before answering your questions, I want to point out that the main use case for createMap is to create an ArcGIS API for JavaScript map from an ArcGIS.com webmap ID. Ideally, you use ArcGIS.com to author your web map (add layers, configure pop-ups, set the extent, etc.) and then use the webmap in your app by passing in the ArcGIS.com item id to createMap.

The approach you're talking about also valid, but it's more work for the developer. To answer your specific questions:

  1. Yes, feature layers are supported as operational layers and are stored in the webmap JSON as a feautreColleciton. For instance, here's a webmap with US Cities loaded from a zipped shapefile. The cities are displayed as as feature layer and stored in the webmap JSON as a feature collection.

  2. We haven't officially published the spec for the webmap, but it's coming. You can take a look at the JSON that comes back from a webmap request to see the structure for how a feature collection is stored as a operational layer. The popupInfo property of the layer definition defines what to display in a popup:  http://www.arcgis.com/sharing/content/items/a7fc556a1b5f470f9ea611d7424847f5/data?f=json&callback=do...

  3. We do not publish a sample showing how to use createMap with JSON that includes feature layers from a feature collection. You can take the Create Webmap by ID sample, drop in an ID to a webmap with a feature layer and createMap will give you an ArcGIS API for JavaScript map with a feature layer.

0 Kudos
StephenLead
Regular Contributor III
Hi Derek,

Thanks very much for the info, which is very helpful.

the main use case for createMap is to create an ArcGIS API for JavaScript map from an ArcGIS.com webmap ID. Ideally, you use ArcGIS.com to author your web map (add layers, configure pop-ups, set the extent, etc.) and then use the webmap in your app by passing in the ArcGIS.com item id to createMap.


I'm trying to ensure that my applications are as compatible as possible with ArcGIS.com for a bit of future-proofing, and to potentially allow ArcGIS.com to be used as a configurator.

Cheers,
Steve
0 Kudos