Esri / military-tools-geoprocessing-toolbox

military-tools-geoprocessing-toolbox is a collection of models, scripts, and tools for use in ArcGIS for Desktop and ArcGIS Pro. This toolbox is one component that is a part of Military Tools.
Apache License 2.0
33 stars 14 forks source link

GRG From Area tool gives unexpected results when Cell Width not equal to Cell Height #344

Closed BobBooth closed 6 years ago

BobBooth commented 6 years ago

Create GRG From Area tool is giving unexpected (incorrect) results when run with unequal cell width and cell height. It happens with feature class/shapefile AOI input and feature set AOI input. For example, given the input area GRG_AOI_WM, and a Cell Width of 50 and Cell Height of 100, you get a GRG that is twice as high and half as wide as it needs to be to cover the input AOI. image The problem also happens in ArcMap (tested in 10.3.1). image

Expected Behavior

For unequal Cell Width and Cell Height I would expect the GRG to completely cover the AOI in cells of that height/width combination.

Current Behavior

If you run the tool with an input AOI and a cell height twice the cell width, you get a GRG that is twice as long high as the input AOI and half as wide. If you reverse them, you get a GRG that is twice as wide but half as high. image

Possible Solution

It seems as though the calculation for the extent of the input area is being affected by the differing cell sizes. @kgonzago - I think we saw something like this with the widget?

Steps to Reproduce (for bugs)

  1. Run the Create GRG From Area tool from Military Tools.pyt
  2. Use a polygon as input digitize a polygon in a feature set or use a feature class/shapeefile (GRG_AOI_WM in the test catalog works).
  3. Set the Cell Width to 100
  4. Set the Cell Height to 50
  5. Accept other defaults and run the tool.

Context

incorrect results

Your Environment

Military Tools Geoprocessing Toolbox dev branch Incorrect behavior in ArcMap 10.3.1 and Pro 2.1

BobBooth commented 6 years ago

Same issue appears in ArcMap 10.4.1

kgonzago commented 6 years ago

With some help from @mfunk, a fix for this issue is in this PR.

BobBooth commented 6 years ago

Testing this for @kgonzago - I am finding that if you use an input feature class for your AOI for the GRG from Area and the feature class is WGS84 Geographic, you still get the unexpected result of having a gigantic single grid cell output. I suspect it is treating the input units of measure as linear units and making the grid cells 100 degrees x 50 degrees. You get a single output cell with A1 label, if you use default values. I know that is technically this issue: https://github.com/Esri/military-tools-geoprocessing-toolbox/issues/343 - but the PR mentioned the Output spatial reference of GRG too, so I thought I'd check.

topowright-zz commented 6 years ago

I have tested this in ArcMap 10.6.1 and ArcGIS Pro 2.2 and I no longer see an issue with building a GRG from Area that has unequal areas for height and width.