Open jdduh opened 6 years ago
It is no problem to set the layout projection to Albers before adding the reference layers. I will do this. I also took a closer look at the subroutine that sets the default projection for multiple BAGIS functions (BA_SetDefaultProjection). This subroutine does check to ensure the current layout datum matches the Albers datum. I don't clearly remember why we did this, but I think we should leave it in place. I think that reprojecting layers between certain datum combinations required a transformation and this matrix was too complex to code into BAGIS.
However BA_SetDefaultProjection() is a subroutine and not a function, so if there is a problem with the reprojection, there is no way for the caller to tell. It just flashes the error message and continues to process. Hence issue #59. I will change this suboutine to a function that returns an error code. If an error is returned, we will instruct the user to either open a new map document or restart ArcMap to allow BAGIS to cleanly set the datum and projection. If there is a better way to do this, let me know.
I guess we could potentially remove all the layers from the current dataframe and force the reprojection. The underlying problem we are trying to avoid is a potential error if the layers in the original projection are re-projected incorrectly because they have a different datum.
This is done for BAGIS V3, BAGIS-H, and BAGIS-P. I implemented code in all the applications to catch the error thrown by BA_SetDefaultProjection() and stop processing if it fails. If we want to change the way we handle a datum mismatch, we can do it on one place: BA_SetDefaultProjection(). Currently the error message tells the analyst to open a new map document and try again. This is ready to be deployed in the next version of BAGIS.
We should consider relaxing the projection handling routine in future releases to allow BAGIS executions even when the data are not in the NWCC-preferred projection.
My only suggestion with this is to make it a warning rather than a hard stop. It is impossible to allow all projections and know whether they are compatible with the projection of the current map frame. If we agree this is the best approach, let's add the screens to this issue that need to have this change.
Got this error message when displaying the webservice "reference layers" before selecting a BASIN. If the Basin Analyst map layout is set to Albers projection first, then this error message won't show up. Is there a way to set the layout projection to Albers before adding the reference layers? This is a low priority request.