I've found this ArcGIS API example which has been extremely helpful, but I can't seem to figure out how to format it to produce polygon geometry. I think that my main problem is formatting the polygon features to get the coordinates from my json file. This is the section of my code I believe is giving me a problem:
/**************************************************
* Create graphics with returned geojson data
**************************************************/
function createGraphics(response) {
// raw GeoJSON data
var geoJson = response.data;
// Create an array of Graphics from each GeoJSON feature
return arrayUtils.map(geoJson.features, function(features, i) {
return {
geometry: new Polygon({
"rings":[
[features.geometry.coordinates[0],
features.geometry.coordinates[1]],
[features.geometry.coordinates[0],
features.geometry.coordinates[1]],
[features.geometry.coordinates[0],
features.geometry.coordinates[1]],
[features.geometry.coordinates[0],
features.geometry.coordinates[1]],
[features.geometry.coordinates[0],
features.geometry.coordinates[1]],
]
}),
// select only the attributes you care about
attributes: {
ObjectId: i,
name: features.attributes.Name
}
};
});
}