Hello me againI have another question about Dynamic and Featured layers.I have a base map which i want to load some info on it. For example i want to put on the base map a layer(dynamic) with some "population points filtered by country."When the user click a button seaching for a country, i just want to show the points in that country delimited country"Im using querys to get the points but i cant show them to the map.What im doing wrong?Thanks for ur help, i will let u know some part of the code:
private function doQuery():void
{
queryTask.execute(query, new AsyncResponder(onResult, onFault));
ciudad_luminaria=qText.text;
//Llamando a funcion cargar luminarias para cargar las luminarias del mapa que corresponden
this.cargarLuminarias();
function onResult(featureSet:FeatureSet, token:Object = null):void
{
if (featureSet.features.length == 1)
{
myMap.zoomTo(featureSet.features[0].geometry);
}
else if (featureSet.features.length > 1)
{
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
if (graphicsExtent)
{
myMap.extent = graphicsExtent;
}
}
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString(), "Query Problem");
}
}
public function cargarLuminarias():void
{
var queryTaskLuminaria:QueryTask = new QueryTask();
queryTaskLuminaria.showBusyCursor=true;
queryTaskLuminaria.url="the direction of the map server where the points are located.";
queryTaskLuminaria.useAMF=false;
var queryLum:Query = new Query();
queryLum.outSpatialReference= myMap.spatialReference;
queryLum.where="ARCGIS.DBO.Nodos_006.comuna='" + qText.text+"'";
queryLum.returnGeometry=true;
queryTaskLuminaria.execute(queryLum,new AsyncResponder(onResult,onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
if (featureSet.features.length == 1)
{
myMap.zoomTo(featureSet.features[0].geometry);
}
else if (featureSet.features.length > 1)
{
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
if (graphicsExtent)
{
myMap.extent = graphicsExtent;
}
}
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString(), "Query Problem");
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Symbol for Identify Result as Point -->
<esri:SimpleMarkerSymbol id="smsIdentify"
alpha="0.5"
color="0x00FFFF"
size="20"
style="circle"/>
<!-- Layer with Cities (LIMITE COMUNAL)-->
<esri:QueryTask id="queryTask"
showBusyCursor="true"
url="the mapserver for the located zone"
useAMF="false"/>
<esri:Query id="query"
outSpatialReference="{myMap.spatialReference}"
returnGeometry="true"
text="{qText.text}">
<esri:outFields>
<fx:String>nombre</fx:String>
</esri:outFields>
</esri:Query>
</fx:Declarations>
<!-- Mapa -->
<!-- Indica características del mapa -->
<esri:Map id="myMap">
<esri:extent>
<esri:Extent xmin="-7945607.002626869" ymin="-3881255.94806623" xmax="-7913541.669261281" ymax="-3863331.4649333805">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:GraphicsLayer id="myGraphicsLayer" graphicProvider="{queryTask.executeLastResult.features}"/>
</esri:Map>