|
POST
|
You're adding the map point in a geographic projection to a Web Mercator projection. You need to project its geometry to add it to the correct place protected function application1_creationCompleteHandler(event:FlexEvent):void { // this.startExtent = new Extent(-82.92, 33.68, -71.67, 40.93,new SpatialReference()); // this.mapWMS.map.initialExtent = this.startExtent; // this.mapWMS.map.zoomToInitialExtent(); var graphic1:Graphic = new Graphic(); var sr1:SpatialReference = new SpatialReference(3857); var mappoint1:MapPoint = new MapPoint(55.773261,37.545827,sr1); var mappoint2:Geometry = WebMercatorUtil.geographicToWebMercator(mappoint1); graphic1.geometry = mappoint2; myGraphicsLayer.add(graphic1); } And is this location for Moscow? If so, your lat/long is switched.
... View more
09-19-2012
07:31 AM
|
0
|
0
|
752
|
|
POST
|
You can use the IDataset.Type property to see what type of dataset it is. Here's an example that loops through each dataset in a file geodatabase and reports if it's a feature class, raster, or something else: Private Sub GeoDatabaseTest(ByVal path As String) Dim pWSF As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactory Dim pWS As ESRI.ArcGIS.Geodatabase.IWorkspace Dim pDataset As ESRI.ArcGIS.Geodatabase.IDataset Dim pEnumData As ESRI.ArcGIS.Geodatabase.IEnumDataset pWS = pWSF.OpenFromFile(path, 0) pEnumData = pWS.Datasets(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTAny) pDataset = pEnumData.Next While Not pDataset Is Nothing Select Case pDataset.Type Case ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTFeatureClass Debug.Print(pDataset.Name & ": Feature Class") Case ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTRasterDataset Debug.Print(pDataset.Name & ": Raster Class") Case Else Debug.Print(pDataset.Name & ": Other") End Select pDataset = pEnumData.Next End While End Sub
... View more
09-17-2012
07:55 AM
|
0
|
0
|
725
|
|
POST
|
You can make a minor revision to the example 3 code found in the Delete Field help. Where it adds the fields to be deleted, put in an additional if statement to check if field is not equal to "UGISID", "LBL_X", or "LBL_Y".
# For each field in the object list, add the field name to the
# name list. If the field is required, exclude it, to prevent errors
exclude = ["UGISID", "LBL_X", "LBL_Y"]
for field in fieldObjList:
if not field.required:
if not field.name in exclude:
fieldNameList.append(field.name)
... View more
09-14-2012
12:19 PM
|
0
|
0
|
5241
|
|
POST
|
Have you examined the geoprocessing results to see if you're getting any more error information? I tried the following code and it worked as expected.
Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor
Dim P2L As New ESRI.ArcGIS.DataManagementTools.PointsToLine
Try
P2L.Input_Features = "C:\Users\ken.buja\Documents\ArcGIS\Default.gdb\PointTest"
P2L.Output_Feature_Class = "C:\Users\ken.buja\Documents\ArcGIS\Default.gdb\P2LTest"
GP.Execute(P2L, Nothing)
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString)
End Try
... View more
09-12-2012
10:20 AM
|
0
|
0
|
610
|
|
POST
|
This is how I've done it in my VB.Net add-in project. I have a form with several options of different types of features that can be created. [ATTACH=CONFIG]17601[/ATTACH] I have a tool called DrawTool that contains the code for the OnMouseDown sub that captures the feature that is drawn.
Public Class DrawTool
Inherits ESRI.ArcGIS.Desktop.AddIns.Tool
'Public LineType As String
Private m_LineFeedback As ESRI.ArcGIS.Display.INewBezierCurveFeedback = Nothing
Private graphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer
Public Sub New()
End Sub
Protected Overrides Sub OnUpdate()
End Sub
Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs)
MyBase.OnMouseDown(arg)
'etc
This is the code for the buttons on my form.
Private Sub Draw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoint.Click, btnLocation.Click, btnPolygon.Click, btnFreehand.Click, btnRectangle.Click
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)
Select Case sender.name
Case "btnPoint"
'code to do some things for the Point tool
Case "btnLocation"
'code to do some things for the Location tool
'etc
End Select
m_application.CurrentTool = pCommandItem
... View more
09-11-2012
07:54 AM
|
0
|
0
|
2068
|
|
POST
|
The OnClick subroutine is not visible when you create your add-in, but it will be automatically populated when you type in Protected Overrides Sub OnClick() See the Help walkthrough on Building custom UI elements using add-ins
... View more
09-07-2012
01:40 PM
|
0
|
0
|
915
|
|
POST
|
I wish that some of the widgets of the Flex Viewer (Navigation Tool, Overview Map) were available for standard Flex applications. It's disappointing to see these components available in the Silverlight API but not Flex, as well as other components like a TOC that has the legend and transparency controls integrated.
... View more
09-05-2012
02:37 PM
|
0
|
0
|
1179
|
|
POST
|
It took me a while to understand how the mask worked, but the second example of the decimal degrees or degrees minutes seconds helped me figure it out. I assume you have other checks that would deal with minutes and seconds being between 0 and 59 that you did not publish, or did I miss something? You also designed this with multiple textboxes for the Degrees Minutes Seconds input. Do you have any idea how it would be written to work as a single Textbox. Say that the user set a checkbox to specify the format mask they were entering so that one Textbox could accept a variety of formats depending on user preference at the time of data entry and that internal code would convert it to match the format specifications of a database field. (I realize the check box could expose different sets of Textbox fields to handle and preparse each format, which would be a safer design, but I am trying to explore the limits of what a Textbox can do in this discussion thread). In my case, I was using a radio button to allow the user to enter positions by decimal degree or DMS by making one set of text boxes visible and the other invisible. You could do this by using something like
If chkInteger.Checked Then
Mask = "09--"
Else
Mask = "09--.."
End If
You'd have to incorporate validation in the checkbox in case the user selects that check box after typing in a value.
... View more
08-29-2012
11:12 AM
|
0
|
0
|
2043
|
|
POST
|
The problem with putting it into the TextChanged subroutine is that the user can put in invalid characters into the text box, whereas the KeyPress validation won't put those invalid characters there to begin with. Using the code from the MS example, you can still see something like this [ATTACH=CONFIG]17327[/ATTACH] It looks like the Masked Textbox requires more user interaction with decimal numbers, requiring them to position the cursor at the correct location to put in a number that has fewer numbers than the maximum number.
... View more
08-29-2012
07:03 AM
|
0
|
0
|
6049
|
|
POST
|
Here's a subroutine I found that I usually put in my text box KeyPress functions when I want to restrict what's being typed in. This doesn't account for hex values, but I doubt that the users would even know what they are.
Friend Function ValidateKey(ByVal Key As Integer, ByVal KeyMask As String) As Boolean
'I wrote this simple general-purpose key-validating function. You might find
'it useful. just call it like this in your keypress event:
' If Not ValidateKey(Asc(e.KeyChar), "mask") Then e.Handled = True
'"mask" contains pairs of characters. The function checks that your keypress
'falls between the ascii range of each pair. For instance if you want to
'allow only lowercase letters just use "az". If you want only numbers and
'decimal points use "09.." Include as many pairs as you like.
'PURPOSE: check that a keystroke was allowed by key mask. return true/false
'declare variable
Dim intCharCheck As Integer = 0
Try
'assume invalid
ValidateKey = False
Do Until intCharCheck = KeyMask.Length Or ValidateKey = True
'check if keypress falls between pair of characters in KeyMask
If Key >= Asc(KeyMask.Chars(intCharCheck)) And Key <= Asc(KeyMask.Chars(intCharCheck + 1)) Then ValidateKey = True
'advance to next pair in KeyMask
intCharCheck += 2
Loop
'allow backspace and Enter
If Key = System.Windows.Forms.Keys.Back Then ValidateKey = True
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Utilities: ValidateKey")
End Try
End Function
When using this with numbers, I have additional checks to make sure there's not more than one decimal place or negative sign, in addition. Here's an example for a group of textboxes that can be decimal degree or degree minutes seconds or just numbers.
Private Sub Numeric_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtLatD.KeyPress, txtLatM.KeyPress, txtLatS.KeyPress, txtLonD.KeyPress, txtLonM.KeyPress, txtLonS.KeyPress, txtLatDD.KeyPress, txtLonDD.KeyPress, txtDistance.KeyPress
Dim Mask As String
Select Case sender.name
Case "txtLatD", "txtLonD"
Mask = "09--"
Case "txtLatDD", "txtLonDD"
Mask = "09--.."
Case Else
Mask = "09.."
End Select
If Not ValidateKey(Asc(e.KeyChar), Mask) Then e.Handled = True
If Asc(e.KeyChar) = 46 Then 'test for existing decimal point
If InStr(sender.text, ".") > 0 Then e.Handled = True
End If
If Asc(e.KeyChar) = 45 Then 'test for exisiting negative sign
If InStr(sender.text, "-") > 0 Then e.Handled = True
If sender.selectionstart > 0 Then e.Handled = True 'Can't have a negative sign other than in the first position
End If
End Sub
... View more
08-29-2012
05:57 AM
|
0
|
0
|
6049
|
|
POST
|
I use an application called H3Viewer for looking at Visual Studios and ArcObjects documentation. It has an index that filters as you type, also.
... View more
08-29-2012
05:20 AM
|
0
|
0
|
876
|
|
POST
|
You've got the geometry of the point you clicked, so you can create a graphic from that and add it to the graphic layer var clickGraphic:Graphic = new Graphic(geometry, clickPointSymbol) graphicsLayer.add(clickGraphic); <fx:Declarations> <esri:SimpleMarkerSymbol id="clickPointSymbol" style="x" color="0xFF0000" size="12"/> </fx:Declarations>
... View more
08-24-2012
12:47 PM
|
0
|
0
|
742
|
|
POST
|
Is your tool trying to overwrite an existing dataset? If so, have you set the OverwriteOutput to true? In the geoprocessing tools I've written for VB.NET, I use ComReleaser as in this example.
Friend Function DeleteDataset(ByVal Input As Object) As Boolean
Dim DeleteDS As New ESRI.ArcGIS.DataManagementTools.Delete
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
Try
Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
releaser.ManageLifetime(DeleteDS)
DeleteDS.in_data = Input
Result = RunTool(DeleteDS, Nothing, False)
If Result Is Nothing Then Return False
Return True
End Using
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString & vbNewLine & ex.StackTrace.ToString, "Delete Dataset")
Return False
End Try
End Function
... View more
08-23-2012
06:00 AM
|
0
|
0
|
1722
|
|
POST
|
In my Add-in, I used the following code. I've serialized a dictionary in the OnSave sub
Protected Overrides Sub OnLoad(ByVal inStrm As System.IO.Stream)
'MyBase.OnLoad(inStrm)
Dim binaryFormatter = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()
Try
theDict = CType(binaryFormatter.Deserialize(inStrm), Dictionary(Of Object, Object))
If theDict.Count > 0 Then CreateRenderer()
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Extension: OnLoad")
End Try
End Sub
... View more
08-21-2012
10:43 AM
|
0
|
0
|
982
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Offline
|
| Date Last Visited |
3 weeks ago
|