Hi,
I am using the old sample flexviewer with the new api 2.0 and am having a problem with the geometry service. I am trying to reproject a point and since I need to send graphics.geometry to the new geometryservice instead of the graphics I am not able to get the attributes from the graphics. I was wondering if anyone has done this before if if anyone has an idea of what to do. In my event.result I only receive a mappoint but cannot seem to get the attributes from the graphic. Is there another way to get the attributes or possibly reproject the point after the data is received.
Thanks
Stephen
Here is my code for the reporject of the points:
private function projectAddressCanid(data:Array):void
{
var coordGraphic:Graphic;
var graphics:Array = [];
for each (var addrCandidate:AddressCandidate in data)
{
if (addrCandidate.score >= minscore)
{
var icon:String = widgetIcon;
var title:String = addrCandidate.address.toString();
if (!title)
title = widgetTitle;
var content:String = "Score: " +addrCandidate.score.toString();
var link:String = "";
var point:MapPoint = addrCandidate.location;
point.spatialReference = new SpatialReference(26917);
var infoData:Object =
{
icon: icon,
title: title,
content: content,
link: link
};
coordGraphic = new Graphic(point, smsPoint,infoData);
graphics.push(coordGraphic.geometry);
}
}
var outSR:SpatialReference = map.spatialReference;
geometryServiceAddress.project(graphics, outSR);
}
private function projectAddressCompleteHandler(event:GeometryServiceEvent):void
{
var recAC:ArrayCollection = new ArrayCollection();
for each (var g:Graphics in event.result)
{
var point:MapPoint = g.geometry as MapPoint;
var icon:String = g.attributes.icon;
var title:String = g.attributes.title;
var content:String = g.attributes.content;
var link:String = g.attributes.link;
var infoData:Object =
{
icon: icon,
title: title,
content: content,
link: link,
point: point,
geometry: point
};
recAC.addItem(infoData);
}
wRepeater.dataProvider = recAC;
this.addSharedData(widgetTitle, recAC);
showMessage(locationsLabel + " " + recAC.length.toString(), false);
if (recAC.length > 0)
{
showLocation(recAC.getItemAt(0));
}
}