|
POST
|
Excellent, thanks Derek. I'll look into the Print Task.
... View more
06-26-2012
10:51 AM
|
0
|
0
|
738
|
|
POST
|
One more question- I'd like to add an overview map to my map but in all of the samples using overview maps that I've seen, the overview map pans and zooms (albeit at the specification ratio compared to the main map). I don't want this behavior. Is it possible to "lock" the background of the overview map to a specified extent and have just the main map's map extent move around? I want my overview map to show the full extent of my county and just have the representation of the main map's map extent move around. Thanks! Steve
... View more
06-26-2012
09:11 AM
|
0
|
3
|
1527
|
|
POST
|
Is is possible to "print" without having a user initiate the process by clicking a button? From my review of the API documentation, it appears to me that it is required to have a dijit button on your web map to set up some of the printing parameters and then the click event of the button is what triggers the actual print event. I'm hoping I can trigger a print event in another fashion such as a when my page has been idle for a certain amount of time or perhaps loses focus. Under the current structure of the API, I don't think this is possible. These circumstances seem odd but I have a reason for doing it this way. Thanks! Steve
... View more
06-26-2012
09:04 AM
|
0
|
2
|
1143
|
|
POST
|
GENIUS! I feel so dumb. Thanks- that was the problem!
... View more
05-21-2012
12:55 PM
|
0
|
0
|
770
|
|
POST
|
I'm building a small app that has a basemap and one featureLayer that has an infoWindow associated with it. When the user clicks on one of those features, I also need to retrieve the coordinates of the feature that the user clicked on. My understanding is that you can use the OnClick event with dojo.connect to do this: dojo.connect(map,"onClick",function(evt){ var query = new esri.tasks.Query(); query.geometry = pointToExtent(map,evt.mapPoint,10); var deferred = theFeatureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint); alert('Made it here!'); var pt = new esri.geometry.Point(evt.mapPoint.y,evt.mapPoint.x, new esri.SpatialReference({wkid:3857})); var MercPt = esri.geometry.webMercatorToGeographic(evt.mapPoint); var theLong = MercPt.x; var theLat = MercPt.y; var didSucceed = window.clipboardData.setData('Text', '@Coord:' + theLong.toString() + ',' + theLat.toString() ); }); If a user clicks on the map where there isn't a feature, the OnClick event captures it and I'm able to access the click point's coordinates. If they click on a feature, it seems to bypass the OnClick code (hence my small alert line in the code above). What's the best way to capture the coordinates of a clicked feature?? Thanks! Steve
... View more
05-21-2012
12:34 PM
|
0
|
2
|
1203
|
|
POST
|
Thanks, Neil. You were correct in all of your points. Sometimes the ESRI Help Docs are more confusing than helpful and that OpenFromFile for FileGeodatabases was one of those times for me. While waiting for replies in my thread, I found another thread on an unrelated topic but it helped me debug my problem. Here's my revised code which I have tested and works: Public Sub addPhotoToGeoDatabase(ByVal theGTagInfo As geoTaggedInfo)
Try
Dim ptable As ITable
Dim dbPath As String = "G:\PublicWk\geoTagging\pwPhotoDatabaseTest.gdb"
' Create a file geodatabase workspace factory.
Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory")
Dim WorkspaceFactory As IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactory
Dim Workspace As IFeatureWorkspace = CType(WorkspaceFactory.OpenFromFile(dbPath, 0), IFeatureWorkspace)
' Cast the workspace to the IWorkspaceEdit2 interface.
Dim workspaceEdit As IWorkspaceEdit = CType(workspace, IWorkspaceEdit)
' Start an edit session. An undo/redo stack isn't necessary in this case.
workspaceEdit.StartEditing(False)
' Start an edit operation.
workspaceEdit.StartEditOperation()
ptable = workspace.OpenTable("tblGeotaggedPhotos")
' Create a row. The row's attribute values should be set here and if
' a feature is being created, the shape should be set as well.
Dim row As IRow = ptable.CreateRow()
row.Value(ptable.FindField("Latitude")) = theGTagInfo.latitude
row.Value(ptable.FindField("Longitude")) = theGTagInfo.longitude
row.Value(ptable.FindField("Descrip")) = theGTagInfo.description
row.Value(ptable.FindField("Keywords")) = theGTagInfo.keywords
row.Value(ptable.FindField("gTagByUser")) = theGTagInfo.taggedByUserName
row.Value(ptable.FindField("gTagByFullName")) = theGTagInfo.tageedByFullName
row.Value(ptable.FindField("gTagDate")) = theGTagInfo.dateTagged
row.Value(ptable.FindField("FileName")) = theGTagInfo.filename
row.Value(ptable.FindField("FullPath")) = theGTagInfo.fullpath
row.Store()
' Save the edit operation. To cancel an edit operation, the AbortEditOperation
' method can be used.
workspaceEdit.StopEditOperation()
' Stop the edit session. The saveEdits parameter indicates the edit session
' will be committed.
workspaceEdit.StopEditing(True)
Catch ex As Exception
globalErrorHandler(ex)
End Try
End Sub Thanks also for the tip about setting variables to NOTHING. I'm coming from a lengthy time in VBA (Access & Arcobjects) so that's almost second nature to me. Great to know I no longer need to do that! Steve
... View more
04-26-2012
02:05 PM
|
0
|
0
|
943
|
|
POST
|
I have a small subroutine in a VB.NET add-in I'm developing and it's sole purpose is to open a standalone table stored in a file geodatabase and add a new record to it. I searched through help and the forum to cobble together some similar code which compiles but errors once it's called. Here's the subroutine: Public Sub addPhotoToGeoDatabase(ByVal theGTagInfo As geoTaggedInfo) Try Dim ptable As ITable ' Create a file geodatabase workspace factory. Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory") Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory) ' Create a file geodatabase. Dim workspaceName As IWorkspaceName = workspaceFactory.OpenFromFile("G:\PublicWk\geoTagging\pwPhotoDatabaseTest.gdb", 0) ' Open the geodatabase using the name object. Dim Name As ESRI.ArcGIS.esriSystem.IName = CType(workspaceName, ESRI.ArcGIS.esriSystem.IName) Dim workspace As IWorkspace = CType(Name.Open(), IWorkspace) ' Cast the workspace to the IWorkspaceEdit2 interface. Dim workspaceEdit As IWorkspaceEdit = CType(workspace, IWorkspaceEdit) ' Start an edit session. An undo/redo stack isn't necessary in this case. workspaceEdit.StartEditing(False) ' Start an edit operation. workspaceEdit.StartEditOperation() ptable = workspace.OpenTable("tblGeotaggedPhotos") ' Create a row. The row's attribute values should be set here and if ' a feature is being created, the shape should be set as well. Dim row As IRow = ptable.CreateRow() row.Value("Latitude") = theGTagInfo.latitude row.Value("Longitude") = theGTagInfo.longitude row.Value("Descrip") = theGTagInfo.description row.Value("Keywords") = theGTagInfo.keywords row.Value("gTagByUser") = theGTagInfo.taggedByUserName row.Value("gTagByFullName") = theGTagInfo.tageedByFullName row.Value("DateGeotagged") = theGTagInfo.dateTagged row.Value("FileName") = theGTagInfo.filename row.Value("FullPath") = theGTagInfo.fullpath row.Store() ' Save the edit operation. To cancel an edit operation, the AbortEditOperation ' method can be used. workspaceEdit.StopEditOperation() ' Stop the edit session. The saveEdits parameter indicates the edit session ' will be committed. workspaceEdit.StopEditing(True) ptable = Nothing row = Nothing workspace = Nothing workspaceEdit = Nothing factoryType = Nothing workspaceFactory = Nothing Catch ex As Exception globalErrorHandler(ex) End Try End Sub and I have the following imported at the top of my module: Imports ESRI.ArcGIS.Geodatabase Imports ESRI.ArcGIS.Carto When the subroutine is called, it gets to the following line and crashes: Dim workspaceName As IWorkspaceName = workspaceFactory.OpenFromFile("G:\PublicWk\geoTagging\pwPhotoDatabaseTest.gdb", 0) The exact error returned is.. ERROR DESCRIPTION: Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Geodatabase.IWorkspaceName'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{FADD975C-E36F-11D1-AA81-00C04FA33A15}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). TYPE OF ERROR: System.InvalidCastException STACK TRACE: at geoTagPhotos2.usrFunctions.addPhotoToGeoDatabase(geoTaggedInfo theGTagInfo) in C:\Visual Studio 2008\Projects\geoTagPhotos2\geoTagPhotos2\usrFunctions.vb:line 407 So what am I doing wrong? I was using a code snippit for creating a file geodatabase and I noticed that in that example, there's an ampersand (@) before the file path. Didn't know what that was about and if I needed it while using the OpenFromFile method. Thanks! Steve
... View more
04-26-2012
12:13 PM
|
0
|
2
|
3681
|
|
POST
|
Has anyone migrated Bill Huber's Avenue script to VBA or Python?? I tried but couldn't get it to work (something about the LOG statment that tripped me up in ArcObjects). I've also tried converting it to python but I haven't had any success. I used to still have Arcview 3 w/ Spatial Analyst so I could still run the original script but now I no longer have that option. THANK YOU!! Steve
... View more
04-13-2012
08:40 AM
|
0
|
0
|
595
|
|
POST
|
I'm not exactly sure what you're asking. I think I only have the one (theForm). I'm still a bit green with VB.NET to answer authoritatively! The code snippit I had provided all comes from the same Sub procedure (OnMouseDown for my Add-in component). The full sub code would be this: Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs)
MyBase.OnMouseDown(arg)
Dim application As ESRI.ArcGIS.Framework.IApplication
Dim pMxDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
Dim pClone As ESRI.ArcGIS.esriSystem.IClone
Dim pGeometry As ESRI.ArcGIS.Geometry.IGeometry
Dim pSpatialRefFactory As ESRI.ArcGIS.Geometry.ISpatialReferenceFactory
Dim pSpatialRef As ESRI.ArcGIS.Geometry.ISpatialReference
Dim pGeographicCoordSys As ESRI.ArcGIS.Geometry.IGeographicCoordinateSystem
Dim pProjectedCoordSys As ESRI.ArcGIS.Geometry.IProjectedCoordinateSystem
Dim theForm As frmPhotoDlg
Dim theResults As String
Try
'Get the point where the user clicked
application = My.ArcMap.Application
Dim document As ESRI.ArcGIS.Framework.IDocument = application.Document
pMxDoc = CType(document, ESRI.ArcGIS.ArcMapUI.IMxDocument)
If pMxDoc.CurrentLocation.IsEmpty Then Exit Sub
'Clone the point because we don't want to alter
'the actual document's current location point
pClone = pMxDoc.CurrentLocation
pPoint = pClone.Clone
pGeometry = pPoint
'Create a new geographic coordinate system to use in the conversion
pSpatialRefFactory = New ESRI.ArcGIS.Geometry.SpatialReferenceEnvironment
pGeographicCoordSys = pSpatialRefFactory.CreateGeographicCoordinateSystem(ESRI.ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_NAD1983)
pSpatialRef = pGeographicCoordSys 'QI
pSpatialRef.SetFalseOriginAndUnits(-180, -90, 1000000)
pGeometry.Project(pSpatialRef)
Dim theDegrees As Double
Dim theMinutes As Double
Dim theSeconds As Double
Dim longDms As String
Dim latDms As String
Dim longDD As Double
Dim latDD As Double
longDD = Math.Abs(pPoint.X)
latDD = pPoint.Y
theDegrees = Int(longDD)
theMinutes = (longDD - theDegrees) * 60
theSeconds = Int((theMinutes - Int(theMinutes)) * 60)
longDms = theDegrees & "° " & Int(theMinutes) & "' " & theSeconds & Chr(34)
theDegrees = Int(latDD)
theMinutes = (latDD - theDegrees) * 60
theSeconds = Int((theMinutes - Int(theMinutes)) * 60)
latDms = theDegrees & "° " & Int(theMinutes) & "' " & theSeconds & Chr(34)
theResults = "DECIMAL DEGREES:" & vbNewLine & vbNewLine & vbTab & "Latitude: " & pPoint.Y & vbNewLine
theResults = theResults & vbTab & "Longitude: " & pPoint.X & vbNewLine & vbNewLine & "DEGREES/MINUTES/SECONDS:"
theResults = theResults & vbNewLine & vbNewLine & vbTab & "Latitude: " & latDms & vbNewLine & vbTab & "Longitude: " & longDms
'My.Computer.Clipboard.SetText(theResults)
theForm = System.Windows.Forms.Application.OpenForms(0)
theForm.txtLatitude.Text = pPoint.Y
theForm.txtLongitude.Text = pPoint.X
'MsgBox(theResults, vbInformation, "Geographic Results")
pSpatialRefFactory = Nothing
pGeographicCoordSys = Nothing
pProjectedCoordSys = Nothing
pSpatialRef = Nothing
pClone = Nothing
pPoint = Nothing
pGeometry = Nothing
pMxDoc = Nothing
application = Nothing
document = Nothing
Catch ex As Exception
globalErrorHandler(ex)
End Try
End Sub
... View more
03-27-2012
02:10 PM
|
0
|
0
|
1412
|
|
POST
|
Hi Leo, I don't know if it's supposed to or not, but I can tell you that it *IS* working! It might be a bit of trickery since the "tool" button on the form is really just a simple form button. As the first link suggests, the click event for the form button really just changes the active tool to my custom UITool. Inside the OnMouseDown event for the UITool, I get my coordinates and then transfer the values back to my form in this manner- Dim theForm As frmPhotoDlg 'My custom form's class name
theForm = System.Windows.Forms.Application.OpenForms(0)
theForm.txtLatitude.Text = pPoint.Y
theForm.txtLongitude.Text = pPoint.X
So far, it all works just fine. I should point out that for the time being, I'm not editing any data. I'm merely using Arcmap to draw our data and to extract the geolocation information. The Arcmap related portion of my current add-in is only about 5%. I may expand things to include writing records into a database table in the future. Not really sure which direction this tool will be heading. Here's also a screenshot of Arcmap plus the open form from my Add-in.. [ATTACH=CONFIG]13054[/ATTACH]
... View more
03-27-2012
01:49 PM
|
0
|
0
|
1412
|
|
POST
|
Think I'm on the right path. I hate it when I search the forum, find nothing, post a question, and THEN find something useful in a forum search! Anyways, Neil Clemmons provided a rough guide in this thread: http://forums.arcgis.com/threads/50996-Create-Point-on-screen-Trigger-mousedown-via-form?highlight=add+tool+form And this thread gives you the code to "activate" your add-in tool: http://forums.arcgis.com/threads/31897-Activate-Add-In-Tool?highlight=add+tool+form Be sure that your add-in has been compiled or the tool won't appear in the list returned by My.ThisAddIn.IDs. So far the tool activates and the mouse click on the map returns coordinates so I'm most of the way there!..
... View more
03-27-2012
12:32 PM
|
0
|
0
|
1412
|
|
POST
|
I have some experience already with add-ins, namely add-ins which are collections of very specific tools or buttons for use in Arcmap. For my current project, I'm developing an add-in which our staff can use to attribute and geotag JPEG photos taken while in the field. I have a windows form which has several text boxes for the user to input information. I have a UICommand in my add-in which displays the form and all that works great. What I want to add to do is add a button to that form which is used to click on the map, get x,y coordinates, and then populate them back into a textbox on the windows form. This is where I'm stuck and it seems to me like this is a gap in the documentation. How do I add a UITool to a windows form within my VB.NET project? Does the tool have to be already developed (or compiled) or can I have it in my current project? I'd really like to keep it as a windows form instead of a dockable window since I'm using the form to display JPEGs in a sort of slideshow presentation. Funny thing is, I thought the EXIF updating would be the hardest part but I've now got that working. I just need this tiny bit! As I eluded to, I'm using Visual Studio Express 2008 VB.NET as my development environment and version10 for ArcGIS. Thanks! Steve
... View more
03-27-2012
11:24 AM
|
0
|
6
|
3826
|
|
POST
|
I'd like to display a numeric scale value while using a ArcGISDynamicMapServiceLayer but the only code examples I've been able to find so far relate to using an ArcGISTiledMapServiceLayer in which the LOD has a scale property. Can this be done with ArcGISDynamicMapServiceLayers and does anyone have an example they can share? Thanks! Steve
... View more
11-21-2011
11:58 AM
|
0
|
2
|
971
|
|
POST
|
Well I would have never thought to do this so thanks for the tip. The CLSID you provided does work but it displays the entire context menu, not the individual Properties command on it. I searched the Registry as you suggested and finally found the CLSID: {92D490B7-DF9D-11D1-8779-0000F8751720} Tried it out and it works. Thanks again! Steve
... View more
09-27-2011
09:05 AM
|
0
|
0
|
855
|
|
POST
|
This doesn't seem to be in the list of ProgIDs in the SDK help. I need to add the "Properties" command into an add-in I'm developing. In Arcmap, it's found on the context menu when you right-click on a selected graphic element. Anyone know the ProgID or the CLSID for it? Thanks! Steve
... View more
09-27-2011
07:10 AM
|
0
|
5
|
2372
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Thursday | |
| 2 | 4 weeks ago | |
| 1 | 09-11-2025 10:18 AM | |
| 1 | 09-11-2025 08:03 AM | |
| 1 | 08-13-2025 09:16 AM |