Questions tagged [c#]
C# is a .NET programming language.
1,371
questions
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# ...
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 ...
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 ...
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#...
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 (...
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 ...
14
votes
1
answer
2k
views
How to get selected Features/Geometry from Windows Clipboard in ArcMap/C#?
I have a custom tool in ArcMap 10. The Workflow is the following:
Select Features in a Layer with the "Select Features by Rectangle" tool
Copy the Features to the Clipboard using STRG+c
Select the ...
14
votes
1
answer
1k
views
Understanding why ArcPy Cost Path Analysis tool faster than ArcObjects? [closed]
Although I use python to create geoprocessing scripts/services, I was under the impression that using ArcObjects to do the equivalent operation(s) will have better performance.
I've posted ArcGIS ...
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.
13
votes
1
answer
45k
views
Converting latitude and longitude into Northing and Easting?
I have the following UK postcode dy8 3xt and know that the latitude and longitude is:
54.452772
-2.156082
I also know that the Easting, Northing for the postcode is:
389490
283880
However I am ...
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 ...
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 ...
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 ...
11
votes
1
answer
7k
views
Convert longitude/latitude to pixels on the map
I have a map from here. I want to be able to simply convert arbitrary lon/lat pair to pixels on the map (also the ability to do reverse conversion). The maps come with .tfw file and projection info, ...
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 ...
10
votes
2
answers
1k
views
C# version for ArcObjects 9.3
Can I use C# 4.0 with the target framework set to .NET 3.5 to develop an extension for ArcMap 9.3? Or does it have to be C# 3.0 or earlier?
10
votes
2
answers
2k
views
ArcGIS 10 add-in: Top-level exception handling
The ArcGIS 10 add-in I'm working on is pretty simple -- just a tool control and a dockable window. I'm handling the specific exceptions I anticipate occuring at the source and throwing everything else,...
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 ...
9
votes
2
answers
6k
views
ArcObjects: How to insert data into a table?
I have a table in ArcCatalog named WorkOrderAss.
This table contains 3 columns: (OBJECTID, FeatureName, Name).
I want to insert data to this table from the code behind in C#.
Any help would be ...
9
votes
2
answers
7k
views
C# Abstraction for Web Feature Service (WFS) Call
I'm currently working on a WFS client-side implementation in C# for a thick client application (Windows desktop application). The goal is to be able to choose some "layer" combinations to be shown ...
9
votes
3
answers
3k
views
Creating floating-only (non-dockable) window in ArcMap using ArcObjects?
I'm looking for a way to create a floating window in ArcMap. To give an example just look at the window of the Identify tool.
Floating means that it stays in front of the map document at all times ...
9
votes
3
answers
1k
views
Computing distance between two points "as the fish swims" [closed]
We have a layer named Hydrography which is the water area for a given assignment.
I have a station point and a target point. I need to compute the distance between those two points but inside of the ...
9
votes
2
answers
4k
views
What is the best way of refreshing the view after drawing graphics?
I draw a polygon on button click to highlight a feature. Then I need to refresh the ActiveView to show the new polygon. This lines do work:
mapControl.ActiveView.ScreenDisplay.StartDrawing(...
9
votes
1
answer
3k
views
Editing shapefile in ArcMap programmatically?
Is this something that can be done?
For instance if I created an overlay on a map and saved it as a shapefile, I want to go and edit this (pre-existing file.) overlay... Either add points/remove ...
9
votes
5
answers
16k
views
Convert Sql Server Spatial data to GeoJSON & plot on map
I have a sql server table with Geo spatial data. An example of row would be (with Column names):
type: streetline
code: 231001
geog: 0xE6100000011 ........
Centroid 0xE61000000C.......
geom: ...
9
votes
1
answer
343
views
ArcObjects running in Addin slower?
I have created a class library which does some geoprocessing. The addin calls a class that is an async process. I have ensured the thread is STA and the arcobjects are thread safe (ie. not passed from ...
8
votes
2
answers
4k
views
Deploying Application With C# GDAL/OGR Bindings
I developed a relatively simple web app that uses the C# OGR bindings to do a couple of simple geometric functions; buffer, clip...etc. I developed this application on my local machine, which has ...
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'...
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 ...
8
votes
1
answer
7k
views
Geometry from multiple selected features into one geometry
Lets see if I can explain what I'm trying to do. First of all I have developed an AddIn for ArcMap that can take one selected feature (Polygon) on a layer, grab the geometry of that feature, and save ...
8
votes
3
answers
6k
views
ArcObjects (ArcGIS for Desktop and C#): How to cast between the ArcMap COM UI and my custom .Net UserControl objects?
I'm creating a utility to run in ArcGIS for Desktop using ArcObjects (9.3.1 SDK) and C#.Net. My prototype involves a toolbar with two comboboxes and a tool. The first combo selects a layer in the TOC, ...
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 ...
8
votes
1
answer
2k
views
Is it possible to create C# based plugins for QGIS (instead of Python)?
My team has a lot of C# code that we've used for ArcGIS Add-in development. We're thinking of porting some of these tools into QGIS as plugins using QT Designer. However rewriting them with Python ...
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 ...
8
votes
2
answers
8k
views
How to start using the SharpMap library?
I am a very newbie on GIS and also programming especially C#. I am trying to develop a program to:
display map from GeoTIFF, DTED (level 2 I guess), shapefiles and JPEG type of files.
display ...
8
votes
1
answer
1k
views
Automatically display related records for selected feature in tablewindow with ArcObjects
Is there a way through ArcObjects to automatically display the related table(s) for the selected feature in ArcMap in the attribute window (tablewindow) without the user having to click on it and ...
8
votes
1
answer
738
views
Custom panning using ArcGIS Engine
Due to some constraints, that I will not go into, I have found myself needing to implement custom panning in my application.
The ArcGIS API reference suggests using the following methods:
...
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 ...
7
votes
2
answers
3k
views
Detect Table of Contents Changes in ArcMap using ArcObjects?
What is the preferred and/or most efficient method for detecting a change in the table of contents in ArcMap using ArcObjects? My current implementation relies on a dictionary with the names and ...
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 ...
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, ...
7
votes
4
answers
5k
views
C# Library for consuming Geoserver REST?
I am currently experimenting with Geoserver and it's capabilities within C#. One thing I would like to do is query the server for basic information (existing workspaces, layers, layer attributes, etc.....
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 ...
7
votes
2
answers
2k
views
How to cluster points of interest by lat lon for my WP7 app?
I have alread asked this question on SO, so I apologize if duplicating this is bad form. I will link to each of the sites if I get the right answer.
I have a collection of my own PointOfInterest ...
7
votes
4
answers
2k
views
US One Address locator style missing city, state and zip code fields?
I am using the file:
C:\Program Files\ArcGIS\Desktop10.0\Locators\US One Address.lot
To do address resolution on a parcel / polygon layer. I'm trying to understand why the file doesn't contain ...
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 ...
7
votes
2
answers
1k
views
Is it possible to modify the ArcObjects IProgressDialog2?
It turns out that the best way to run long tasks in ArcMap is to use the IProgressDialog2. The BackgroundWorker in combination with ArcObjects (STA Threads) is a mess.
However, it seems that the only ...
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 ...
7
votes
3
answers
2k
views
E_FAIL when calling ESRI.ArcGIS.Carto.IImageServer.Initialize()?
I am using ArcGIS Engine and Developer Kit 10 on Windows 7. Specifically, I'm writing an ArcObjects console program using Visual C# Express 2008.
I am attempting connect to an image server via a URL (...
7
votes
1
answer
738
views
Get Z value from point in LAS Dataset using ArcObjects
Using ArcObjects (C#) I am trying to build a tool that will extract the Z value from a point in a LAS Dataset when the user clicks on it (then use that value elsewhere). My intention was to use the ...