PSU-CSAR / vb-bagis-p

VB .NET source code for ArcMap BAGIS Parameters add-in
1 stars 1 forks source link

PE_Obs and SR_Obs Tool : Unable to load AOI #38

Closed jdduh closed 7 years ago

jdduh commented 7 years ago

For unknown reasons, when the tool is used on an AOI that was created by BAGIS's Create an AOI from a shapefile tool an error message occurs (see image).

The AOI (yampa_poly) can be downloaded from ftp://basins.geog.pdx.edu/public/

image

lbross commented 7 years ago

I am stumped. The root of the problem is that the SR calculation code won't run with this AOI. I added some error handling to BAGIS-P to handle this possibility but the calculation won't run.

The code is relatively simple. I find the centroid of the AOI and loop through all the SR points to find the closest one. However, for this particular AOI, I get a COM Exception when I try call the ReturnDistance method for the first point: Do While queryFeature IsNot Nothing queryGeometry = queryFeature.Shape proxOperator = CType(queryGeometry, IProximityOperator) Dim distance As Double = proxOperator.ReturnDistance(searchGeo)

For testing, I used the feature-to-point GP tool to find the centroid and then the PointDistance GP tool to get all the distances and that gave me to correct results.

A couple of things I can think of to try, none of them appealing:

  1. Check with ESRI to see if the IProximityOperator has a bug
  2. Test with a different AOI that was created using the shapefile tool to see if it has the same issue
  3. Rewrite the SR tool to use the GP instead of ArcObjects; This will likely be slow.

Do you have any suggestions?

jdduh commented 7 years ago

The AOI vector has a different projection than what BAGIS is based on. Is that the cause?

lbross commented 7 years ago

It could be the cause. That is why we check the projection when the user selects the SR and PE layers. But I looked at the projection for aoi_v and at a quick glance, it appeared to be the same as animas_AOI_prms_3 which works fine. What is it currently? And what is BAGIS based on?

jdduh commented 7 years ago

image

The interesting thing is that the projection seems to match, but I still gets these error messages when selecting either projected solarDAT dataset in the PE_SR_Obs_nmonth_Databin.

The project's default project is: Projected Coordinate System: USA_Contiguous_Albers_Equal_Area_Conic_USGS_version Projection: Albers False_Easting: 0.00000000 False_Northing: 0.00000000 Central_Meridian: -96.00000000 Standard_Parallel_1: 29.50000000 Standard_Parallel_2: 45.50000000 Latitude_Of_Origin: 23.00000000 Linear Unit: Meter

Geographic Coordinate System: GCS_North_American_1983 Datum: D_North_American_1983 Prime Meridian: Greenwich Angular Unit: Degree

However, the GRID raster format only supports this project definition: Projected Coordinate System: NAD_1983_Albers Projection: Albers False_Easting: 0.00000000 False_Northing: 0.00000000 central_meridian: -96.00000000 Standard_Parallel_1: 29.50000000 Standard_Parallel_2: 45.50000000 latitude_of_origin: 23.00000000 Linear Unit: Meter

Geographic Coordinate System: GCS_North_American_1983 Datum: D_North_American_1983 Prime Meridian: Greenwich Angular Unit: Degree

jdduh commented 7 years ago

Which layers' projection information is used to determine AOI's projection? I pulled the projection information from aoi_v.

lbross commented 7 years ago

For the SR tool, the aoi_v is used to determine the AOI's projection. The GRID raster format isn't used when processing SR. I am surprised that you are getting an error with both solarDat datasets. I am able to use this dataset: F:\NWCC\GIS\Static\PE_SR_Obs_nmonth_Databin_10072016.gdb\solradDAT_Oct2004. Although, as I said, the tool doesn't complete successfully.

I vaguely recall doing some work on the projection matching a while back although I can't find any record of it on GitHub. I posted a current version of the add-in on GitHub if you want to try loading a new version. It is available here.

I will take a close look at the projection of aoi_v in yampa vs the solarDat dataset.

lbross commented 7 years ago

yampa_poly and a few of my other aoi's all have the same projection for aoi_v. This is also the same as solradDAT_Oct2004.

NAD_1983_Albers Authority: Custom

Projection: Albers False_Easting: 0.0 False_Northing: 0.0 central_meridian: -96.0 Standard_Parallel_1: 29.5 Standard_Parallel_2: 45.5 latitude_of_origin: 23.0 Linear Unit: Meter (1.0)

Geographic Coordinate System: GCS_North_American_1983 Angular Unit: Degree (0.0174532925199433) Prime Meridian: Greenwich (0.0) Datum: D_North_American_1983 Spheroid: GRS_1980 Semimajor Axis: 6378137.0 Semiminor Axis: 6356752.314140356 Inverse Flattening: 298.257222101

jdduh commented 7 years ago

Ver 1.9.8 opens yampa_poly without any error message. However, I still get these error messages when setting the SE and PE files. It seems that the projection information associated with the AOI is not recognized by BAGIS-P.

image

image

image

image

lbross commented 7 years ago

We know we are both using the same version of BAGIS-P and the same AOI. I downloaded it from basins yesterday. As I said, I am able to select the PE_SR_Obs_nmonth_Databin_10072016.gdb\solradDAT_Oct2004 and PE_SR_Obs_nmonth_Databin_10072016.gdb\pe01_alb layers so they pass the projection test. This means that we must be working with different versions of the PE_SR_Obs_nmonth_Databin_10072016.gdb database, right?

Do you want me to post my database to basins? Or do you want to post yours?

Or is it possible that my version of ArcMap is handling the projection differently? I am still running 10.2.2.

lbross commented 7 years ago

Just tested reprojecting aoi_v to the same projection as solradDAT_Oct2004 and it worked! But the projections of the two files look completely the same to me :-( I am attaching my aoi.gdb so you can take a look. aoi_v_p is the projected version. aoi_v is the original. aoi.gdb.zip

jdduh commented 7 years ago

The AOI that George provided contains invalid vertical coordinate system information (VCS). I'm not sure how George got that into the featureclass's projection.

image

lbross commented 7 years ago

Does this issue require any further action at this time? Or are we waiting to hear back from George?

jdduh commented 7 years ago

Once I hear from George on his "reprojection" procedure, I will document it here. I will close the issue for now.

lbross commented 7 years ago

I am still perplexed that I could choose the SR layer and you could not, but we will let that go. It is likely a difference in ArcMap versions

jdduh commented 7 years ago

I have ArcGIS 10.4.1 on my desktop computer. That probably is the source of difference. After I reprojected the aoi_v layer (i.e., removing its VCS information), I was able to complete the PE & SR calculation on a second try. On the first try, the PE & SR tool completely crashed ArcGIS. The unknown VCS might have corrupted ArcGIS (during reprojection or other procedures?).