POST
|
I am writing code in VBA to calculate distances between 150 points and 2 source points which are in different layers, but I am unclear how to use the array. Could anyone give me a hand? Thanks,
... View more
04-08-2013
09:43 PM
|
0
|
0
|
260
|
POST
|
I am using VBA for the code and need to store the calculation result in the existing attribute table or in a new table. I am seeking for help for the code. Thanks.
... View more
04-08-2013
09:40 PM
|
0
|
0
|
260
|
POST
|
I am writing code with VBA for distance between 150 points to 2 source points, which are vector data and on two layers. How can I define the source points? how to use IProximityOperator.ReturnDistance for the calculation? Thanks.
... View more
04-08-2013
09:37 PM
|
0
|
0
|
260
|
POST
|
I am writing code for distance between 150 points to 2 source points, which are vector data and on two layers. How can I define the source points? how to use IProximityOperator.ReturnDistance for the calculation? Thanks.
... View more
04-08-2013
09:36 PM
|
0
|
0
|
260
|
POST
|
I have a question for calculation of different points in a layer and need to export the results of distance matrix in a *.csv document with VBA & ArcObjects. (I Have the map layer of points (vector data) and the attribute table of the points.) Some one has ever suggested me the interface, but I am still lost, since I am a real beginner and only have some unclear conception. Could anyone help me to write the code that I can copy and use it? Thanks very much!
... View more
04-08-2013
05:50 AM
|
0
|
7
|
801
|
POST
|
Thanks Oyleiste, Do you know the code in VBA. I am writing it in VBA and difficulities still exist. Thank you very much! Code for calculating distance and angle between two points in C#:
PointClass p1 = new PointClass();
PointClass p2 = new PointClass();
// Add data to points for test
p1.PutCoords(34.481560, 41.515391);
p2.PutCoords(34.702832, 41.795668);
IMeasurementTool measurementTool = new MeasurementToolClass();
measurementTool.ConstructByPoints(p1, p2);
// Here we calculate distance between two points: (p1, p2)
double distance = measurementTool.Distance;
ILine lineForAngle = new Line();
GeometryEnvironment geoEnv = new GeometryEnvironment();
IConstructAngle angleCalculator = (IConstructAngle)geoEnv;
lineForAngle.PutCoords(p1, p2);
// Here we calculate angle of line between (p1, p2) and the positive x-axis
double angle = angleCalculator.ConstructLine(lineForAngle);
// Convert radian to degree
angle *= 180 / Math.PI;
Sinrecely
... View more
04-07-2013
06:24 AM
|
0
|
0
|
1082
|
POST
|
Thanks Duncan. I need to return the distance between different points. The points are read from the point layer of map and the coordinates (x,y) are stored in an array. Then I need to calculate the distance using the array of the coordinates and return the distance matrix into a table or a .csv file. I have written the following part of the code, and couldn't keep going, so I would like to ask for help. [INDENT]Private Sub UIToolControl1_DblClick() Dim pMxdoc As IMxDocument Set pMxdoc = ThisDocument Dim pmap As IMap Set pmap = pMxdoc.FocusMap Dim pFeatLayer As IFeatureLayer Set pFeatLayer = player Dim pFeatClass As IFeatureClass Set pFeatClass = pFeatLayer.FeatureClass 'Get point features Dim pGeometry As IGeometry Dim pPoint As IPoint Dim pTable As ITable 'different point has different accordant field name which shoud be the same with the output field name Dim pfield As IField 'Count point Dim pFeatureCursor As IFeatureCursor Set pFeatCursor = pFeatClass.Search(Nothing, False) fcount = pFeatClass.FeatureCount(Nothing) Dim parray(2, fcount - 1) As Variant Dim pfeature As IFeature Set pfeature = pFeatCursor.NextFeature Dim prowbuff As IRowBuffer Dim pgeom As IPoint xcount = 0 Do While Not pfeature Is Nothing Set prowbuff = pfeature parray(2, xcount) = prowbuff.Value(1) 'here 1 is the field with the name you want for each point Set pPoint = pfeature.ShapeCopy parray(0, xcount) = pPoint.X parray(1, xcount) = pPoint.Y Set pfeature = pFeatCursor.NextFeature xcount = xcount + 1 Loop If fcount = 0 Then Exit Sub Else 'Set up a loop to calculate the distance of different points ? ? ? 'return the distance matrix into a table or a .csv file ? ? ? End Sub[/INDENT] Li, If you are looking to return the distance between geometries then have a look at the IProximityOperator Interface.
... View more
04-05-2013
05:10 PM
|
0
|
0
|
1082
|
POST
|
I am a beginner of arcobjects. My question is to write code for Calculation of Distance Matrix between different locations (different spots) and save it automatically in a table or a *csv file. The basic data is vetor map data with points, polygons and line. Thank you very very very much for help.
... View more
04-05-2013
07:05 AM
|
0
|
7
|
5681
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|