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.
PointClass p1 = new PointClass();
Dim p1 as PointClass Set p1 = new PointClass
p1.PutCoords(34.481560, 41.515391);
p1.PutCoords 34.481560, 41.515391
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
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;
Li, If you are looking to return the distance between geometries then have a look at the IProximityOperator Interface.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.