Hot answers tagged

25

Keep in mind that Arcpy is essentially a wrapper around ArcObjects. But if you're just trying to call some Python scripts that you don't want to have to rewrite you can spawn a process that calls the python executable with your args. var startInfo = new ProcessStartInfo() { CreateNoWindow = false, UseShellExecute = false, FileName = ...


24

The answer to this question is yes and no. It is possible with some effort to do everything in Python that you could do in .Net, but easy and possible are two very different things. Following that, the simplest interpretation is no, Python Add-Ins cannot do as much as .Net Add-Ins. However, the tasks Python Add-Ins can accomplish are much easier and faster ...


13

Short answer: In my experience, there should be absolutely no problem developing .NET 3.5-based code for ArcGIS 9.3 in Visual Studio 2010 (with C# language version 4), as long as you explicitly target the .NET Framework 3.5. The C# language version is mostly irrelevant here. P.S.: This answer does not go into the differences that exist between developing ...


12

If you are using Arcpy scripting, data lock issues have become even more problematic with 10.1. If the locks are being created by your code, then you aren't cleaning up after yourself. Release all references to feature classes, workspaces, cursors, etc. The locks are removed when you have no more references to the objects being locked. Well, that is the ...


12

I have investigated this and while it might be possible at some level by writing wrappers in C++ using them in .NET it is a hell of a lot of work because you also have to wrap the Qt framework at the same time. There might be hacks that you could use to get it to work but they will always be hacks. My advice: Learn Qt C++ or/and PyQt Python. Qt makes life ...


10

In ArcObjects, like other COM-based libraries, interface testing is the main way you determine the type (using that term loosely) of object you have: if (element is ITextElement): // Do something else if (element is IMarkerElement): // Do something else etc. Another thing you can do is, if the object implements IPersist, you can get its CLSID using ...


9

When creating a new project using an ArcGIS template, you have to make sure you target the .NET Framework 3.5 instead of 4, which comes up by default


9

Take a look at PostGIS and Entity Framework. The main library for connecting .NET to PostgreSQL is Npgsql, which can be used with (e.g.) SharpMap, NetTopologySuite, GdalOgrInCsharp, etc., depending on what you are doing. Regarding geometry data types, Npgsql uses System.Byte[] in C# to represent WKB (Well-Known Binary). This byte array type can be selected ...


9

You can use the GDAL C#/.Net bindings to do this.


9

libLAS can indeed be used commercially. So can Martin Isenburg's LASlib, which is LGPL, and speaking as the author of libLAS, faster and more completely supported than libLAS. Both are indeed C++ libraries, however, and there isn't too much in the ASPRS LAS space for native .NET. I'm also the primary author of PDAL, and PDAL can also read ASPRS LAS data, ...


9

I feel your pain. I went through the same sort of thing with NetTopologySuite (v1.13) and had some success looking at the unit tests. First off, you might check out the DotSpatial library which was referenced in a similar question specific to DS shapefile operations I am personally happy with the NTS library. Once you figure out the object model it's not ...


9

It looks like I found your holy grail! SharpMap has a WFS implementation. Code here: https://github.com/SharpMap/SharpMap/blob/master/SharpMap/Data/Providers/WFSClient.cs Main web page here: https://github.com/SharpMap/SharpMap. If I were you, I'd use that as much as I could. It'll save you doing all the tedious implementation stuff...


9

I think I know what you mean, you should do that by 2 tools step by step first step find in arctoolbox intersect (Analysis) and then create intersect point layer in Intersection tools window choose "point" in output type field intersect(Analysis) finally [Step2] by Split line at point tools in ArcToolbox you can split polyline based on intersection points ...


8

You will not be able to delete a dataset (e.g. a workspace, feature dataset, feature class, table) when any references are held onto it, as they are implicitly locked. That being said, you do not need to worry that somebody will delete a dataset from under your hands while you are still referencing it. This can happen for IName-based instances, but not for ...


8

A file geodatabase has 3 types of locks. SR - schema lock RD - read lock ED - edit lock The proposed solution by @StacyR will work in all situations except for exclusive edit locks (ED) according to arcgis help documentation. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003n0000007t000000


8

In ArcObjects .NET, use the RuntimeManager e.g.: Listing all installed runtimes: var runtimes = RuntimeManager.InstalledRuntimes; foreach (RuntimeInfo runtime in runtimes) { System.Diagnostics.Debug.Print(runtime.Path); System.Diagnostics.Debug.Print(runtime.Version); System.Diagnostics.Debug.Print(runtime.Product.ToString()); } or, to just get the ...


8

Use IGeometryBridge2.SplitAtDistances(). Also see the documentation on the equivalent IPolycurve2.SplitAtDistances() and the singular IPolycurve.SplitAtDistance() methods for more explanation. The IGeometryBridge2 version must be used in .NET. Edit: This code works for me: private static IEnumerable<IPolyline> SplitPolylineIntoEqualSegments(...


7

After doing some research, I found a solution and it's called Assembly Binding Redirection Basically, for any .net .exe, you can add XML code in the application config file to redirect a referenced assembly from a version number to another. Esri implemented this in 10.0 and up versions in their EsriRegasm.exe utility. (located here : %commonprogramfiles(...


7

If the locks are being created by your code, then you aren't cleaning up after yourself. Release all references to feature classes, workspaces, cursors, etc. The locks are removed when you have no more references to the objects being locked.


6

Reinstalling the ArcObjects SDK will install the VS2010 templates provided VS2010 is installed. I had this happen as a result of installing the ArcObjects SDK before installing VS2010. I had been using VS2005, and after installing VS2010 the ArcObjects templates were not available. Reinstalling the ArcObjects SDK resolved the issue.


6

You could look at http://dotspatial.codeplex.com/ that has just released 1.0. From what I can remember this pulls together a number of other components such as Proj4 library and Topology suite.


6

This prints: 319524.804848596 174709.885049006. private static void TestProjection() { Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); System.Object obj = Activator.CreateInstance(factoryType); var srf = obj as ISpatialReferenceFactory3; // Create Transformation from WGS84 to OSGB86 var geoTrans =...


6

It is a replacement ArcGIS Pro .NET SDK: The Road Ahead – SDK and API No need for “external” PIAs (primary interop assembly) like with Arcobjects. Simply install ArcGIS Pro. This is the fully fledged 64-bit version that will use more than 4GB of RAM for processing a long drawback of ESRI - welcome to the 21st century Still limited At Final Release: No ...


6

To get the messages in the catch block, the gp variable needs to be accessible outside try. You could also use finally if you want to get the messages regardless of success. IGeoProcessor2 gp = new GeoProcessorClass(); gp.AddToolbox(@"C:\Users\mxxx\Desktop\GIS_Testing\HbtatTesting\HabitatMon.tbx"); IVariantArray parameters = new VarArrayClass(); ...


5

This answer memorializes and expands on some of the discussion in the comments. A RAM disk emulates an external disk drive using some of the RAM in a computing system. It can read and write at speeds comparable to in-memory caching, minus a little overhead for the translation protocols to convert disk-oriented commands to memory-oriented commands. A RAM ...


5

You can use MapScript (part of MapServer) to make images from any sort of geometry. With (e.g.) MapScript for PHP, you could build a geometry from a WKT string with ShapeObj ms_shapeObjFromWkt(string wkt), make the style look good, then render an image object with imageObj draw() (see an example). There are different flavours of Mapscript, including for ....


5

For deploying without any setup tool, double-click the *.esriAddIn file. This file could be found in the debug folder, after build the project in Visual Studia 2010. Add-ins for ArcGIS Desktop 10 For deploying a custom component using a setup tool: How to deploy a custom component using a setup project


5

Visual C# 2010 Express: Project -> Project Properties -> Application -> Target Framework VB.NET 2010 Express: (thanks Jakub) Project -> Project Properties -> Compile -> Advanced Compile Options -> Target Framework (All Configurations)


5

I think that you should always use the inbuilt IGPMessages message.AddError(errorcode, errormessage). It is the standard way of providing feedback and error message in the ArcObjects framework. Using the second option is sort of a hack, and this error message won't appear in the standard cases, like running the tool in ArcGIS Desktop or python. In ...


5

I would say that you should use Any CPU for all your assemblies. Any exes will need to be compiled for x86 if they are using ArcObjects. Here is a helpful article from Stack Overflow- “An AnyCPU assembly will JIT to 64 bit code when loaded into 64 bit process and 32 bit when loaded into a 32 bit process.” https://stackoverflow.com/questions/...


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