Tag Info

Hot answers tagged

23

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


11

Is this a desktop application or, say a Silverlight application? If it is web-based you have to jump through some hoops. You could create a view that exposes WKT and then parse the WKT client side into WPF / Silverlight geometries. If it is a desktop application you've got it quite a bit easier. There is a good example at the Code Project of an SQL Geometry ...


11

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


11

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


9

In the code below, the multi2single function works for me in 10.0. I couldn't test Feature2Point since I don't have an ArcInfo license, can you?. public class Test { public static void TestGP(IApplication app) { IMxDocument mxDoc = (IMxDocument)app.Document; //Feat2Point((IFeatureLayer)mxDoc.FocusMap.get_Layer(0), ...


9

I believe that NTS, The .NET Topology Suite contains code capable of doing geometry operations on GIS structures. It's a .NET port of JTS.


9

ESRI have a heap of videos, and I think these are the best resources to get started. I would recommend looking at the ESRI Developer Conference videos At time of writing, 2010 is the latest A Developers Guide to ArcGIS Server A Developers Guide to ArcGIS Mobile The ESRI Development Process Intro To ArcGIS Desktop Add-Ins Each of these videos conclude ...


9

You can use the GDAL included .NET wrappers. This allows you to access any of the GDAL functionality from within managed code.


9

NetTopologySuite offer what you need, and much more: http://code.google.com/p/nettopologysuite/


9

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


9

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


8

I think that you're looking at implementing a custom layer. I don't know how else you'd render data inside ArcMap. Outside of a purely academic exercise, I haven't done it. There's a starter page of info available here, with a list of minimal interfaces you'd need to implement. On the plus side, there is a developer sample. The down-side is that you're ...


8

The warning you received is because you have your class (or assembly) marked with: [ComVisible(true)] This causes the compiler to issue warnings when you use types that are not compatible with COM objects. That being said, there is no problem with using generics with ArcObject types. You should, however, only use them for types that are internal to your ...


8

I had a similar issue to this and resolved it by deleting the corresponding cache directory for my add-in: C:\Documents and Settings\<username>\Local Settings\Application Data\ESRI\Desktop10.0\AssemblyCache\ 10.1 on Windows7: %LOCALAPPDATA%\ESRI\Desktop10.1\AssemblyCache will take you to: ...


8

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


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


7

Try using the ITopologicalOperator.Union method called on one of those polylines, passing the second one as its parameter. As long as the two polylines' endpoints meet, this approach should solve your problem. EDIT: when performing union on multiple geometries (more than two), ITopologicalOperator.ConstructUnion is more efficient. You would call this method ...


7

Here are few resources to get you started. http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Building_add_ins_for_ArcGIS_Desktop/0001000000w2000000/ http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Walkthrough_Building_custom_UI_elements_using_add_ins/0001000001ms000000/ ...


7

As far as I can tell you are implementing the error handling that ESRI is currently putting out there as best practice. If you were to grab a hold of the application's (ArcMap) unhandled exceptions you could potentially be then displaying messages about errors that were not part of your AddIn. Most of the AddIns you write are probably going to be buttons ...


7

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


7

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


6

You can check Net Topology Suite with GeoAPI .NET


6

This should do the trick (C#): var dockableWindowManager = (IDockableWindowManager)_app; // _app is an IApplication reference var uid = new UIDClass() { Value = "esriEditor.CreateFeatureDockWin" }; var window = dockableWindowManager.GetDockableWindow(uid); window.Show(true);


6

The answer to this is probably somewhat subjective depending on what environment or platform you are using. My approach is usually to look at the project and choose what works best for each situation. Generally, I lean towards .NET for ESRI based projects and Java for open source / other solutions. My experience has been that as long as you know how to ...


6

Have you tried setting DBNull.Value instead of null?


6

This works for me : var fLayer = ArcMap.Document.CurrentContentsView.SelectedItem as IFeatureLayer; if (fLayer != null) Debug.Print("got featurelayer"); else Debug.Print("no featurelayer selected (or maybe more than one is)");


6

You have to install the SDK seperately, so you will see a 'C:\Program Files (x86)\ArcGIS\DeveloperKit10.0' folder that has the 'DotNet' folder with the assemblies. The .Net extension stuff is auto-installed now since ArcGIS forces a .Net version for install. So you don't need to specify it; you just need to push to install the SDK.


6

You rarely need to access IUnknown in day-to-day AO development (or COM interop for that matter). Declaring your variable as object will do the trick since you will anyway need to cast it to another interface afterwards.


6

How about using GDAL's OGR .NET bindings? http://bjarte.com/post/gdal-in-csharp and its KML driver through libkml http://www.gdal.org/ogr/drv_libkml.html Alternatively, you could use libkml directly.


6

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



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