|
POST
|
This should work
Dim pGxDialog As IGxDialog
Set pGxDialog = New GxDialog
pGxDialog.Title = "Select Catchments Feature Class"
pGxDialog.ButtonCaption = "Select"
pGxDialog.AllowMultiSelect = False
pGxDialog.StartingLocation = "Catalog"
Dim pGxFilter As IGxObjectFilter
Set pGxFilter = New GxFilterPolygonFeatureClasses
Set pGxDialog.ObjectFilter = pGxFilter
Dim pLayerFiles As IEnumGxObject
pGxDialog.DoModalOpen 0, pLayerFiles
Dim pLayerFile As IGxObject
Set pLayerFile = pLayerFiles.Next
Dim pFLayer As IFeatureLayer
Set pFLayer = New FeatureLayer
Set pFLayer.FeatureClass = pLayerFile.InternalObjectName.Open
Dim pFields As IFields
Set pFields = pFLayer.FeatureClass.Fields
Dim i As Integer
For i = 0 To pFields.FieldCount - 1
ComboBox1.AddItem pFields.Field(i).Name
Next
... View more
10-21-2010
08:12 AM
|
0
|
0
|
939
|
|
POST
|
Is there any way the Flex API and Viewer for Flex forums could be listed closer together? There are a lot of Viewer related posts in the general forum, probably due to the fact that the Viewer forum is buried in the list of forums, whereas the API forum is at the top of a column. Related to this, can the moderators be more vigilant about moving posts into the correct forum?
... View more
10-13-2010
07:51 AM
|
0
|
0
|
1600
|
|
POST
|
You have to separate the text parts of the query from the values derived from the controls. Try this for your whereclause string qfilter.WhereClause = "Plot_No = " & textBox1.Text & " AND Layer = '" & Convert.ToString( comboBox1.SelectedItem) & "'";
... View more
10-07-2010
05:51 AM
|
0
|
0
|
400
|
|
POST
|
I've taken the Identify Features sample and modified it so that it only shows some of the attributes of the feature that's selected.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
pageTitle="Identify Features on the Map">
<!--
This sample shows how to identify features with a MapClick and the Identify task.
The IdentifyParameters designate which layers are being identified.
Identify operations can potentially return a lot of information
depending on the number of layers being identified and a given tolerance.
The tolerance is the number of pixels a feature is allowed to lie away
from the clicked point in order to be counted as a result.
In this sample, when user clicks the map, an "Identify" task is executed.
When the task finishes executing, the executeCompleteHandler function loops
through the features in the IdentifyResult and adds them to the map.
-->
<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.events.MapMouseEvent;
import com.esri.ags.geometry.Geometry;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.symbols.InfoSymbol;
import com.esri.ags.tasks.supportClasses.IdentifyParameters;
import com.esri.ags.tasks.supportClasses.IdentifyResult;
import mx.controls.Alert;
import mx.rpc.AsyncResponder;
import spark.components.TextArea;
[Bindable]private var lastIdentifyResultGraphic:Graphic;
private function mapClickHandler(event:MapMouseEvent):void
{
clickGraphicsLayer.clear();
var identifyParams:IdentifyParameters = new IdentifyParameters();
identifyParams.returnGeometry = true;
identifyParams.tolerance = 3;
identifyParams.width = myMap.width;
identifyParams.height = myMap.height;
identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = myMap.extent;
identifyParams.spatialReference = myMap.spatialReference;
var clickGraphic:Graphic = new Graphic(event.mapPoint, clickPtSym);
clickGraphicsLayer.add(clickGraphic);
identifyTask.execute(identifyParams, new AsyncResponder(myResultFunction, myFaultFunction, clickGraphic));
}
private function myResultFunction(results:Array, clickGraphic:Graphic = null):void
{
if (results && results.length > 0)
{
var result:IdentifyResult = results[0];
var resultGraphic:Graphic = result.feature;
var textArea:TextArea = new TextArea();
var infoWindowText:String;
var mapPoint:MapPoint = MapPoint(clickGraphic.geometry);
var point:Point = myMap.toScreen(mapPoint);
var label:String;
switch (resultGraphic.geometry.type)
{
case Geometry.MAPPOINT:
{
label = "City Layer"
infoWindowText = "City: " + resultGraphic.attributes.CITY_NAME + "\nState: " + resultGraphic.attributes.STATE_NAME;
resultGraphic.symbol = smsIdentify;
break;
}
case Geometry.POLYLINE:
{
label = "River Layer"
infoWindowText = resultGraphic.attributes.NAME;
resultGraphic.symbol = slsIdentify;
break;
}
case Geometry.POLYGON:
{
label = "State Layer"
infoWindowText = resultGraphic.attributes.STATE_NAME;
resultGraphic.symbol = sfsIdentify;
break;
}
}
lastIdentifyResultGraphic = resultGraphic;
// update clickGraphic (from mouse click to returned feature)
// clickGraphic.symbol = new InfoSymbol(); // use default renderer
// clickGraphic.attributes = resultGraphic.attributes;
textArea.text = infoWindowText;
myMap.infoWindow.content = textArea;
myMap.infoWindow.label = label;
myMap.infoWindow.show(myMap.toMap(point));
}
}
private function myFaultFunction(error:Object, clickGraphic:Graphic = null):void
{
Alert.show(String(error), "Identify Error");
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Symbol for where the user clicked -->
<esri:SimpleMarkerSymbol id="clickPtSym"
color="0xFF0000"
size="12"
style="x"/>
<!-- Symbol for Identify Result as Polyline -->
<esri:SimpleLineSymbol id="slsIdentify"
width="2"
alpha="1"
color="0x00FF00"
style="solid"/>
<!-- Symbol for Identify Result as Point -->
<esri:SimpleMarkerSymbol id="smsIdentify"
color="0x00FF00"
size="15"
style="diamond"/>
<!-- Symbol for Identify Result as Polygon -->
<esri:SimpleFillSymbol id="sfsIdentify"/>
<!-- Identify Task -->
<esri:IdentifyTask id="identifyTask"
concurrency="last"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer"/>
</fx:Declarations>
<esri:Map id="myMap"
mapClick="mapClickHandler(event)"
openHandCursorVisible="false">
<esri:extent>
<esri:WebMercatorExtent minlon="-120" minlat="30" maxlon="-100" maxlat="50"/>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:GraphicsLayer graphicProvider="{lastIdentifyResultGraphic}"/>
<esri:GraphicsLayer id="clickGraphicsLayer"/>
</esri:Map>
</s:Application>
... View more
10-05-2010
12:23 PM
|
0
|
0
|
1129
|
|
POST
|
Use the content method of the InfoWindow to put other things in there. Take a look at this sample
... View more
10-05-2010
09:06 AM
|
0
|
0
|
1129
|
|
POST
|
Ah...thanks for pointing that out. I didn't take note of the inheritance.
... View more
10-05-2010
05:09 AM
|
0
|
0
|
616
|
|
POST
|
It's too bad that now there's the extra step of creating a polygon when determining whether the extent of several unioned extents is contained within another extent.
... View more
10-04-2010
12:39 PM
|
0
|
0
|
616
|
|
POST
|
Hi Dan, I was able to replicate your problem, but then I changed the size of the BorderContainer to 550x500 and it acted normally. I even put in another input box to make the graphic even thinner and taller and it didn't make a difference.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.events.MapMouseEvent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.geometry.Polygon;
import com.esri.ags.utils.GraphicUtil;
import com.esri.ags.geometry.Extent;
import mx.controls.Alert;
import mx.collections.ArrayCollection;
protected function Map_mapClickHandler(event:MapMouseEvent):void
{
//allow user to enter size of poly desired
if(tInput1.text == ""){
Alert.show("Please enter a number in the text input before clicking the map.");
}else{
var size:int = Number(tInput1.text);
var halfSize:Number = size/2;
var center:MapPoint=Map.toMapFromStage(event.stageX, event.stageY);
var botLeft:MapPoint = new MapPoint;
//new mapPoint is assigned the same coor sys as the map
botLeft.spatialReference=Map.spatialReference;
//units defined by the spatial reference
botLeft.x=center.x-halfSize;
botLeft.y=center.y-halfSize*Number(tInput2.text);
var botRight:MapPoint = new MapPoint;
botRight.spatialReference=Map.spatialReference;
botRight.x=center.x+halfSize;
botRight.y=center.y-halfSize*Number(tInput2.text);
var topRight:MapPoint = new MapPoint;
topRight.spatialReference=Map.spatialReference;
topRight.x=center.x+halfSize;
topRight.y=center.y+halfSize*Number(tInput2.text);
var topLeft:MapPoint = new MapPoint;
topLeft.spatialReference=Map.spatialReference;
topLeft.x=center.x-halfSize;
topLeft.y=center.y+halfSize*Number(tInput2.text);
var newPolygon:Polygon = new Polygon;
newPolygon.spatialReference=Map.spatialReference;
newPolygon.rings=[[botLeft, botRight, topRight, topLeft, botLeft]];
var newGraphic:Graphic = new Graphic;
newGraphic.geometry=newPolygon;
newGraphic.symbol=symbol1;
gLayer.add(newGraphic);
zoomToGraphics();
}
}
private function zoomToGraphics():void
{
var graphicProvider:ArrayCollection = ArrayCollection(gLayer.graphicProvider);
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(graphicProvider.toArray());
//graphicsExtent.spatialReference = Map.spatialReference;
Map.extent = graphicsExtent;
Alert.show("Map height: " + Map.extent.height + "\n gE height: " + graphicsExtent.height + "\n " +
"\n Map width: " + Map.extent.width + "\n gE width: " + graphicsExtent.width);
}
protected function clearGraphics_clickHandler(event:MouseEvent):void
{
gLayer.clear();
}
]]>
</fx:Script>
<fx:Declarations>
<esri:SimpleFillSymbol id="symbol1"
style="solid"
color="0xFF0000"
alpha="0.3">
<esri:outline>
<esri:SimpleLineSymbol style="solid" color="0x000000" width="1" />
</esri:outline>
</esri:SimpleFillSymbol>
</fx:Declarations>
<s:BorderContainer id="mainBC"
width="550" height="500"
borderVisible="true"
borderAlpha="1" borderColor="#FF0000"
borderStyle="solid" borderWeight="3">
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle" paddingTop="5"/>
</s:layout>
<s:Label text="Click the map to add a graphic" fontSize="15"/>
<esri:Map id="Map" logoVisible="false" mapClick="Map_mapClickHandler(event)">
<esri:ArcGISTiledMapServiceLayer id="mapSvc" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:GraphicsLayer id="gLayer"/>
</esri:Map>
<s:TextInput id="tInput1" text="10000"/>
<s:TextInput id="tInput2" text = "20"/>
<s:Button id="clearGraphics" label="Clear Graphics" click="clearGraphics_clickHandler(event)"/>
</s:BorderContainer>
</s:Application>
... View more
10-04-2010
11:35 AM
|
0
|
0
|
657
|
|
POST
|
This method was in the 1.3 version of the API but isn't showing up in the 2.x version. Is there a reason it was dropped?
... View more
10-04-2010
11:33 AM
|
0
|
4
|
1110
|
|
POST
|
Here are two ways of looking at it. If you want to add the attribute for LAND_AC6 only when none of the other fields have any attributes, then use this.
Function FindLabel ( [LTSA_LOT] , [LTSA_BLOCK] , [LTSA_PA4] , [LTSA_PLAN] , [LAND_AC6] )
if ( Len ([LTSA_LOT]) <> 0) then
str = [LTSA_LOT] & " - "
end if
if ( Len ( [LTSA_BLOCK] ) <> 0) then
str = str + [LTSA_BLOCK] & " - "
end if
if ( Len ( [LTSA_PA4] ) <> 0) then
str = str + [LTSA_PA4] & " - "
end if
if ( Len( [LTSA_PLAN] ) <> 0) then
str = str + [LTSA_PLAN]
end if
if ( Len( [LAND_AC6] ) <> 0) then
str1 = [LAND_AC6]
end if
if (Len(str) > 0) then
FindLabel = str
else
FindLabel = str1
end if
End Function
If you want to add the attribute for LAND_AC6 if one or more of the other fields don't have any attributes, then this should work
Function FindLabel ( [LTSA_LOT] , [LTSA_BLOCK] , [LTSA_PA4] , [LTSA_PLAN] , [LAND_AC6] )
dim found
found = True
if ( Len ([LTSA_LOT]) <> 0) then
str = [LTSA_LOT] & " - "
else
found = False
end if
if ( Len ( [LTSA_BLOCK] ) <> 0) then
str = str + [LTSA_BLOCK] & " - "
else
found = False
end if
if ( Len ( [LTSA_PA4] ) <> 0) then
str = str + [LTSA_PA4] & " - "
else
found = False
end if
if ( Len( [LTSA_PLAN] ) <> 0) then
str = str + [LTSA_PLAN]
else
found = False
end if
if ( Len( [LAND_AC6] ) <> 0) then
str1 = [LAND_AC6]
end if
if found then
FindLabel = str
else
FindLabel = str & vbNewLine & str1
end if
End Function
... View more
09-29-2010
12:30 PM
|
0
|
0
|
1203
|
|
POST
|
I'm not using it in the Flex Viewer, but this is the projection information that's in my code for a Web Mercator service.
private var layerGraticule:SimpleGraticuleLayer = new SimpleGraticuleLayer;
layerGraticule.projection = new Mercator(new Ellipsoid(6378137,0,""),0,0,0,0, LinearUnit.METER);
... View more
09-21-2010
10:33 AM
|
0
|
0
|
286
|
|
POST
|
Try refreshing the activeview after adding the layer:
Call AddLayerFromFile(pMap, "G:\Deepak\map_mumbai_final.jpg.lyr")
pMxDoc.UpdateContents
pMxDoc.ActiveView.Refresh
... View more
09-17-2010
09:29 AM
|
0
|
0
|
1082
|
|
POST
|
Did you ever set the zoomFeature array to a new Array? Either private var zoomFeatures:Array = new Array; or zoomFeatures = new Array();
... View more
09-08-2010
06:52 AM
|
0
|
0
|
396
|
|
POST
|
Take a look at Mansour's blog for clustering by attributes
... View more
09-01-2010
09:32 AM
|
0
|
0
|
1009
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 4 weeks ago | |
| 2 | 4 weeks ago | |
| 1 | 11-18-2025 12:30 PM | |
| 2 | 11-18-2025 06:53 AM | |
| 1 | 11-17-2025 06:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|