POST
|
Forgot important information, I am using ArcGIS 10.0. Thank you!
... View more
03-26-2013
02:33 PM
|
0
|
0
|
381
|
POST
|
Hi Everybody: I am trying to create a script that takes coordinate system as an input, but after checking the list of data types I found that both Spatial Reference and Coordinate System types are suitable (see attached picture). Which should I use? or what are the difference between them? Thank you!
... View more
03-26-2013
02:30 PM
|
0
|
2
|
2305
|
POST
|
Hi Everybody: I want to make a toolbox script (using a python script as source) that takes a Geographic Transformation as parameter (like the out-of-box Project tool under the toolbox "Projections and Transformations-->Feature"). However, I couldn't find the data type when I create the new script in toolbox (see attached screenshot). Is there a way for me to make it accept a geographic transformation? Thank you!
... View more
03-26-2013
02:17 PM
|
0
|
5
|
791
|
POST
|
Hi Everybody: I am using an event handler to automatically clear all the selections when a point in a specific layer is created. The clearing works for the attribute table of the layer and the selection on the map. However, the clearing doesn't work with the Attribute Window of the editor. This causes a strange state after the point is created: nothing is selected on the map (no blue highlight), but the Attribute Window tree view shows a newly created point feature. Why does this happen? How to synchronize the tree view in Attribute Window? Thank you!
// * this event handler is re-attached to the IEditEvents_Event.OnSelectionChanged of the ArcMap editor extension, every time
// when a point of a specific layer is created.
// * This function is called when an edit session is started.
// * m_application is the IApplication of the ArcMap, and m_editor is the running editor extension
void Extension_OnSelectionChanged()
{
(m_editor as IEditEvents_Event).OnSelectionChanged -= Extension_OnSelectionChanged
((m_application.Document as IMxDocument).FocusMap as IMap).ClearSelection();
((m_application.Document as IMxDocument).FocusMap as ISelectionEvents).SelectionChanged();
}
... View more
02-26-2013
08:18 AM
|
0
|
2
|
655
|
POST
|
I just wrote some code for that, the basic idea is to convert the geometry to a projected coordinate system, buffer it, and then covert it back to the GCS. IGeometry projectedShape = (originalShape as IClone).Clone() as IGeometry; ISpatialReferenceFactory3 srFactory = new SpatialReferenceEnvironmentClass(); IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Sphere_Sinusoidal); pcs.SetFalseOriginAndUnits(0, 0, 1000000); projectedShape.Project(pcs); IGeometry5 buf = (projectedShape as ITopologicalOperator).Buffer(bufferMeters) as IGeometry5; buf.Project5(originalShape.SpatialReference, 0); Any other idea?
... View more
02-19-2013
07:07 PM
|
0
|
0
|
5608
|
POST
|
Hi Neil: Thank you for pointing out this. I tried the following code, but still doesn't work, what shall I do? Thank you!
IBufferConstruction bufConstructor = new BufferConstructionClass();
(bufConstructor as IBufferConstructionProperties).Unit = new LinearUnitClass();
object unitName = "Meter";
object unitAlias = "Meter";
object unitAbbreviation = "M";
object unitRemarks = "Meter is the linear unit";
object unitMetersPerUnit = 1;
((bufConstructor as IBufferConstructionProperties).Unit as ILinearUnitEdit).Define(ref unitName, ref unitAlias, ref unitAbbreviation, ref unitRemarks, ref unitMetersPerUnit);
IEnumGeometry input = new GeometryBagClass();
IGeometryCollection output = new GeometryBagClass();
(input as IGeometryCollection).AddGeometry(m_input_segment_polyline.FromPoint);
IDoubleArray distances = new DoubleArrayClass();
distances.Add(1);
bufConstructor.ConstructBuffers(input, 1, output);
\\ bufConstructor.ConstructBuffersByDistances2(input, distances, output); \\alternative
IElement ele = GeoUtils.AddGraphicToMap((m_application.Document as IMxDocument).FocusMap, output.Geometry[0], new RgbColorClass() { Red = 255, Green = 0, Blue = 0 }, new RgbColorClass { Red = 0, Green = 0, Blue = 255 }, 3);
The developer help states that the IBufferConstruction.Buffer method does not use the properties exposed in IBufferConstructionProperties. Try using one of the other buffer methods and see if that works.
... View more
02-19-2013
10:50 AM
|
0
|
0
|
5608
|
POST
|
Hi mkennedy: I tried the following code but it still give me a huge buffer instead of a 1-meter buffer. How to make it work? Thank you!
IBufferConstruction bufConstructor = new BufferConstructionClass();
(bufConstructor as IBufferConstructionProperties).Unit = new LinearUnitClass();
object unitName = "Meter";
object unitAlias = "Meter";
object unitAbbreviation = "M";
object unitRemarks = "Meter is the linear unit";
object unitMetersPerUnit = 1;
((bufConstructor as IBufferConstructionProperties).Unit as ILinearUnitEdit).Define(ref unitName,
ref unitAlias, ref unitAbbreviation, ref unitRemarks, ref unitMetersPerUnit);
IGeometry buf = bufConstructor.Buffer(m_input_segment_polyline.FromPoint, 1)
// draw the buffer
You might try IBufferConstruction / IBufferConstructionProperties instead. It supports geodesic-based buffers on points at 10.0.
... View more
02-15-2013
01:51 PM
|
0
|
0
|
5608
|
POST
|
Hi Everybody: I am writing ArcObjects tool that works on the data with WGS84 spatial reference, where the X/Y coordinates are degrees. I want to use ArcObjects to buffer a point with 1 meter distance. If I use the ITopologicalOperator.Buffer, it will buffer the point with a number in the unit of degrees. I don't know how to get this number now. Do you have any idea? Here is what I know at this moment: * if I the point's spatial reference is an IGeographicCoordinateSystem but now a IProjectedCoordinateSystem * the IGeographicCoordinateSystem.CoordinateUnit.ConversionFactor and IGeographicCoordinateSystem.CoordinateUnit.RadiansPerUnit are both 0.017453, which is roughly PI/180, which is not telling how many meters each degree is * I am using ArcObjects 10.0 Any idea? Thank you!
... View more
02-15-2013
11:30 AM
|
0
|
6
|
13452
|
POST
|
Hi Everybody: I am implementing an ArcMap 10 extension such that in some state I want to disallow user from adding/deleting layers in the map (same as preventing doing change on the TOC). Is there anyway to prevent user from doing that from ArcObjects? Thank you!
... View more
09-24-2012
01:28 PM
|
0
|
0
|
349
|
POST
|
Hi Everybody: I am making a custom shape constructor following the instruction of http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#//0001000002nq000000 and I am starting from checking the example http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/d/00010000014z000000.htm In the constructor of this tool, if I add a statement
FeatureConstructionPointTools.Register("PointsAlongLine.PointsAlongLine");
then I can see the tool showing up in the list of Construction Tools for point feature templates in ArcMap editing session. I tried the following and they are not working in the way I expected: 1. I put a FeatureConstructionPointTools.Unregister("PointsAlongLine.PointsAlongLine") statement in the constructor of the sample code instead, but the "Points along a line" construction tool still show up for the point templates in edit session. 2. I put a FeatureConstructionPointTools.Unregister("PointsAlongLine.PointsAlongLine") in some other custom command code and ran it within and outside of edit session, but the "Points along a line" construction tool still show up for the point templates in edit session. 3. I removed the "Points along a line" construction tool using Categories.exe provided by ArcGIS, and then I tried to run FeatureConstructionPointTools.Register("PointsAlongLine.PointsAlongLine") from some custom command to put it back to construction tool list, but it doesn't work. From the test I only figured out that I can register a tool to the ArcMap construction tool list by puting code in the constructor function of the tool. But I haven't figured out how to: * unregister the tool from construction tool list * register the tool from other places such as another custom command. How can I properly use the FeatureConstructionPointTools class to do register/unregister? Thank you!
... View more
09-04-2012
03:58 PM
|
0
|
0
|
509
|
POST
|
For each path you create a new instance of the Polyline class then add the path to it's geometry collection. Yes that works for me. Thank you.
... View more
08-28-2012
07:28 AM
|
0
|
0
|
228
|
POST
|
Hi Everybody: A PolylineClass object supports IGeometryCollection interface, from which I could get a list of PathClass objects. How can I get an individual PolylineClass object for each of these PathClass objects? For example, with a Polyline that contains multiple paths inside, I want to break it down into multiple Polylines, each of which supports IGeometryCollection and only have one path. Thank you!
... View more
08-22-2012
11:13 AM
|
0
|
3
|
950
|
POST
|
Hi Everybody: I am writing ArcMap extension code in C# to work with a personal Geo-database. The feature classes in this GDB are all in a spatial reference that using geographic coordinate system WGS84 without any projected coordinate system. The MXD file my code working with is not expected to have any setup on the projected coordinate system. In the C# code when I use IProximityOperator.ReturnDistance method to find out distance between two feature in this GDB. The returned distance seems to be in the unit of degree (for Lat-Long). This result is not directly usable for me. How can I get the distance in the unit of meters? Thank you!
... View more
08-17-2012
09:48 AM
|
0
|
2
|
1373
|
POST
|
For some reason, your statement is leading me to believe that you are releasing an object, then trying to do a method call on that object, but first checking whether the object you released is null, otherwise calling that method on a released object without first re-assigning that released object the value of null is giving you the exception. What do you expect? If you were in Java, assigning an object reference to null would still give you an exception when you tried calling a method on that object. I still don't understand why you are trying to call a method on an object after you've released it. Can anyone explain that to me? I would really like to understand why you are trying to do this. The exception is not caused by calling a method of that released COM object, but caused by releasing it again with my generic releasing method... it use "if (obj is IEnumerable)" to check the interface it supports. Because it is already released, the checking will fail in the second call of the releasing method. Now I decide to resolve this issue by coding carefully, not to release the same COM object twice, even though the logic will be a bit more comoplicated.
... View more
08-08-2012
02:35 PM
|
0
|
0
|
139
|
POST
|
If you are releasing fList and f at the end of your procedure/function/method - whatever, how are you getting an exception? Also, telling us what kind of exception you're getting would help. Is it NullPointerException? AutomationException? something else? Hi Idonahue: The exception message tells "COM object that has been separated from its underlying RCW cannot be used." Any idea? Thank you!
... View more
08-08-2012
11:22 AM
|
0
|
0
|
706
|
Title | Kudos | Posted |
---|---|---|
1 | 08-16-2020 03:56 PM |
Online Status |
Offline
|
Date Last Visited |
04-18-2023
08:47 PM
|