Questions tagged [c#]

C# is a .NET programming language.

Filter by
Sorted by
Tagged with
13 votes
8 answers
6k views

ArcObjects Resources [closed]

What are the best books/web sites for C# development with ArcObjects? The ArcGIS Resource Center is very helpful, but I am trying to find sources with more examples.
Britt Wescott's user avatar
16 votes
3 answers
4k views

Addressing Memory leak in IFeatureClass.Search (only on SDE with direct connect) of ArcObjects?

ESRI Support say they have reproduced the issue and have opened a bug report (NIM070156). I have determined that there is a memory leak (in unmanaged heap memory) that occurs when a tool in my .NET/C#...
blah238's user avatar
  • 35.7k
11 votes
5 answers
9k views

Programmatically edit/update metadata in ArcGIS?

Has anyone succeeded in programmatically updating metadata in ArcGIS 10? Considering using Python/arcpy but ArcObjects (C# or Python/comtypes) is also a possibility. I need to update both the FGDC ...
blah238's user avatar
  • 35.7k
3 votes
2 answers
2k views

ArcObjects: Alternative workflow to using a SQL query with over 1000 values in IN statement

I have a ListBox listing the unique values of a column in a feature class; the user can select any number of values and click a button to then zoom to the set of features matching those values. A ...
blah238's user avatar
  • 35.7k
1 vote
1 answer
2k views

Change The Label Field In GeoFeatureLayer

I currently have a basic shapefile that's a map of the United States. It has the name of the states, populations, and other pieces of information that I can get the names of via the following code: ...
ist_lion's user avatar
  • 511
20 votes
2 answers
20k views

API documentation for Gdal/Ogr with C#

I want to assign projection to shapefile in my web C# application, for this i am using Gdal/OGR/OSR C# bindings and add osr_csharp.dll and ogr_csharp.dll references. But i am facing some difficulty ...
user1899's user avatar
  • 1,417
16 votes
5 answers
12k views

How can I programmatically get the path of "Python.exe" used by ArcMap

I am working with an add-in of ArcMap in C#. From C# code, I have executed some Python scripts. Now, to run those script, I have hard-coded python path. But this is not portable. So, I want to get the ...
Emi's user avatar
  • 2,397
11 votes
5 answers
10k views

Activating custom ITool from form without adding it to ArcMap AddIn toolbar?

I'm working on an add-in for ArcMap 10.0 that adds a toolbar to ArcMap. One command (OpenModelessDialogCommand) button on that toolbar opens a modeless WinForms dialog, from which a tool (MyTool) can ...
stakx's user avatar
  • 1,141
6 votes
1 answer
4k views

WGS point to WGS line segment (great circle) distance

How would I go about resolving this in C#? I have a line segment (great circle distance) defined by two Lon-Lat pairs (call them points A and B). A third point somewhere on the Earth sphere. The ...
JJ_Jason's user avatar
  • 163
6 votes
2 answers
4k views

Determining if collection of coordinates (polygon) is ellipse?

I'm attempting to determine a geometry type based on a collection of coordinates and have come across a situation where I'd like to differentiate between what is a "polygon" and what is an "ellipse". ...
AHigh's user avatar
  • 1,566
3 votes
1 answer
1k views

Can I use an Update cursor with a versioned feature class which has attachments in ArcObjects .NET

I have a problem with my code (C# ArcObjects 10.1). We are trying to update and insert 10 - 15 rows at a time into a feature class hosted in ArcSDE 10.1 on SQL Server 2008 R2. We have a feature class ...
leinad13's user avatar
  • 213
15 votes
4 answers
48k views

Reading shapefile using C#? [closed]

I am new to ArcGIS and trying a few things.. I'm trying to read shapefile (which is supplied as an input) using C# and I want to generate a PDF file which contains underlying metadata information (...
DevRaj's user avatar
  • 171
12 votes
11 answers
10k views

Learning .NET for ArcGIS (mainly Desktop) use

I have basic programming skills (I program simple vba python and lisp scripts and had gone through a java course a long time ago), but it seems to me (judging by ESRI publications) that there is no ...
8 votes
1 answer
2k views

Find the nearest point on a line

I have a line that exists between two latlon positions, and a point on a certain latlon position. What I want to know is what the nearest point on that line is (in respect to the other point). So a ...
hutsend's user avatar
  • 91
8 votes
1 answer
13k views

How do I install the GDAL bindings for C#/.NET 4.5.1?

I'm trying to use the C# gdal bindings but I get an error in my C# code which says "Unable to load DLL 'gdal_wrap': The specified module could not be found. (Exception from HRESULT: 0x8007007E)". I'...
Andre Lashley's user avatar
6 votes
2 answers
1k views

Referencing ArcMap in class library using ArcObjects?

I have created multiple ESRI addins, where the same code is used. I have created a class library, which I can reference rather than duplicating code. I have the following in my ESRI addin code which ...
MapMan's user avatar
  • 2,124
6 votes
2 answers
2k views

Near analysis with mixed feature types in ArcObjects

I am trying to emulate the Near (analysis) ArcGIS tool in ArcObjects. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000001q000000 I want to use Mixed Feature Types. I have a ...
Conor's user avatar
  • 3,022
6 votes
2 answers
6k views

Create Polylines from arrays of points

Let me describe the data setup. A line has been provided as an array of coordinate pairs, one for each vertex. This array is variable in size, anywhere from 2 to 200 coordinate pairs per line. What I ...
Nathanus's user avatar
  • 4,308
5 votes
2 answers
1k views

Creating new legend using ArcObjects?

I am trying to add simple legend to the map. I wrote some simple test code below to see what happens but it did not work. var map = activeView.FocusMap; IGraphicsContainer ...
IBRA's user avatar
  • 1,019
5 votes
2 answers
2k views

Translating grid to USGS .dem in C# via GDAL

I am attempting to translate ArcInfo binary grids to USGS DEM format (.dem). I have installed the GDAL .NET bindings thru this build installer. I can get to GDAL in my C# add-in I am working on. ...
Chad Cooper's user avatar
  • 12.7k
5 votes
4 answers
4k views

Determine overlapping points using a spatial filter in ArcObject

I have a point layer with thousands of points. Using a spatial filter, I have to find out those points which are intersecting each other. Then the objectid's of the intersecting points should be ...
Sachin's user avatar
  • 51
5 votes
1 answer
1k views

Determining if spatial reference Geographic or Projected using ArcObjects?

I have the user select a coordinate system with the Spatial Reference Dialog. Is there a simple way to determine if the resulting spatial reference is a Projected or Geographic CS? I would have ...
rgwozdz's user avatar
  • 807
5 votes
1 answer
4k views

ArcObjects - Adding ArcGIS Server Layer to MXD Programtically

I am trying to add a layer from ArcGIS online to a mxd programatically with no luck. See code sample below. The error is happening at pAGSServerConnectionFactory.Open(props, 0); Anyone been able to ...
user890's user avatar
  • 5,695
4 votes
2 answers
1k views

Get the geometry from the lasso selection tool

I'm building an Add-in solution in ArcGIS 10 that contains a custom tool. I'd like to borrow the functionality of the lasso selection tool without reinventing the wheel. Is there a way to intercept ...
Rich Wawrzonek's user avatar
4 votes
4 answers
2k views

Exploring ArcObjects through C# or VB from Python background

While I understand that this may be off topic to an extent, I am in a bit of a bind and could use some help directing my thought process and research. I have little programming background aside ...
Nathanus's user avatar
  • 4,308
4 votes
2 answers
2k views

Getting "Failed to open tool" message when trying to run geoprocessing tool from C# code

I've been experimenting with the Military Aspects of Terrain Template, which has a toolbox associated with it. I've been using the following WPF Runtime code, which should open a tool in the ...
Renee Cammarere's user avatar
3 votes
2 answers
2k views

Using ArcObjects, how to convert an Access table into a proper geodatabase table?

I have inherited an ArcGIS application that creates a number of access database tables. I'd like to use ArcObjects to convert them to proper geodatabase tables, which I understand to mean simply ...
canisrufus's user avatar
  • 2,474
3 votes
1 answer
2k views

How to draw a rectangle a the map using C#?

I have two points, Ipoint upperRight; and Ipoint lowerLeft; points. from the previous points i can get the height and the width for the rectangle. How can i draw a rectangle on the map?. I think i ...
IBRA's user avatar
  • 1,019
3 votes
2 answers
3k views

C# - Access content from ArcGIS Online

I have got an existing .NET C# desktop application which already reads various GIS formats. I would now like to add support to read data from ArcGIS Online. What options have I got to access ...
James's user avatar
  • 39
3 votes
1 answer
2k views

HTTP 500 error when uploading shapefile to GeoServer with C#

I receive an HTTP 500 internal server error when attempting to PUT a shapefile using REST API. I can manually import the file, publish and preview it. So the file is fine. GeoServer log: 2016-05-24 ...
Captain Kenpachi's user avatar
3 votes
1 answer
7k views

Upload shapefile using GeoServer REST API and C#

I'd like to upload shapefiles using GeoServer REST API and C#. So far, I can create workspaces using the REST API and C#. From GeoServer documentation (specific to cURL), the difference between ...
okello's user avatar
  • 1,782
2 votes
3 answers
4k views

Simplest way to publish WFS from SQL Server under ASP.NET

My environment is ASP.NET, with data stored in SQL Server. Is there a way to serve Web Feature Services through C#, or will I need to install a mapping server?
BlinkyBill's user avatar
  • 1,151
2 votes
1 answer
1k views

How to control which Fields are exported in ArcObjects? (via Field Mapping)

In ArcMap 10.x, if you use the Export Data command on a layer that has hidden/disabled fields, those fields will not be present in the created feature class/table. My question is simple: how do you ...
Nathanus's user avatar
  • 4,308
2 votes
4 answers
16k views

Searching for c# code to convert from UTM to WGS1984 (and back)

I'm looking for code in c# that converts coordinates from UTM to WGS1984 (and preferably backwards as well). I need to convert coordinates from only one zone (36N). I've found this and this, but they ...
jonatr's user avatar
  • 3,185
1 vote
1 answer
652 views

Casting idataset to ifeaturelayer in ArcObjects C#?

I am try to casting idataset to ifeaturelayer i did not get any idea here my code ESRI.ArcGIS.ArcMapUI.IMxDocument mxd = ArcMap.Application.Document as ...
Velugoti Venkateswarlu's user avatar
1 vote
1 answer
3k views

Implementing WFS within .NET [closed]

There are several discussion about implementing (or not implementing) WFS with .net from scratch. However, if I do need to, how do I get started? I know it's a broad question. I need help getting ...
Garima V's user avatar
  • 128
1 vote
1 answer
1k views

Handling mouse events for tool called by button?

I have a dockable window with a 2 buttons that call 2 different tools (Draw Marker and Select Features), What i want to happen is when the user clicks on the relevant button on the dockable window and ...
MapMan's user avatar
  • 2,124
-1 votes
1 answer
2k views

How to learn ArcObjects (.NET, C#) for desktop applications but having only Arcmap desktop license? [closed]

How can I learn .NET and C# for desktop applications having only a desktop license? I want to upgrade myself in the development side so I'm trying to learn this stuff and I'm searching all the ...
Ganeshnarim's user avatar
25 votes
9 answers
10k views

How can I implement ESRI REST API?

ESRI announced that they are releasing the ArcGIS REST API as open technology. I've got an ISP running Sql Server 2008 with IIS7. Does anyone know of a good walk through showing how I can write C# ...
Kirk Kuykendall's user avatar
14 votes
6 answers
11k views

How do I iterate through every cell in a continuous raster?

See this link for more details. The Problem: I want to loop through a continuous raster (one that has no attribute table), cell by cell, and get the value of the cell. I want to take those values ...
11 votes
1 answer
1k views

Implement ArcGIS Custom Features with C#?

Is it possible to implement custom features in .NET? If so, how? I suspect the issue is being able to do COM aggregation with .NET, but I can't find anything on that ... Does anyone know if it is ...
Kirk Kuykendall's user avatar
10 votes
1 answer
7k views

C# implementation of concave hull / alpha shapes [closed]

I'm looking for a C# implementation of the Concave hull (alpha shapes) algorithm. I already found several Java, Python and C++ implementation but no C# version. The other implementation are quite ...
Paul Meems's user avatar
8 votes
2 answers
3k views

ESRI ArcMap Add-in Config.esriaddinx

I'm in the process of converting an older ArcMap extension to an Add-In in C# and I am trying to best take advantage of the XML based configuration. Config.esriaddinx works great for the basic set up ...
petegis's user avatar
  • 81
8 votes
2 answers
3k views

Why do these annotations appear stacked/overlapping?

I've encountered a strange problem while trying to populate an annotation feature class programmatically (ArcObjects, C#). As you can see in the image below, the characters in each text string seem to ...
elrobis's user avatar
  • 6,420
8 votes
2 answers
2k views

Can custom map tiles be consumed via ArcObjects within my ArcGIS 10 Desktop AddIn?

Can I programmatically consume and render custom map tiles in ArcMap via our ArcGIS 10 Desktop AddIn? The AddIn is built using the ArcObjects SDK for C#/.NET and ArcGIS 10. Pulling and rendering map ...
Josh's user avatar
  • 349
7 votes
2 answers
2k views

How do I implement outbound arcobjects interfaces in C#?

I would like to write a class in C# that implements one or more outbound interfaces, for example ILayerEvents and IActiveViewEvents. Does anyone know how to do this with C#? Update Following @Chaz's ...
Kirk Kuykendall's user avatar
7 votes
3 answers
2k views

How to generate geodesic linestring from two points in C#

I'm looking for a FREE C# class, library or set of functions that will allow me to generate a geodesic linestring (or array of vertices, whatever) from two decimal degree points. I've found ...
CaptDragon's user avatar
  • 13.3k
7 votes
2 answers
8k views

ArcObjects - find nearest feature to a point - has to be FAST

I've seen lots of discussion on this, especially using IIndexQuery.NearestFeature() on a FeatureIndex instance. Something like this: private IdDistancePair FindNearest(IGeometry g, IFeatureClass fc, ...
MC5's user avatar
  • 1,891
7 votes
1 answer
2k views

Adding new map to current project using ArcGIS Pro .NET SDK?

The new ArcGIS Pro SDK for .NET is currently in beta for ArcGIS Pro 1.1, and I'm having trouble with map/project objects. I can add layers to an existing map, but I can't seem to figure out how to ...
pvdev's user avatar
  • 1,198
7 votes
2 answers
2k views

MapScale not being persisted properly in mxd when programmatically changed outside of ArcMap environment

I am trying to change the scale of a map in an mxd OUTSIDE of ArcMap in a standalone Windows application. The problem is the scale is never persisted - the best code I have come up with is the ...
Vidar's user avatar
  • 1,860