# Tag Info

18

Snapping points to a line using ArcGIS geoprocessing tools Assumptions: You have a point layer and a line layer. You want a points to be snapped to the line layer. Instructions 1. Use the Near tool to find snap locations In ArcGIS's Toolbox pane, Select Analysis Tools -> Proximity -> Near Choose your point layer as Input features, your line layer as ...

13

Try something like this: dim f2 if [field1] = "foo" then f2 = "bar" end if Screen shot of this being used in the field calculator.

13

There are many ways to weight distances for constructing Thiessen polygons. The basic idea in constructing them is based on comparing the distance between an arbitrary point x and two fixed points p and q; you need to decide whether x is "closer" to p than to q or not. To this end--at least conceptually--we consider the distances dp = d(x, p) and dq= d(x, ...

13

A perhaps-too-simple approach would be to use Focal Statistics. Define the neighborhood of interest as an annulus, with inner radius just under 720m and outer radius just over 720m. (This depends somewhat on cell size. For example, 5m cells would have an annulus of 717.5 - 722.5; this might be too large a window for a 1m cell raster, though.) Use ...

11

Kirk Kuykendall's recommendation to construct a spherical Voronoi diagram (Thiessen polygons) is a good one, but might have some technical hitches to work out. In the meantime, as an alternative, one can apply the standard raster solution as described in another thread. Use spherical distances instead of Euclidean distances. Here is an example using five ...

10

the Q was about single use, but I might as well round out things out by providing the answer for concurrent licensing use as well so everything is in one place (I don't think it warrants a separate question). Prepwork: Contact your customer support representative, by email, and requestVBA extension authorization (it's free, and no I don't know why you ...

10

Have you checked the ESRI Technical Certification website? Under each level (e.g. Desktop 10.1) they provide a PDF with a thorough list of resources including training courses, web lessons and books from ESRI Press.

9

I don't know how to do this with Field Calculator, but I do know a workaround. Run Summary Statistics in ArcToolbox with COUNT on the [name] field. This will create another table where each unique [name] entry will have next to it the number of times it appears in the original layer. Then Join this table back to your original layer, with the [name] ...

9

What you want is a weighted Voronoi diagram: http://en.wikipedia.org/wiki/Weighted_Voronoi_diagram also know as a circular Dirichlet tessellation when done with multiplicative weights in a 2d plane. Someone seems to have built an arcgis 9 extension to build these: http://arcscripts.esri.com/details.asp?dbid=15481 With a user guide available here http://...

8

I've never tried this but it seems like this would work: Create a 3D voronoi diagram of the sphere. This resulting polygons will be roughly centered on the original existing (seed) points. Loop through each resulting vertex to find the one that is farthest from its closest existing point. This point should be the most remote point on the globe.

8

If you know row, column, cellsize and extent, X & Y can easily be calculated. Note this assumes a North up raster. If the raster is rotated you'll need to know the other two affine transformation coefficients (or geotransform in GDAL speak). Also note that the column/row coordinates in the below are from (0.0,0.0) at the upper left corner of the upper ...

6

One important distinction between VBScript and VBA is that VBScript does not support ArcObjects because the ArcObjects classes do not implement IDispatch. See the "IDispatch interface" section of Introduction to COM in the VBA SDK help for more info. Another is that VBScript does not allow or require the Dim'ing of variables of a specific data type (all ...

5

Once you have the Polygon, QI to IPointCollection. You can then iterate over all the points in this PointCollection which are the vertices that you need. Here is some code which shows how to get the selected features & then get the geometry: I am writing this from memory, so it might not be exactly correct, but should give you an idea Dim ...

5

Try calling Store. pFeature.value(pFeature.Fields.FindField("Type")) = "update" pFeature.Store() Set pFeature = pEnumFeature.Next Are you in an edit session? Scroll down to best practices: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/00010000010s000000.htm

5

A while back, I wrote some VB code to persist and de-persist renderers in ArcObjects. It's a slightly different spin on your question but I think what you need is there. The code can be found at: http://arcscripts.esri.com/details.asp?dbid=12474 I hope this helps. Bill

5

ArcGIS 9.3.x: In the ArcGIS interface, use the snapping environment within the Editing toolbar. Programmatically, you can find a number of snapping-based Visual Basic examples at the ESRI resources page (note: personally, I like to use the old page. I think it's easier to find stuff. VB resources). See for instance, VB code to "bulk snap": "The Bulk Snap ...

5

This is one of the most common errors in ArcGIS/VBA environment, and is usually due to missing references. Go to Tools --> references and check for any MISSING ones. Most likely your missing references to Crystal components. Tick them on and re-try. http://support.esri.com/en/knowledgebase/techarticles/detail/29069

5

Cast the geometry bag to an IGeometry first, then try setting its SpatialReference property. The behavior you describe is weird, though, since IGeometryBag descends directly from IGeometry. Are you sure you are trying to set the spatial reference on the correct interface?

5

As @ujjwalesri pointed out, you need a reference to the toolbox. Here is an example that works for me: Dim gp_msg As String = "" Dim pGp As ESRI.ArcGIS.Geoprocessing.IGeoProcessor Dim pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult Dim pParamArray As ESRI.ArcGIS.esriSystem.IVariantArray Dim minZ As Double Dim MaxZ As Double Dim TinPath As String ...

5

it is much easier now in 10. Right click on the length field and select calculate geometry. you can select the pcs of the data or the document, then select the units.

5

There are a few concepts that I see you are missing. I will try to explain them. 1- The first one has to do with spatial filter usage. You should pass a filter when you are using it, otherwise, just pass nothing. You have this code: Dim pSpatialFilter As ISpatialFilter Set pSpatialFilter = New SpatialFilter Dim pBlockBoundaryCursor As IFeatureCursor Set ...

5

You could just use the ArcMap Command, Zoom To Selected Features. Dim pUID As New UID Dim pCmdItem As ICommandItem ' Use the GUID of the Save command ' Zoom to all selected features pUID.Value = "{AB073B49-DE5E-11D1-AA80-00C04FA37860}" ' or you can use the ProgID ' pUID.Value = "esriArcMapUI.ZoomToSelectedCommand" pUID.SubType = 3 Set ...

4

If you don't have access to poke around in the registry (happens to me often) a poor-mans method would be to look for the system environment variable ARCHOME. If that's there, check under that for the existence of the executable file ARCHOME\bin\arc.exe (or, on Unix, \$ARCHOME\bin\arc.exe). Because the default "Program Files" folder contains spaces, you are ...

4

If you want to move the values in the 'acct id' into the 'taxid' Field, it should be as simple as: [acct_id] (The field names cannot have a space, so I do not think that 'acct id' is the field name, it should be the field Alias) If on the other hand, you want to concatinate the strings from both 'acct id' & 'taxid' into a third field, it can be: [...

4

4

Use a static variable to keep track of the incremental value (assuming you're using ArcGIS) in thei field calculator (toggle on the 'advanced' tab) Static cnt As Integer Dim startValue as Integer Dim result as Integer startValue = 192 cnt = cnt + 1 result = cnt + startValue then, whateveryourfieldnameis="Pipe-" & result I think that should work

4

The double click is unfortunately not tied to a command, but is handled internally by the TOC contents view which displays a dialog with all property pages applicable to the active selected item. The same is done when selecting Properties.. in the context menu. There is no double click event readily available which you could subscribe to and stop its ...

4

This code will run existing tools or models that your create: Private Sub opentool_Click() 'Ensure that there are references set to the 'ESRI GeoprocessingUI Object Library and the 'ESRI Geoprocessing Object Library. 'Go to Tools > References to do this Dim pUID As New UID pUID = "esriGeoprocessingUI.ArcToolboxExtension" Dim pATBExt As ...

4

OK so my co-worker helped me figure this out... Turns out I hadn't declared an envelope for my featureIndex, which in turn, left my indexQuery empty. Underneath: Dim pNhdIndexQuery As IIndexQuery2 I added the following lines of code: Dim pEnvelope As IEnvelope Set pEnvelope = New Envelope pNhdFeatureIndex.Index Nothing, pEnvelope This ...

Only top voted, non community-wiki answers of a minimum length are eligible