# Tag Info

12

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 statistics ...

6

QGIS can take a --code that you can pass a Python file to in order to run. qgis --code my myfile.py Run this command from the VBA shell command.

5

If done in Python: Expression parameter: getSinuosity(!shape!) Codeblock parameter: import math def getSinuosity(shape): length = shape.length d = math.sqrt((shape.firstPoint.X - shape.lastPoint.X) ** 2 + (shape.firstPoint.Y - shape.lastPoint.Y) ** 2) return d / length Make sure to use an expression type of PYTHON_9.3. ...

4

You missed an underscore in the esri__measure variable in your first 2 if clauses, so they always tested as equal to 0 and fullfilled the condition of the first clause (an uninitialized variable esri_measure will equal 0 while esri__measure is not 0). So in reality no measures were being tested in any of your clauses, just a bad variable that was always 0. ...

4

Are the longitude and latitude values in separate fields? Because the Convert_Decimal function requires a single value. After trying this myself, I think you were trying to convert the DMS values to DD in-place. That is, in the same column. Instead, use the script in a new column, referring to the one you want to convert. See image below where I have a DMS ...

4

I believe the code you have: Set pFeature.Value(3) = 2 needs to be pFeature.Value(3) = 2 The reason is that the value it is storing is a number and not an object. If you are planning to run this in a loop, consider using an IFeatureBuffer with an insert cursor, I believe these are faster. Below is some example code from an old project of mine. ...

4

This is generally not something that should be done using the Field Calculator (although by using a cursor you can do it, it is better to create a standalone Python script). The easiest approach is simply to run summary statistics on the column, join the column to the summary output, and calculate the summary count values over to the count field in the ...

4

VBA is still available in 10.x, but must be installed separately. Prior to 10.x, it was included with installation files. Now, however, you must install separately and receive a license for the VBA extension (it's free, but you must request it from ESRI). Aside from VBA, there are other ways to create custom UI elements, including .NET and python addins. ...

3

Your code won't work. You loop the cursor until it finishes. At that point pFeature is Nothing. After that you try to access the OID value of pFeature, which is Nothing. If you only select a single building or only want the first building OID of any selection set don't loop the cursor, just get rid of the cursor loop. Then you should make sure you got ...

3

As long as a tool is simple input-output python-toolboxes are great, but creating your own gui elements is not supported, drawing line is kinda possible using featureSet, but not in a user friendly way. For more complex tools I would use the dotnet-Addin on the ArcObjects SDK, it supports both C# and VB.net: http://resources.arcgis.com/en/help/arcobjects-...

3

You will want to run this as a standalone application. The reference for this can be found in the appropritate pyqgis cookbook section. You need to run setup code at the beginning and cleanup code at the end. # ... # [ Your imports here ] # ... # supply path to where is your qgis installed QgsApplication.setPrefixPath("/path/to/qgis/installation", True) #...

3

Extending on Chad's answer, following does the trick for feature layer with multiple legend groups for (int k = 0; k <= (featureLayer as ILegendInfo).LegendGroupCount - 1; k++) { (featureLayer as ILegendInfo).get_LegendGroup(k).Visible = false; }

3

Installing arcgis did not install visual basic properly. Manually installing VBA solved the problem.

3

If there are any instances of special characters (& and <) in [LOCA_ID], the formatting will fail. You have to replace them dynamically with code like this: Function FindLabel ([LABELFIELD]) NewString = Replace([LABELFIELD],"&","&amp;") FindLabel = "<ITA>" & NewString & "</ITA>" End Function Replace "&" with "&...

2

You need to access the active document in order to get access to layers. Create a reference to the document using your IMxApplication object (pMxApp): Dim pMxDoc as IMxDocument = pMxApp.Document Then access layers through focusmap: Dim pLayer as ILayer = pMxDoc.FocusMap.Layer(i) Where "i" is the index of your layer.

2

Actually, since you know all your measures always end in +00, because that applies to all intervals of 500, you can simplify the expression to: esri__measure / 100 & "+00" You only need the more complex expression in my earlier post when your hatch intervals divided by 100 are not integer values. That would apply if the last measure was shown whether ...

2

I was able to find the same answer that @mkennedy wrote as a comment by using Google to search on "arcgis 10.2 vba". The first result was a page entitled Installing ArcGIS for Desktop VBA Compatibility: At ArcGIS 10.2.1 and 10.2.2, the VBA runtime is installed by the setup.exe of the ArcGIS VBA Compatibility setup program. Previous to ArcGIS 10, ...

2

Thanks to Daniel from geonet, the problem has been solved. As far as referencing ValidFacet is concerned, the app needed to be changed from 'void' to 'bool'. Daniel also corrected various problems with ValidFacet so that it is now: public static bool ValidFacet(string facetStr) { IMxDocument pMxDoc = ArcMap.Document; IMap pMap = ...

2

This is substantially the work of Radar in an answer to a similar question, using the same ArcObjects as Hornbydd does. I have modified Radar's function for my clients to select a delimited text file then this function returns both the path to the selected file and the file name. This fulfills Alex's request for "...return the PATH of the document to a ...

2

Installation of VBA manually will solve the problem. The VBA can be manually installed from the Installed Directory which Usually is C Drive > Program Files (for 32 bit windows) and Program Files (X86) (For 64 bit installation) > ArcGIS > Support > VBA i.e. either C:/Program Files/ArcGIS/Support/VBA/1033/ or C:/Program Files (X86)/ArcGIS/Support/...

2

I don't believe arcpy exposes such properties. You need to be able to drill down into the VBProject and then VBComponents to check if a code module exists. It's been many years since I have mooched around at that level of the object model. Below is some incomplete .NET VB code but I never quite got it working... Hopefully gives you an idea or someone reading ...

2

It is how you are dealing with Null values. You are treating Null as a string when it is NOTHING! How can nothing be something? But now think about what you are asking, in your case if colour is not green, yellow or red then it can only be a Null value. So you don't need to test if it is Null as you have already checked all other options. So your VB ...

2

It looks like the Excel sheet expects input lat/lon to be in OSGB36, while you are feeding it WGS84. (I just tested the numbers using pyproj, and got the same results as you). I strongly recommend reading the "Guide to coordinate systems in Great Britain" linked from the same place as the Excel sheet, if you haven't already done so. (It is a great ...

1

If I have understood you correctly you want to store the text "Polygon" in your array? Shape is the Geometry field so the mismatch error is to be expected, you are trying to store a polygon geometry in a string variable which makes no sense. As a FeatureClass can only be one type of Geometry I would simple write the text straight into your polygon as that ...

1

You can use the ITopologicalOperator's Union method to programmatically merge two polygons together. This example (written in VB.NET) shows how that's done. Dim pFirstGeometry As IGeometry = CType(pFirstFeature.shape, IGeometry) Dim pTopoOperator As ITopologicalOperator = CType(pFirstGeometry, ITopologicalOperator) Dim pSecondGeom As IGeometry = CType(...

1

pcolor shouldn't be an IColorSymbol (which doesn't have Color as a property) it should be an IColor (I prefer IRgbColor cast to IColor when needed) as ILineSymbol.Color is an IColor object. I suspect though that the problem is that pcolor isn't intialized: Dim pcolor As IRgbColor set pcolor = New RgbColorClass() pcolor.Red = 255 ' make it red ' then later ...

1

I believe the Interface ITableSort does not actually sort the table, it returns lists or cursors of sorted data, which is subtly different. This has been discussed as far back as 2007 as shown in these ESRI forum threads: http://forums.esri.com/Thread.asp?c=93&f=993&t=212789 http://forums.esri.com/Thread.asp?c=93&f=988&t=238000 One ...

1

I think SDE_OBJECT_ID might be data type LONG. Have you tried pFeature.OID.ToString(), or whatever the conversion method in VBA is? Not sure if it might fix the issue. Just an idea.

1

You can definitely achieve this with arcobjects in any of the .net languages. Your question at this point is very broad. Most of the technical aspects you will find many examples of when performing a internet search such as; how to create ArcGIS add-in button, how to connect to database table, how to populate a data grid based on sql SELECT query, ...

1

I published Excel to Google Earth KML converter using VBA Macro in the following link with explanatory notes also. [http://mksugumaran.blogspot.com/2013/09/excel-to-google-earth-kml.html][1] http://mksugumaran.blogspot.com/2013/09/excel-to-google-earth-kml.html The Actual Macro code is given below: Sub EXPORTKMLMARK() Dim DATA(10000, 25) sh2 = ActiveWindow....

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