Question

I am creating a Plugin and I need to know the

  • Min and Max Latitud
  • Min and max Longitud

That information shows in the Statistics tab of the Settings Window of the Project. (Menu Project -> Project Settings -> Statistics tab)

I get the Statistics information with:

 Statistics stat = StatisticsService.GetStatistics(PetrelProject.PrimaryProject);

And then to get Latitud and Longitud information I do:

var latitud = stat.AxisInfo.OfType<PropertyInfoItem>().FirstOrDefault(item => item.Name == "Lat");
var longitud = stat.AxisInfo.OfType<PropertyInfoItem>().FirstOrDefault(item => item.Name == "Long");

However I arrived to this solution by looking at the data while debugging. I don't know if this will be the data structure for every project.

Additionally the precision of the Data that is in the AxisInfo item is less than what it is shown in the Statistics tab of the project.

Is there another way to get the Latitude and Longitud of the project?

Was it helpful?

Solution

The statistics is the only one fast way to get this information (else you need to "travel" along all objects in a project), but you need to use X and Y instead of Lat/Long (that are dynamic transformation). You can transform Point3(X,Y,Z) (where Z can be 0) to a Geodetic point via ICoordinateService -> CreateOperationToReference -> Convert

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top