|
POST
|
It works in Chrome 13 and IE 8 but not in Firefox 5. Basically, you need to interact with the map first by zooming or panning before the onclick returns something. I had this problem in Flex and got around it by adding in an alert box in the initialization. Closing the alert box provided the map interaction necessary to allow the map click to work without panning or zooming.
... View more
08-09-2011
10:47 AM
|
0
|
0
|
1356
|
|
POST
|
To add in the url, try this code by Robert Scheitlin. Here's how I use it in one of my applications.
... View more
08-09-2011
07:39 AM
|
0
|
0
|
464
|
|
POST
|
Hi Carlos, I'm glad to hear you're making progress. Since you don't have the code to show why the Clip process didn't run, examine the Results information in ArcMap to find out what happened. Could it be that it's not overwriting "in_memory\APP_ENS_OVERLAP"? Have you set the Geoprocessor to overwrite outputs, either through the Geoprocessing Options dialog or by setting pGeoprocessor.OverwriteOutput = "true"
... View more
08-09-2011
07:18 AM
|
0
|
0
|
1417
|
|
POST
|
My code makes calls to functions containing the geoprocessing tools. I've declared the geoprocessor Global.GP in another module and initialized it elsewhere
pDissolvedFClass = DissolveDataset(pResourceFClass, DissolveFieldName, StatisticsFieldName & " " & Stat, "in_memory\DissolvedResource")
Friend Function DissolveDataset(ByVal InputName As Object, ByVal DissolveField As String, ByVal StatsFields As String, ByVal OutputName As String) As ESRI.ArcGIS.Geodatabase.IFeatureClass
Dim DissolveDS As New ESRI.ArcGIS.DataManagementTools.Dissolve
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
releaser.ManageLifetime(DissolveDS)
DissolveDS.in_features = InputName
DissolveDS.dissolve_field = DissolveField
DissolveDS.statistics_fields = StatsFields
DissolveDS.out_feature_class = OutputName
Result = RunTool(DissolveDS, Nothing)
If Result Is Nothing Then
System.Windows.Forms.MessageBox.Show("Could not dissolve dataset")
Return Nothing
End If
Return ReturnObjectfromResult(Result, "Feature Class")
End Using
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Dissolve error")
Return Nothing
End Try
End Function
Friend Function ReturnObjectfromResult(ByVal result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Type As String) As Object
Dim GPVal As ESRI.ArcGIS.Geodatabase.IGPValue
Dim InMemFC As String
Dim GPUtil As ESRI.ArcGIS.Geoprocessing.IGPUtilities3 = New ESRI.ArcGIS.Geoprocessing.GPUtilities
Try
GPVal = result.GetOutput(0)
InMemFC = GPVal.GetAsText()
Select Case Type
Case "Feature Class"
Return GPUtil.OpenFeatureClassFromString(InMemFC)
Case "Table"
Return GPUtil.OpenTableFromString(InMemFC)
End Select
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Return FeatureClass error")
Return Nothing
End Try
End Function
Private Sub ReturnMessages(ByVal pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Title As String)
Dim ErrorMessage As String
If pResult.MessageCount > 0 Then
For Count As Integer = 0 To pResult.MessageCount - 1
ErrorMessage += pResult.GetMessage(Count)
Next
End If
System.Windows.Forms.MessageBox.Show(ErrorMessage, Title)
End Sub
Friend Function RunTool(ByVal Process As ESRI.ArcGIS.Geoprocessor.IGPProcess, ByVal TC As ESRI.ArcGIS.esriSystem.ITrackCancel2) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Result = CType(Globals.GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
If Result.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then ReturnMessages(Result, "Geoprocessing Error")
Globals.GP.ClearMessages()
Catch ex As Exception
ReturnMessages(Result, "Fail")
System.Windows.Forms.MessageBox.Show(ex.ToString, "Run Geoprocessor")
End Try
Return Result
End Function
... View more
08-04-2011
11:50 AM
|
0
|
0
|
1417
|
|
POST
|
I haven't tried using the IMemoryWorkSpaceFactory, but I have been able to use a geoprocessor process parameter like "in_memory\output"
... View more
08-04-2011
11:22 AM
|
0
|
0
|
1417
|
|
POST
|
The button bar uses a zero based index, so your code show be like this (if Avatud Maakaart refers to OpenStreetMap)
<esri:ArcGISTiledMapServiceLayer show="layerShowHandler(event)"
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
visible="{bb.selectedIndex == 1}"/>
<esri:OpenStreetMapLayer show="layerShowHandler(event)"
visible="{bb.selectedIndex == 0}"/>
... View more
08-03-2011
06:30 AM
|
0
|
0
|
314
|
|
POST
|
This is the way I've set up an application (not in the SFV framework) to read in a configuration file. The application is a framework where I'm showing the data for several different projects and the XML contains all the parameters for each project, including map service and query URLs. I pass in a parameter in the main URL for the specific project: http://ccma.nos.noaa.gov/explorer/biomapper/biomapper.html?id=JobosBay http://ccma.nos.noaa.gov/explorer/biomapper/biomapper.html?id=StJohn This is the code for the Flex application to read in the XML file
private var xmlParameters:XML;
private var xmlProjectParameters:XMLList;
private function init():void
{
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE,init_onComplete);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR,fail);
xmlLoader.load(new URLRequest("parameters.xml"));
}
private function fail(event:Event)
{
Alert.show("Fail");
}
private function init_onComplete(event:Event):void
{
var params:Object;
try
{
var loader:URLLoader = URLLoader(event.target);
xmlParameters = new XML(loader.data);
params = getURLParameters();
if (params["id"])
{
input = params.id
}
else
{
Alert.show("Parameter search failed");
return;
}
xmlProjectParameters = xmlParameters.project.(@urlinput==input);
var bm:IBrowserManager = BrowserManager.getInstance();
bm.init();
bm.setTitle(xmlProjectParameters.@id + " BIOMapper");
serverName = xmlProjectParameters.service;
projectTitle = xmlProjectParameters.projectname.@name;
if (!(xmlProjectParameters.datalayers.dive==undefined))
{
diveQueryTask.url = serverName + xmlProjectParameters.datalayers.dive.@url + "/MapServer/" + xmlProjectParameters.datalayers.dive.@layer;
etc...
}
private function getURLParameters():Object
{
var result:URLVariables = new URLVariables();
try
{
if (ExternalInterface.available)
{
var search:String = ExternalInterface.call("location.search.substring", 1);
if (search && search.length > 0)
{
result.decode(search);
}
}
}
catch (error:Error)
{
Alert.show(error.toString());
}
return result;
}
And this is the code for the XML file
<?xml version="1.0" encoding="utf-8"?>
<projects>
<project id="Jobos Bay" urlinput="JobosBay">
<projectname name ="Jobos Bay, PR" pdftitle="Jobos Bay, PR: Shallow-water Benthic Habitats" url="http://ccma.nos.noaa.gov/ecosystems/coralreef/ceap/"/>
<service>http://egisws02.nos.noaa.gov/ArcGIS/rest/services/biomapper/Jobos_</service>
<datalayers>
<dive layer="0" url="Dynamic" site_id="Site_ID" videoname="Site_ID" assessment="Assessment" photocount="PhotoCount" symbol="Symbol" legendurl="http://ccma.nos.noaa.gov/explorer/biomapper/jobosbay/images/Dives.png" legendheight="53">
</dive>
</datalayers>
etc
</project>
<project id="St. John" urlinput="StJohn">
<projectname name="St. John, U.S. Virgin Islands" pdftitle="U.S. Virgin Islands (St. John): Shallow- and Moderate-Depth Benthic Habitats" url="http://ccma.nos.noaa.gov/ecosystems/coralreef/benthic/"/>
<service>http://egisws02.nos.noaa.gov/ArcGIS/rest/services/biomapper/StJ_</service>
<datalayers>
<dive layer="13" url="all" site_id="SITE_ID" videoname="VIDEONAME" assessment="ASSESSMENT" photocount="PHOTOCOUNT" symbol="SYMBOL" legendurl="http://ccma.nos.noaa.gov/explorer/biomapper/stjohn/images/Dives.png" legendheight="103">
</dive>
etc.
</project>
</projects>
... View more
07-26-2011
06:15 AM
|
0
|
0
|
689
|
|
POST
|
Take a look at this blog about measuring distances in Web Mercator
... View more
07-20-2011
01:27 PM
|
0
|
0
|
2661
|
|
POST
|
Here's an example of what I have for an add-in that uses a button on a form to start drawing on the map. the tool is named DrawTool
Dim pUID As New ESRI.ArcGIS.esriSystem.UID
Dim pCommandItem As ESRI.ArcGIS.Framework.ICommandItem
pUID.Value = My.ThisAddIn.IDs.DrawTool
pCommandItem = m_application.Document.CommandBars.Find(pUID, False, False)
m_application.CurrentTool = pCommandItem
... View more
07-13-2011
01:31 PM
|
0
|
0
|
2376
|
|
POST
|
You don't need to make a call to a geometry service if you are projecting lat/long to or from Web Mercator. The WebMercatorUtil class does this for you. Here's another version of Shuping's code
<?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="World Street Map" xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.SpatialReference;
import com.esri.ags.events.GeometryServiceEvent;
import com.esri.ags.events.MapEvent;
import com.esri.ags.geometry.Geometry;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.symbols.SimpleMarkerSymbol;
import com.esri.ags.utils.WebMercatorUtil;
import mx.controls.Alert;
protected function map1_loadHandler(event:MapEvent):void
{
//project the lat and long values from 4326 to 102100
var myPoint:MapPoint = new MapPoint(-122, 73, new SpatialReference(4326));
// geometryService.project([myPoint as Geometry], new SpatialReference(102100),null);
var myGraphic:Graphic = new Graphic(WebMercatorUtil.geographicToWebMercator(myPoint), new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_DIAMOND, 22, 0x009933));
myGraphicsLayer.add(myGraphic);
map.centerAt(myGraphic.geometry as MapPoint);
}
// protected function geometryService_projectCompleteHandler(event:GeometryServiceEvent):void
// {
// var pt:MapPoint = (event.result as Array)[0]as MapPoint;
// var myGraphic:Graphic = new Graphic(pt, new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_DIAMOND, 22, 0x009933));
// myGraphicsLayer.add(myGraphic);
// map.centerAt(pt);
// }
]]>
</fx:Script>
<fx:Declarations>
<esri:GeometryService id="geometryService"
projectComplete="geometryService_projectCompleteHandler(event)"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>
</fx:Declarations>
<esri:Map id ="map" load="map1_loadHandler(event)">
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
<esri:GraphicsLayer id="myGraphicsLayer"></esri:GraphicsLayer>
</esri:Map>
</s:Application>
... View more
07-06-2011
12:42 PM
|
0
|
0
|
1458
|
|
POST
|
Hi Jerry, Here are the files I'm using with my application.
... View more
07-05-2011
10:51 AM
|
0
|
0
|
980
|
|
POST
|
Here's another way to do it
IGPUtilities2 gpUtils = new GPUtilitiesClass();
IFeatureClass inFeature1 = gpUtils.OpenFeatureClassFromString(@" ");//path of the 1st Input Feature Class
IFeatureClass inFeature2 = gpUtils.OpenFeatureClassFromString(@" ");//path of the 2nd Input Feature Class
IFeatureClass inFeature3 = gpUtils.OpenFeatureClassFromString(@" ");//path of the 3rd Input Feature Class
Test(inFeature1, inFeature2, inFeature3);
private void Test(IFeatureClass pf1,IFeatureClass pf2,IFeatureClass pf3)
{
try
{
ESRI.ArcGIS.Geoprocessor.Geoprocessor GP = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
GP.OverwriteOutput = true;
IGPUtilities2 gpUtils = new GPUtilitiesClass();
IGpValueTableObject vt = new GpValueTableObjectClass();
vt.SetColumns(2);
object weight;
weight = 1 as object;
object obj1 = pf1;
vt.AddRow(ref obj1);
vt.SetValue(0, 1, ref weight);
object obj2 = pf2;
vt.AddRow(ref obj2);
vt.SetValue(1, 1, ref weight);
object obj3 = pf3;
vt.AddRow(ref obj3);
vt.SetValue(2, 1, ref weight);
ESRI.ArcGIS.AnalysisTools.Intersect intersect = new ESRI.ArcGIS.AnalysisTools.Intersect();
intersect.in_features = vt;
intersect.out_feature_class = @"D:\Neil'sData\Output\New1.shp";//Specify The Output path
GP.Execute(intersect, null);
MessageBox.Show("Intersection is Successfull!!!!!!");
}
catch (Exception e1)
{
MessageBox.Show("error!!!!");
}
}
... View more
06-24-2011
07:15 AM
|
0
|
0
|
1654
|
|
POST
|
In my application, I've taken the results of the Identify and pushed it into an array, then set the DataGrid's dataProvider to that array. This is part of a larger code for an application that takes the IdentifyResults from all the visible layers and puts the results from each layer into a separate tab in an InfoWindow.
identifyTask.execute(identifyParams, new AsyncResponder(resultFunction, faultFunction, clickGraphic));
function resultFunction(results:Array, clickGraphic:Graphic):void
{
if (results && results.length > 0)
{
var resultsArray:Array = [];
var newDG:DataGrid = new DataGrid;
resultsArray.push(result.feature.attributes);
newDG = new DataGrid;
newDG.dataProvider = resultsArray;
}
}
In reading your post, I was seeing DataGrid instead of DataGroup. However, the dataProvider expects an IList, which could be an ArrayCollection, ArrayList, and XMLListCollection, so you should add your graphic to an array.
... View more
06-23-2011
08:08 AM
|
0
|
0
|
469
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | yesterday | |
| 1 | yesterday | |
| 1 | 12-18-2025 10:17 AM | |
| 2 | 12-17-2025 11:04 AM | |
| 1 | 11-18-2025 12:30 PM |
| Online Status |
Offline
|
| Date Last Visited |
13 hours ago
|