Wednesday, September 5, 2007

How to reverse geocode a location ?


<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:map="com.esri.aws.awx.map.*"
xmlns:framework="com.esri.aws.osgi.framework.*"
xmlns:services="com.esri.aws.services.*"
xmlns:awx="com.esri.aws.awx.*"
implements="mx.rpc.IResponder"
initialize="initializeHandler()"
layout="absolute">
<mx:Script><![CDATA[
import mx.logging.targets.TraceTarget;
import mx.logging.Log;
import com.esri.aws.services.GeocodeCandidate;
import com.esri.aws.awx.map.handlers.ReverseGeocodeMouseHandler;
import com.esri.aws.services.FindActivator;
import com.esri.aws.services.GeocodeInfo;
import com.esri.awx.RevGeoMouseHandler;

private function initializeHandler() : void
{
map.mouseHandler = new ReverseGeocodeMouseHandler(this);
}

public function result(data:Object):void
{
var geocodeInfo:GeocodeInfo = data as GeocodeInfo;
for each ( var candidate : GeocodeCandidate in geocodeInfo.candidates)
{
trace( candidate.desc1 );
}
}

public function fault(info:Object):void
{
trace( info);
}
]]></mx:Script>
<framework:Framework apiKey="19640523">
<services:FindActivator/>
</framework:Framework>
<map:Map id="map" centerLon="-96.8577" centerLat="38.9762" scale="26000000"/>
</mx:Application>

No comments: