|
POST
|
Muhammad, Do you get a graphic drawn on the screen when you do the initial search? The error you are getting is that it can not get the polygon geometry's first ring.
... View more
06-08-2010
07:02 AM
|
0
|
0
|
1174
|
|
POST
|
Stuart, OK I think I got it worked out for dynamic and static this time. <?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright © 2008 - 2009 ESRI
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions. See use restrictions in the file:
// <install location>/FlexViewer/License.txt
//
////////////////////////////////////////////////////////////////////////////////
-->
<BaseWidget xmlns ="com.esri.solutions.flexviewer.*"
xmlns:esri ="http://www.esri.com/2008/ags"
xmlns:mx ="http://www.adobe.com/2006/mxml"
xmlns:mxeffects ="com.adobe.ac.mxeffects.*"
xmlns:widgets ="com.esri.solutions.flexviewer.widgets.*"
x ="600"
y ="300"
widgetConfigLoaded ="init()">
<mx:Script>
<![CDATA[
import com.esri.ags.events.LayerEvent;
import mx.collections.ArrayCollection;
import com.esri.ags.utils.WebMercatorUtil;
import com.esri.ags.virtualearth.VETiledLayer;
import com.esri.ags.events.ExtentEvent;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.Graphic;
import com.esri.ags.layers.GraphicsLayer;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.layers.ArcGISTiledMapServiceLayer;
import com.esri.ags.symbol.SimpleFillSymbol;
import com.esri.ags.symbol.SimpleLineSymbol;
import com.esri.ags.Map;
import flash.events.MouseEvent;
import mx.controls.Alert;
import mx.graphics.ImageSnapshot;
private var overviewMode:String;
private var graphicLineSym:SimpleLineSymbol = new SimpleLineSymbol("solid", 0xFF0000, 0.8, 3);
private var graphicPolySym:SimpleFillSymbol = new SimpleFillSymbol(null, 0xFF0000, 0.01, graphicLineSym);
private var graphicsLayer:GraphicsLayer;
private var ovGraphic:Graphic;
private var xOff:Number;
private var yOff:Number;
private function init():void
{
if (configXML)
{
var type:String = configXML.mapservice.@type;
var url:String = configXML.mapservice;
var style:String = configXML.mapservice.@style;
var label:String = configXML.mapservice.@label;
overviewMode = configXML.mapservice.@mode;
switch (type.toLowerCase())
{
case "tiled":
{
var tiledlayer:ArcGISTiledMapServiceLayer = new ArcGISTiledMapServiceLayer(url);
tiledlayer.alpha = alpha;
if (overviewMode == "dynamic")
tiledlayer.addEventListener(LayerEvent.TILES_UPDATED,updateOvExtent);
ovMap.addLayer(tiledlayer);
break;
}
case "dynamic":
{
var dynlayer:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(url);
dynlayer.alpha = alpha;
if (overviewMode == "dynamic")
dynlayer.addEventListener(Event.COMPLETE,updateOvExtent);
ovMap.addLayer(dynlayer);
break;
}
case "virtualearth":
{
var veTiledLayer:VETiledLayer = new VETiledLayer();
veTiledLayer.id = label;
veTiledLayer.tokenURL = url;
veTiledLayer.environment = "production";
veTiledLayer.visible = true;
veTiledLayer.alpha = alpha;
veTiledLayer.mapStyle = style;
veTiledLayer.name = label;
ovMap.addLayer(veTiledLayer);
break;
}
}
graphicsLayer = new GraphicsLayer();
graphicsLayer.symbol = graphicPolySym;
ovMap.addLayer(graphicsLayer);
ovGraphic = new Graphic();
ovGraphic.geometry = map.extent;
ovGraphic.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ovGraphic.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
graphicsLayer.add(ovGraphic);
map.addEventListener(ExtentEvent.EXTENT_CHANGE, setOverviewExtent);
ovGraphic.addEventListener(Event.CHANGE,updateOvExtent);
updateOverviewExtent();
setTimeout(updateOverviewExtent, 4000);
}
}
private function setOverviewExtent(event:ExtentEvent):void
{
ovGraphic.geometry = map.extent;
if (overviewMode == "dynamic"){
ovMap.extent = map.extent.expand(3);
}
try{
var ac:ArrayCollection = new ArrayCollection([]);
var bmpDat:BitmapData = ImageSnapshot.captureBitmapData(ovMap);
ac.addItem(bmpDat);
addSharedData("ovMap",ac);
}
catch(err:Error){
}
AddOVMap();
}
private function updateOverviewExtent():void
{
ovGraphic.geometry = map.extent;
if (overviewMode == "dynamic"){
ovMap.extent = map.extent.expand(3);
}
try{
var ac:ArrayCollection = new ArrayCollection([]);
var bmpDat:BitmapData = ImageSnapshot.captureBitmapData(ovMap);
ac.addItem(bmpDat);
addSharedData("ovMap",ac);
}
catch(err:Error){
}
AddOVMap();
}
private function updateOvExtent(Evt:Event):void
{
callLater(AddOVMap,null);
}
private function AddOVMap():void
{
try{
var ac:ArrayCollection = new ArrayCollection([]);
var bmpDat:BitmapData = ImageSnapshot.captureBitmapData(ovMap);
ac.addItem(bmpDat);
addSharedData("ovMap",ac);
}
catch(err:Error){
}
}
private function mouseDownHandler(event:MouseEvent):void
{
var ext:Extent = ovGraphic.geometry as Extent;
var mPt:MapPoint = ovMap.toMapFromStage(event.stageX, event.stageY);
xOff = ext.center.x - mPt.x;
yOff = ext.center.y - mPt.y;
ovGraphic.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
private function mouseMoveHandler(event:MouseEvent):void
{
var mPt:MapPoint = ovMap.toMapFromStage(event.stageX, event.stageY);
var tempX:Number = mPt.x + xOff;
var tempY:Number = mPt.y + yOff;
var ext:Extent = ovGraphic.geometry as Extent;
var newext:Extent = new Extent(tempX - ext.width / 2, tempY - ext.height/ 2, tempX + ext.width / 2, tempY + ext.height / 2);
ovGraphic.geometry = newext;
if (!event.buttonDown)
ovGraphic.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
private function mouseUpHandler(event:MouseEvent):void
{
map.extent = ovGraphic.geometry as Extent;
ovGraphic.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
private function widgetOpenedHandler(event:Event):void
{
map.addEventListener(ExtentEvent.EXTENT_CHANGE, setOverviewExtent);
setTimeout(updateOverviewExtent, 1000);
}
private function widgetClosedHandler(event:Event):void
{
map.removeEventListener(ExtentEvent.EXTENT_CHANGE, setOverviewExtent);
}
private function widgetMinimizedHandler(event:Event):void
{
map.removeEventListener(ExtentEvent.EXTENT_CHANGE, setOverviewExtent);
}
]]>
</mx:Script>
<WidgetTemplate id="wTemplate" widgetClosed="widgetClosedHandler(event)" widgetOpened="widgetOpenedHandler(event)" widgetMinimized="widgetMinimizedHandler(event)">
<esri:Map id ="ovMap"
width ="100%"
height ="100%"
panArrowsVisible ="false"
zoomSliderVisible ="false"
logoVisible ="false"
scaleBarVisible ="false"
panEnabled ="false"
clickRecenterEnabled ="false"
doubleClickZoomEnabled ="false"
keyboardNavigationEnabled ="false"
rubberbandZoomEnabled ="false"
scrollWheelZoomEnabled ="false">
</esri:Map>
</WidgetTemplate>
</BaseWidget>
... View more
06-08-2010
06:35 AM
|
0
|
0
|
1122
|
|
POST
|
Jayme, From initial glace the first issue is <dropdown>African boxthorn, Prickly pear, Spear thistle, Aleppo pine</dropdown> Should be <dropdown>African boxthorn,Prickly pear,Spear thistle,Aleppo pine</dropdown> Notice no spaces between commas. I will keep digging if that is not it.
... View more
06-07-2010
08:30 AM
|
0
|
0
|
593
|
|
POST
|
Stuart, Is that not the exact same image that is in the overviewmapwidget? Because it should be exactly the same.
... View more
06-07-2010
08:16 AM
|
0
|
0
|
2033
|
|
POST
|
Mohamed, You really need to start doing some reading. Code snippets will do little good for a manager if you don't understand what is happening in the code. Start looking here http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/content/getting_started.htm and then read this about the crossdomain.xml http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/content/deploy_application.htm
... View more
06-07-2010
06:01 AM
|
0
|
0
|
973
|
|
POST
|
Stuart, Replace this code in the OverviewMapWidget.mxml private function setOverviewExtent(event:ExtentEvent):void
{
ovGraphic.geometry = map.extent;
if (overviewMode == "dynamic"){
ovMap.extent = map.extent.expand(3);
}
try{
var ac:ArrayCollection = new ArrayCollection([]);
var bmpDat:BitmapData = ImageSnapshot.captureBitmapData(ovMap);
ac.addItem(bmpDat);
addSharedData("ovMap",ac);
}
catch(err:Error){
}
}
private function updateOverviewExtent():void
{
ovGraphic.geometry = map.extent;
if (overviewMode == "dynamic"){
ovMap.extent = map.extent.expand(3);
}
try{
var ac:ArrayCollection = new ArrayCollection([]);
var bmpDat:BitmapData = ImageSnapshot.captureBitmapData(ovMap);
ac.addItem(bmpDat);
addSharedData("ovMap",ac);
}
catch(err:Error){
}
}
... View more
06-04-2010
04:03 PM
|
0
|
0
|
2033
|
|
POST
|
Mohamed, All you need to do to add your own data is go to your REST Services directory http://localhost/ArcGIS/rest/services/ and see a listing a map services that you have available and click on one and copy the url from the address bar and paste that into on of the samples. Here is one of ESRI's map services: http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer Here is an example of what one on your server would look like: http://localhost/ArcGIS/rest/services/mydata/MapServer So using the most simple sample from the link I provided you the code example would look something like this <?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:esri="http://www.esri.com/2008/ags"
pageTitle="Example - ArcGIS API for Flex connecting to a dynamic AGS service">
<esri:Map>
<esri:ArcGISDynamicMapServiceLayer
url="http://localhost/ArcGIS/rest/services/myData/MapServer"/>
</esri:Map>
</mx:Application>
... View more
06-04-2010
06:34 AM
|
0
|
0
|
973
|
|
POST
|
Stuart, You need to get the debugger version of flash player so you can put a break point in the code as I mention in the previous post. I don't have a clue what is wrong on your end as I just took the two files and added it to another SFV project and it ran perfectly again.
... View more
06-04-2010
05:38 AM
|
0
|
0
|
2033
|
|
POST
|
mei 09, So what is the design and workflow of your app that you would need to get all of the water catchments and their hydrological features at the same time?... This can be done using the GeometryService Relation method. You will have to run two queries on to return all the water catchments and then another to return all the hydrological features so that you can feed them into the GeometryService.Relation method. The results of the Relation will have values like "geometry1Index = 999 and geometry2Index = 0" which means that the geometry in the first array with the id of 999 meet the relation requirement that you specified in relation to the geometry in array 2 with the id of geometry2Index of 0.
... View more
06-04-2010
05:02 AM
|
0
|
0
|
1048
|
|
POST
|
Brad, So the best way to get the values for your initial and full extent is to go to your REST Services Directory Page at http://ngnv-jhqj6-a014/ArcGIS/rest/services and choose the map service that has your most preferred data extent and there you will see values listed for initial and full extent. The overview widget needs to be set to use one of your map services that is in UTM in it's OverviewMapWidget.xml file. The second option is to add the extent and spatial reference to the OverviewMapWidget.mxml manually as in this example <esri:Map id="map" units="{Units.FEET}">
<esri:extent>
<esri:Extent xmin="661140" ymin="-1420246" xmax="3015668" ymax="1594451">
<esri:SpatialReference wkid="26777"/> <!-- NAD_1927_StatePlane_Kansas_North_FIPS_1501 -->
</esri:Extent>
</esri:extent>
<esri:ArcGISDynamicMapServiceLayer url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/>
<esri:ArcGISDynamicMapServiceLayer url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer"/>
</esri:Map>
... View more
06-04-2010
04:59 AM
|
0
|
0
|
618
|
|
POST
|
jmuguy, Documentation is a little lacking in the explanation of this but the way I see it is yes Graphic1 is from the first graphic array the is within the second graphic array.
... View more
06-04-2010
04:18 AM
|
0
|
0
|
686
|
|
POST
|
francesco, Positioning of the scalebar and the zoom slide can be done through CSS but as you are just beginning and was not aware of this I doubt that this is your case. It would be best for you to post your flex code so we can see why yours are not in the default location.
... View more
06-04-2010
04:14 AM
|
0
|
0
|
426
|
|
POST
|
Mohamed, There are lots of samples here http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/index.html
... View more
06-04-2010
04:07 AM
|
0
|
0
|
973
|
|
POST
|
Stuart, Pan your map around and watch to see that the overview map is done redrawing and try exporting again.
... View more
06-03-2010
01:01 PM
|
0
|
0
|
2033
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-06-2020 05:32 AM | |
| 1 | 07-10-2018 05:49 AM | |
| 9 | 01-28-2022 10:58 AM | |
| 1 | 03-28-2022 06:20 AM | |
| 1 | 01-30-2019 07:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-01-2025
05:12 AM
|