diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..1f1c17d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,32 @@ + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. +4. + +## Context + + + +## Your Environment + +* Version used: +* Environment name and version (e.g. Chrome 39, node.js 5.4): +* Operating System and version (desktop or mobile): +* Link to your project: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..92a4f6ad --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ + + +## Description + + +## Related Issue + + + + + +## Motivation and Context + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have read the **CONTRIBUTING** document. diff --git a/.gitignore b/.gitignore index f177f6e5..816ebcf6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ application/ data/ maps/ scratch/ +log/ arc.dir #*.pyt.xml -- We cannot ignore these files... these are documentation *.zip @@ -13,6 +14,7 @@ arc.dir *-sav *-sav.* *Copy.* +*.log ############# ## Python diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 084f8d1f..d3c62aba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1,54 @@ -Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). \ No newline at end of file +Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). + +## How you can contribute code to this repository + +### Make a new branch in the repo +Start contributing to the *solutions-geoprocessing-toolbox* repo by making a branch. Make a new branch from **dev** on github.com: + +Select the **dev** drop down +Type a new branch name. The convention uses your initials and a title separated by dashes "-". For example: *xy-new-suitabilty-tool* + +![Create new branch](./img/CreateNewBranchDialogScreenshot.png) + +*Fetch* and *merge* the new branch from the **Esri** remote: [Getting Changes from the repo](#getting-changes-from-the-repo). + +Then checkout your new branch: + +`git checkout ` + + +### Getting Changes from the repo +The solutions-geoprocessing-toolbox repo changes without notice, so make sure you are getting the latest updates often. + +Using git command line check your *remote*: + +`> git remote -v` + +This command should return a list of remotes including: + +`Esri https://github.com/Esri/solutions-geoprocessing-toolbox.git (fetch)` +`Esri https://github.com/Esri/solutions-geoprocessing-toolbox.git (push)` + +Then *fetch* the changes from the Esri remote: + +`> git fetch Esri` + +And *merge* the changes into the target branch: + +`> git merge Esri/` + +This will get your new branch from the repo. + +### Share Your Mods +If you've made changes to the repo that you want to share with the community. + +* Commit your changes +* Sync local with your remote +* Make a **Pull Request** from your remote fork on github.com ![New Pull Request](./img/NewPullRequestButtonIcon.png) + + +### Notes On Contributing +* Always work in the **dev** branch, never in *master*. This helps us keep our releases clean. +* Never merge Pull Requests. The [Repository Owner](#repository-owner) needs to test any updates to make sure the repo is stable. +* Always log an [Issue](https://github.com/Esri/solutions-geoprocessing-toolbox/issues) for problems you find, though you should check through the existing issues to make sure it wasn't already logged. + diff --git a/CloneInDesktopButtonIcon.png b/CloneInDesktopButtonIcon.png deleted file mode 100644 index 404bd1d4..00000000 Binary files a/CloneInDesktopButtonIcon.png and /dev/null differ diff --git a/ForkButtonIcon.png b/ForkButtonIcon.png deleted file mode 100644 index 2c624ca9..00000000 Binary files a/ForkButtonIcon.png and /dev/null differ diff --git a/README.md b/README.md index f2ead78f..ba961623 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,19 @@ -[![Planned Issues](https://badge.waffle.io/Esri/solutions-geoprocessing-toolbox.png?label=0%20-%20backlog&title=In%20Backlog)](https://waffle.io/Esri/solutions-geoprocessing-toolbox) -[![Issues in Progress](https://badge.waffle.io/Esri/solutions-geoprocessing-toolbox.png?label=2%20-%20In%20Progress&title=In%20Progress)](https://waffle.io/Esri/solutions-geoprocessing-toolbox) -[![Issues waiting for Verification](https://badge.waffle.io/Esri/solutions-geoprocessing-toolbox.png?label=3%20-%20Verify&title=For%20Verification)](https://waffle.io/Esri/solutions-geoprocessing-toolbox) -[![Code Climate](https://codeclimate.com/github/Esri/solutions-geoprocessing-toolbox/badges/gpa.svg)](https://codeclimate.com/github/Esri/solutions-geoprocessing-toolbox) + # solutions-geoprocessing-toolbox The ArcGIS Solutions Geoprocessing Toolbox is a collection of models, scripts, and tools for use in [ArcGIS for Desktop](http://www.esri.com/software/arcgis/arcgis-for-desktop) and [ArcGIS Pro](http://www.esri.com/en/software/arcgis-pro). These tools provide specialized processing, workflows, and analysis for defense, intelligence, emergency management, and other solutions domains. With these tools you can determine visibility from a specific viewpoint, create search grids, and analyze event data. They are included with many of Esri's [Solutions Templates](http://solutions.arcgis.com/), but developers can use this repository to download and contribute to the tool development process. -![Image of the toolbox](solutions-geoprocessing-toolbox-thumbnail007.png) +![Image of the toolbox](./img/solutions-geoprocessing-toolbox_screenshot_14APR2016_824x400.png) -###Repository Owner: [Matt](https://github.com/mfunk) +### Repository Owner: [Matt](https://github.com/mfunk) * Merge Pull Requests * Creates Releases and Tags * Manages Milestones * Manages and Assigns Issues -###Secondary: [Chris](https://github.com/csmoore) +### Secondary: [Chris](https://github.com/csmoore) * Backup when the Owner is away @@ -32,6 +29,7 @@ Additional information is available in the repository's [Wiki](https://github.co * [Getting Started with the tools](#getting-started-with-the-tools) * [Downloading Test Data](#downloading-test-data) * [Running Verification Tests](#running-verification-tests) +* [Mature Support](#mature-support) * [Resources](#resources) * [Issues](#issues) * [Contributing](#contributing) @@ -40,31 +38,28 @@ Additional information is available in the repository's [Wiki](https://github.co ## Features -* Specialized geoprocessing models and tools for general defense and intelligence analysis tasks including - * Tools for visibility and range analysis - * Tools for analyzing the battlefield environment - * Tools for data management and coordinates - +Specialized geoprocessing models and tools for general defense and intelligence analysis tasks including: + * The [**capability**](./capability/README.md) folder contains: * ERG (Emergency Resources Guide) Tools * Helicopter Landing Zone Tools - * Point Of Origin Tools + * Point Of Origin Tools -- [This tool is moving to Mature Support](#mature-support) * The [**data_management**](./data_management/README.md) folder contains: * Adjust Sample Data Dates Tools - * CADRG ECRG Tools - * CIB Tools - * Elevation Tools + * CADRG ECRG Tools -- [This tool is moving to Mature Support](#mature-support) + * CIB Tools -- [This tool is moving to Mature Support](#mature-support) + * Elevation Tools -- [This tool is moving to Mature Support](#mature-support) * Geonames Tools - * Import and Conversion Tools - formerly Position Analysis Tools + * Import and Conversion Tools - formerly Position Analysis Tools -- [This tool is moving to Mature Support](#mature-support) * LiDAR Elevation Tools - * Network Data Preparation Tools - * Patrol Data Capture Tools - * Publishable Task Tools + * Network Data Preparation Tools -- [This tool is moving to Mature Support](#mature-support) + * Patrol Data Capture Tools -- [This tool is moving to Mature Support](#mature-support) + * Publishable Task Tools -- [This tool is moving to Mature Support](#mature-support) * The [**operational_graphics**](./operational_graphics/README.md) folder contains: * Clearing Operations Tools - * Range Card Tools + * Range Card Tools -- [This tool is moving to Mature Support](#mature-support) * The [**patterns**](./patterns/README.md) folder contains: * Incident Analysis Tools @@ -85,8 +80,6 @@ Additional information is available in the repository's [Wiki](https://github.co * ArcGIS Desktop 10.4+ or ArcGIS Pro 1.1+ * Check [Releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases) for tools for previous versions of ArcGIS Desktop -* Apache Ant - used to download and extract dependent data and run test drivers -* Java Runtime Environment (JRE) or Developer Kit (JDK) (required by Ant) * Some tools require additional licenses (these tools will be disabled if license is unavailable), see READMEs for more information: * ArcGIS Desktop Advanced (ArcInfo) * ArcGIS Spatial Analyst Extension @@ -104,7 +97,8 @@ backwards compatible with other ArcGIS Desktop applications (ArcMap), so most to * Toolboxes that are for ArcGIS Desktop 10.4 will include *_10.4* after the toolbox name. For example: **Visibility and Range Tools_10.4.tbx** * Toolboxes with a 'unversioned' name are for ArcGIS Pro 1.1. For example: **Visibility and Range Tools.tbx** -Please note that some toolboxes are for ArcGIS Pro only, or ArcGIS Desktop 10.3 only. These toolboxes will follow the above naming convention, but will not have a duplicate. + +Please note that some toolboxes are for ArcGIS Pro only, or ArcGIS Desktop 10.4 only. These toolboxes will follow the above naming convention, but will not have a duplicate. * [Product info for ArcGIS Pro](http://www.esri.com/software/arcgis-pro) * [Help for ArcGIS Pro](http://pro.arcgis.com/en/pro-app/) @@ -122,28 +116,23 @@ Please note that some toolboxes are for ArcGIS Pro only, or ArcGIS Desktop 10.3 * Download the Github repository * If repository was downloaded as a zip, extract the zip file * Make note of this directory, the steps below assume it will be called "solutions-geoprocessing-toolbox" + * Open the toolboxes in the appropriate version of ArcMap or ArcGIS Pro listed in [requirements](#requirements). + * Questions about the tools? Start by reading the tool doc. + * Tool doc doesn't make sense? Please log an [issue](https://github.com/Esri/solutions-geoprocessing-toolbox/issues) and let us know! ### Downloading Test Data -* Install and configure Apache Ant - * Download Ant from the [Apache Ant Project](http://ant.apache.org/bindownload.cgi) and unzip to a location on your machine, for example 'c:\apache-ant-1.9.2'. - * Set environment variable `ANT_HOME` to Ant Install Location (e.g. the folder from first step) - * Add Ant\bin to your path: `%ANT_HOME%\bin` - * NOTE: Ant requires Java [Runtime Environment (JRE) or Developer Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) to be installed and the environment variable `JAVA_HOME` to be set to this location - * To verify your Ant Installation: Open Command Prompt> `ant -h` and verify it runs and returns the help options correctly - * You may optionally install the [PyDev Eclipse Plugin for Python](http://pydev.org) if you plan to use Eclipse to run/debug -* To download the data dependencies - * Open Command Prompt> - * `cd solutions-geoprocessing-toolbox` - * `> ant` - * Verify “Build Succeeded” +**This section is under reconstruction, per issue [#371](https://github.com/Esri/solutions-geoprocessing-toolbox/issues/371)** ### Running Verification Tests -**This section is under reconstruction, per issue [#371](https://github.com/Esri/solutions-geoprocessing-toolbox/issues/371)** +- Follow instructions in [Running tests for solutions-geoprocessing-toolbox](.utils/test/Readme.md) -## Resources +## Mature Support +For information Esri support levels visit the [Esri Product Life Cycle](http://support.esri.com/other-resources/product-life-cycle) page. Toolboxes marked for Mature Support will be removed from this repository's *dev* and *master* branches in the future, but will still be availalbe from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). +## Resources +* [GitHub Help](https://help.github.com/) * Learn more about [ArcGIS Solutions](http://solutions.arcgis.com/). * Learn more about [ArcGIS for the Military](http://solutions.arcgis.com/military/). * Learn more about [ArcGIS for Intelligence](http://solutions.arcgis.com/intelligence/). @@ -152,56 +141,20 @@ Please note that some toolboxes are for ArcGIS Pro only, or ArcGIS Desktop 10.3 ## Issues -* Find a bug or want to request a new feature? Please let us know by submitting an issue. - -## Contributing - -Esri welcomes contributions from anyone and everyone through GitHub. Please see Esri's [guidelines for contributing](https://github.com/esri/contributing). - -When you contribute to this repository we ask that you follow the guidelines below. If you've got questions, or you get stuck, please ask the [Repository Owner](#repository-owner). We are here to help! Thanks. - -### Fork and Clone the Repo -Start contributing to the solutions-geoprocessing-toolbox repo by making a fork and cloning it to your local machine. +Find a bug or want to request a new feature? Please let us know by submitting an [issue](https://github.com/Esri/solutions-geoprocessing-toolbox/issues). -* Fork the **dev** branch from the repo on github.com with ![fork button](ForkButtonIcon.png) -* Clone your remote onto your local system ![clone button](CloneInDesktopButtonIcon.png) -* Get the *mdcs-py* submodule: - * `> git submodule init` - * `> git submodule update` +To submit an issue: -### Set Your Upstream -Setting the parent repo to get changes from. +1. Go to the [issue](https://github.com/Esri/solutions-geoprocessing-toolbox/issues) tab +2. Click **New Issue** +3. Fill out *all* of the relevant sections +4. **Submit new issue** when completed -* `> git remote -v` - -if no *upstream* is listed continue with: - -* `> git remote add upstream https://github.com/Esri/solutions-geoprocessing-toolbox` -* `> git remote set-url upstream --push no_push` - -check that an *upstream* is registered: - -* `> git remote -v` - -### Getting Changes from Upstream -The solutions-geoprocessing-toolbox repo changes often, so make sure you are getting the latest updates often. - -* `> git fetch upstream` -* `> git merge upstream/dev` -* - -### Share Your Mods -If you've made changes to the repo that you want to share with the community. - -* Commit your changes to your local -* Sync local with your remote fork -* Make a **Pull Request** from your remote fork on github.com ![New Pull Request](NewPullRequestButtonIcon.png) +## Contributing +When you contribute to this repository we ask that you follow the guidelines in the [repository-specific guidelines for contributing](./CONTRIBUTING.md). If you have questions, or you get stuck, please ask the [Repository Owner](#repository-owner). We are here to help! Thanks. -### Notes On Contributing -* Always work in the **dev** branch, never in *master*. This helps us keep our releases clean. -* Never merge Pull Requests. The [Repository Owner](#repository-owner) needs to test any updates to make sure the repo is stable. -* Always log an [Issue](https://github.com/Esri/solutions-geoprocessing-toolbox/issues) for problems you find, though you should check through the existing issues to make sure it wasn't already logged. +Esri welcomes contributions from anyone and everyone through GitHub. Please see Esri's general [guidelines for contributing](https://github.com/esri/contributing). ## Credits @@ -209,13 +162,13 @@ Mosaic Dataset Configuration Scripts (MDCS) is an Esri repo available at [https: ## Licensing -Copyright 2015 Esri +Copyright 2016 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -You may obtain a copy of the License at +You may obtain a copy of the License at: - http://www.apache.org/licenses/LICENSE-2.0 +[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/ScreenShot.jpg b/ScreenShot.jpg deleted file mode 100644 index 6d1b1c21..00000000 Binary files a/ScreenShot.jpg and /dev/null differ diff --git a/SolutionsGeoprocessingToolboxGraphic.png b/SolutionsGeoprocessingToolboxGraphic.png deleted file mode 100644 index dba792bf..00000000 Binary files a/SolutionsGeoprocessingToolboxGraphic.png and /dev/null differ diff --git a/build.xml b/build.xml deleted file mode 100644 index 94de1617..00000000 --- a/build.xml +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/capability/README.md b/capability/README.md index d0f1fd12..27fa7568 100644 --- a/capability/README.md +++ b/capability/README.md @@ -23,6 +23,7 @@ Tools in toolbox: ## Helicopter Landing Zone Tools Tool for finding touchdown points within a helicopter landing zone. +Supports the [Helicopter Landing Zone](http://solutions.arcgis.com/defense/templates/hlz/) template. The Helicopter Landing Zone Tools is associated with the [Helicopter Landing Zone](http://www.arcgis.com/home/item.html?id=384d223647b24bcf9d2c6fd44f90d17f) template @@ -32,6 +33,8 @@ Tools in toolbox: ## Point Of Origin Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + Tool for finding possible locations of firing position from point of impact. Tools in toolbox: @@ -43,7 +46,7 @@ Find a bug or want to request a new feature? Please let us know by submitting a ## Licensing -Copyright 2014 Esri +Copyright 2016 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/capability/test/build.xml b/capability/test/build.xml deleted file mode 100644 index 543b1937..00000000 --- a/capability/test/build.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/capability/test/test_erg_tools/TemplateConfigTest.py b/capability/test/test_erg_tools/TemplateConfigTest.py deleted file mode 100644 index c9e6c1a6..00000000 --- a/capability/test/test_erg_tools/TemplateConfigTest.py +++ /dev/null @@ -1,87 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print "Testing ArcPy" - arcpy.AddMessage("ArcPy works") - - print "Testing Necessary Paths" - - print "Running from: " + str(TestUtilities.currentPath) - - paths2Check = [] - paths2Check.extend([TestUtilities.toolboxesPath, TestUtilities.toolDataPath, TestUtilities.layerPath, TestUtilities.layerDataPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print "Valid Path: " + path2check - else : - print "ERROR: Necessary Path not found: " + path2check - raise Exception('Bad Path') - - print "Testing Necessary Geo Objects" - - objects2Check = [] - objects2Check.extend([TestUtilities.templateGDB, TestUtilities.toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print "--> Invalid Object: " + str(object2Check) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print "Valid Object: " + desc.Name - - print "Test Successful" - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print msgs - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print pymsg + "\n" - print msgs - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/capability/test/test_erg_tools/TestERGTools.py b/capability/test/test_erg_tools/TestERGTools.py deleted file mode 100644 index f69ccbc4..00000000 --- a/capability/test/test_erg_tools/TestERGTools.py +++ /dev/null @@ -1,153 +0,0 @@ - -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ---------------------------------------------------------------------------- -# TestERGTools.py -# Description: Test ERG Tools Toolbox -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- -# history: -# 4/2/2015 - mf - updates for coding standards and making tests as modules -# ================================================== - - - -import arcpy -import sys -import traceback -import TestUtilities -import os - - -class LicenseError(Exception): - pass - - -def testERGByChemical(inFS, inMatTy, inWB, inDN, inLS, outAreas, outLines): - '''Testing ERG By Chemical''' - arcpy.AddMessage("Starting Test: ERG Tools - ERG By Chemical") - arcpy.ERGByChemical_erg(inFS, inMatTy, inWB, inDN, inLS, outAreas, outLines) - return [outAreas, outLines] - - -def testERGByPlacard(inFS, inPID, inWB, inDN, inLS, outAreas, outLines): - '''Testing ERG By Chemical''' - arcpy.AddMessage("Starting Test: ERG Tools - ERG By Placard") - arcpy.ERGByPlacard_erg(inFS, inPID, inWB, inDN, inLS, outAreas, outLines) - return [outAreas, outLines] - - -def main(): - ''' Tool main code ''' - try: - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - # Set tool param variables - inPoint = arcpy.Point(77.0, 38.9) - inWGS84Point = arcpy.PointGeometry(inPoint) - sr = arcpy.SpatialReference(4326) - inWGS84Point.spatial_reference = sr - # create an in_memory feature class to initially contain the input point - fc = arcpy.CreateFeatureclass_management("in_memory", "tempfc", "POINT", - None, "DISABLED", "DISABLED", - sr)[0] - # open and insert cursor - with arcpy.da.InsertCursor(fc, ["SHAPE@"]) as cursor: - cursor.insertRow([inWGS84Point]) - # create a featureset object and load the fc - inputFeatureSet = arcpy.FeatureSet() - inputFeatureSet.load(fc) - # set the remaining tool parameters - inputMaterialType = "Allylamine" - inputPlacardID = 1560 - inputWindBearing = 10 - inputDayOrNight = "Day" - inputLargeOrSmall = "Large" - outputERGAreas = os.path.join(arcpy.env.scratchGDB, "ERGAreas") - outputERGLines = os.path.join(arcpy.env.scratchGDB, "ERGLines") - - # Testing ERG By Chemical - outputERGAreas, outputERGLines = testERGByChemical(inputFeatureSet, - inputMaterialType, - inputWindBearing, - inputDayOrNight, - inputLargeOrSmall, - outputERGAreas, - outputERGLines) - - # Verify Results - countAreas = int(arcpy.GetCount_management(outputERGAreas).getOutput(0)) - print("ERG Area count: " + str(countAreas)) - countLines = int(arcpy.GetCount_management(outputERGLines).getOutput(0)) - print("ERG Line count: " + str(countLines)) - if (countAreas != 3) or (countLines != 3): - print("Invalid output count (there should be 3 areas and 3 lines)!") - raise Exception("Test Failed") - print("Test Passed") - - # Testing ERG By Placard - outputERGAreas, outputERGLines = testERGByPlacard(inputFeatureSet, - inputPlacardID, - inputWindBearing, - inputDayOrNight, - inputLargeOrSmall, - outputERGAreas, - outputERGLines) - - # Verify Results - countAreas = int(arcpy.GetCount_management(outputERGAreas).getOutput(0)) - print("ERG Area count: " + str(countAreas)) - countLines = int(arcpy.GetCount_management(outputERGLines).getOutput(0)) - print("ERG Line count: " + str(countLines)) - if (countAreas != 3) or (countLines != 3): - print("Invalid output count (there should be 3 areas and 3 lines)!") - raise Exception("Test Failed") - print("Test Passed") - - except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - - except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = ("PYTHON ERRORS:\nTraceback info:\n" + tbinfo + - "\nError Info:\n" + str(sys.exc_info()[1])) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - - -# MAIN ============================================= -if __name__ == "__main__": - main() diff --git a/capability/test/test_erg_tools/TestUtilities.py b/capability/test/test_erg_tools/TestUtilities.py deleted file mode 100644 index b48cb8e6..00000000 --- a/capability/test/test_erg_tools/TestUtilities.py +++ /dev/null @@ -1,32 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys - -currentPath = os.path.dirname(__file__) -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../capability/toolboxes/")) - -toolDataPath = os.path.join(toolboxesPath, "tooldata") -layerPath = os.path.join(toolboxesPath, "layers") -layerDataPath = os.path.join(layerPath, "layerdata") -templateGDB = os.path.join(toolDataPath, "Templates.gdb") - -toolbox = os.path.join(toolboxesPath, "ERG Tools.pyt") \ No newline at end of file diff --git a/capability/test/test_erg_tools/build.xml b/capability/test/test_erg_tools/build.xml deleted file mode 100644 index 56393bb9..00000000 --- a/capability/test/test_erg_tools/build.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/capability/test/test_hlz_tools/HLZTouchdownPointsTestCase.py b/capability/test/test_hlz_tools/HLZTouchdownPointsTestCase.py deleted file mode 100644 index 259d5a88..00000000 --- a/capability/test/test_hlz_tools/HLZTouchdownPointsTestCase.py +++ /dev/null @@ -1,305 +0,0 @@ -# coding: utf-8 -''' ------------------------------------------------------------------------------ -Copyright 2015 Esri -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. ------------------------------------------------------------------------------ - -================================================== -HLZTouchdownPointsTestCase.py --------------------------------------------------- -requirements: -author: ArcGIS Solutions -company: Esri -================================================== -Description: Unit test for the HLZ Touchdown Points tool and also the supporing tools: -Choose Field Value Script Tool, and MinimumBoundingFishnet. - -Includes the following tests: -* test_MinimumBoundingFishnet -* test_Choose_Field_Value_Script_Tool -* test_HLZ_Touchdown_Points_001 -* test_HLZ_Touchdown_Points_002 - -================================================== -history: -9/24/2015 - 10/19/2015 - MF - original test writeup -10/21/2015 - MF - removed 10.x/1.x split between test cases -================================================== -''' - -import logging -import arcpy -import sys -import traceback -import datetime -import os -import unittest -import TestUtilities -import UnitTestUtilities -import UnitTestCase - -class HLZTouchdownPoints(UnitTestCase.UnitTestCase): - ''' Test all tools and methods related to the HLZ Touchdown Points tool - in the Helicopter Landing Zones toolbox''' - - scratchGDB = None - tbxProFolderPath = r"../../../capability/toolboxes/Helicopter Landing Zone Tools.tbx" - tbxDesktopFolderPath = r"../../../capability/toolboxes/Helicopter Landing Zone Tools_10.3.tbx" - - def setUp(self, platform): - ''' set-up code ''' - - try: - # Set up paths - self.testDataFolderPath = r"../../../capability/data/geodatabases/" - - UnitTestUtilities.checkFilePaths([self.testDataFolderPath, tbxFolderPath]) - - #TODO: Where is the test data? Does the test data exist? - self.testDataGeodatabase = os.path.join(self.testDataFolderPath, r"test_hlz_tools.gdb") - - # Check the test inputs (do they exist? or not?) - if not arcpy.Exists(self.scratchGDB): - self.scratchGDB = UnitTestUtilities.createScratch(testDataFolderPath) - - # Set up the toolbox - - - # Setup the test inputs - self.inputAirframeTable = os.path.join(self.testDataGeodatabase, r"Aircraft_Specifications") - self.inputSuitableAreas = os.path.join(self.testDataGeodatabase, r"HLZSelectionArea") - self.inputSlope = os.path.join(self.testDataGeodatabase, r"SRTMPctSlope") - self.outputGeodatabase = os.path.join(self.scratchGDB) - self.outputCenterpoints = os.path.join(self.outputGeodatabase, r"centerPoints") - self.outputCircles = os.path.join(self.outputGeodatabase, r"tdCircles") - - UnitTestUtilities.checkGeoObjects([self.testDataGeodatabase, - self.toolbox, - self.inputAirframeTable, - self.inputSuitableAreas]) - except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n"\ - + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - #TODO: need to add 'msgs' and 'pymsg' to logger - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - def tearDown(self): - ''' clean up after tests''' - UnitTestUtilities.deleteScratch(self.scratchGDB) - - def test_MinimumBoundingFishnet_Pro(self): - self.test_MinimumBoundingFishnet(self.tbxProFolderPath) - - def test_MinimumBoundingFishnet_Desktop(self): - self.test_MinimumBoundingFishnet(self.tbxDesktopFolderPath) - - def test_MinimumBoundingFishnet(self, tbxFolderPath): - ''' Test the supporting script tool ''' - try: - #TODO: Finish writing a test - print("test_MinimumBoundingFishnet") - outputFishnet = os.path.join(self.scratchGDB, "outputFishnet") - toolbox = arcpy.ImportToolbox(tbxFolderPath, "tdpoints") - - arcpy.MinimumBoundingFishnet_tdPoints(self.inputSuitableAreas, outputFishnet) - countOutputFishnet = arcpy.GetCount_management(os.path.join(self.outputGeodatabase, outputFishnet)).getOutput(0) - self.assertEqual(countOutputFishnet, float(1)) - - except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - #TODO: need to add 'msgs' to logger - print(msgs) - - except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n"\ - + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - #TODO: need to add 'msgs' and 'pymsg' to logger - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - def test_Choose_Field_Value_Script_Tool_Pro(self): - self.test_MinimumBoundingFishnet(self.tbxProFolderPath) - - def test_Choose_Field_Value_Script_Tool_Desktop(self): - self.test_MinimumBoundingFishnet(self.tbxDesktopFolderPath) - - def test_Choose_Field_Value_Script_Tool(self): - ''' test the supporting script tool ''' - try: - #TODO: write a test - print("test_Choose_Field_Value_Script_Tool") - inputField = r"Model" - inputChoice = r"UH-60" - result = arcpy.ChooseFieldValueScriptTool_tdpoints(self.inputAirframeTable,inputField,inputChoice) - - # compare results - self.assertEqual(result,inputChoice) - - except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - #TODO: need to add 'msgs' to logger - print(msgs) - - except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n"\ - + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - #TODO: need to add 'msgs' and 'pymsg' to logger - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - def test_HLZ_Touchdown_Points_001(self): - ''' This is a basic test of the HLZ Touchdown tool with all of the input defined. ''' - try: - print("test_HLZ_Touchdown_Points_001") - # move TestSunPositionAndHillshade code in here - print("Importing toolbox... ") - arcpy.ImportToolbox(TestUtilities.toolbox, "tdpoints") - arcpy.env.overwriteOutput = True - - # Inputs - print("Setting up inputs... ") - inputAirframeString = r"UH-60" - - # Testing - print("Running tool (HLZ Touchdown Points) ...") - arcpy.HLZTouchdownPoints_tdpoints(self.inputAirframeTable, - inputAirframeString, - self.inputSuitableAreas, - self.inputSlope, - self.outputGeodatabase, - self.outputCenterpoints, - self.outputCircles) - - print("Comparing expected results...") - # count output center points - countCenterPoints = arcpy.GetCount_management(os.path.join(self.outputGeodatabase, self.outputCenterpoints)).getOutput(0) - # count output circles - countOutputCircles = arcpy.GetCount_management(os.path.join(self.outputGeodatabase, self.outputCircles)).getOutput(0) - #TODO: make sure center points fall within circles - self.assertEqual(countCenterPoints, float(934)) - self.assertEqual(countOutputCircles, float(934)) - - except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - #TODO: need to add 'msgs' to logger - print(msgs) - - except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n"\ - + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - #TODO: need to add 'msgs' and 'pymsg' to logger - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - def test_HLZ_Touchdown_Points_002(self): - ''' This test is for some of the default values in the HLZ Touchdown tool. ''' - try: - arcpy.AddMessage("test_HLZ_Touchdown_Points_002") - # move TestSunPositionAndHillshade code in here - print("Importing toolbox... ") - arcpy.ImportToolbox(TestUtilities.toolbox, "tdpoints") - arcpy.env.overwriteOutput = True - - # Inputs - print("Setting up inputs... ") - inputAirframeTable = "#" - inputAirframeString = "#" - inputSuitableAreas = self.inputSuitableAreas - inputSlope = self.inputSlope - outputGeodatabase = self.outputGeodatabase - outputCenterpoints = "#" - outputCircles = "#" - - # Testing - print("Running tool (HLZ Touchdown Points) ...") - arcpy.HLZTouchdownPoints_tdpoints(inputAirframeTable, - inputAirframeString, - inputSuitableAreas, - inputSlope, - outputGeodatabase, - outputCenterpoints, - outputCircles) - - print("Comparing expected results...") - # count output center points - countCenterPoints = arcpy.GetCount_management(os.path.join(self.outputGeodatabase, self.outputCenterpoints)).getOutput(0) - # count output circles - countOutputCircles = arcpy.GetCount_management(os.path.join(self.outputGeodatabase, self.outputCircles)).getOutput(0) - - self.assertEqual(countCenterPoints, float(934)) - self.assertEqual(countOutputCircles, float(934)) - - #TODO: make sure center points fall within circles - - except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - #TODO: need to add 'msgs' to logger - print(msgs) - - except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n"\ - + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - #TODO: need to add 'msgs' and 'pymsg' to logger - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) diff --git a/capability/test/test_hlz_tools/HelicopterLandingZoneTestSuiteDesktop.py b/capability/test/test_hlz_tools/HelicopterLandingZoneTestSuiteDesktop.py deleted file mode 100644 index b83180e6..00000000 --- a/capability/test/test_hlz_tools/HelicopterLandingZoneTestSuiteDesktop.py +++ /dev/null @@ -1,76 +0,0 @@ -# coding: utf-8 -''' ------------------------------------------------------------------------------ -Copyright 2015 Esri -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. ------------------------------------------------------------------------------ - -================================================== -HelicopterLandingZoneTestSuiteDesktop.py --------------------------------------------------- -requirments: ArcGIS 10.X, Python 2.7 -author: ArcGIS Solutions -company: Esri -================================================== -description: This test suite runs the HLZ tools in Desktop -using the 10.x version of the toolbox. -================================================== -history: - - - -================================================== -''' - -import os -import sys -import datetime -import logging -import unittest -import TestUtilities -import UnitTestUtilities -import HLZTouchdownPointsTestCase - - -class HelicopterLandingZoneTestSuite(unittest.TestSuite): - ''' Test suite for all tools in the Helicopter Landing Zone Tools toolbox ''' - - - def runProTests(self, suite): - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_Choose_Field_Value_Script_Tool_Pro')) - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_MinimumBoundingFishnet_Pro')) - return suite - - def runDesktopTests(self, suite): - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_HLZ_Touchdown_Points_001')) - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_HLZ_Touchdown_Points_002')) - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_Choose_Field_Value_Script_Tool_Desktop')) - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_MinimumBoundingFishnet_Desktop')) - return suite - - def runHLZTestSuite(self, testSuite, platform): - ''' run the HLZ tests in Desktop''' - result = unittest.TestResult() - sunPosPath = os.path.normpath(os.path.join(TestUtilities.currentPath, r"../../capability/test/test_hlz_tools/")) - if sunPosPath not in sys.path: - sys.path.insert(0, sunPosPath) - - from HLZTouchdownPointsTestCase import HLZTouchdownPoints - - if platform == "PRO": - self.runProTests(testSuite) - else: - self.runDesktopTests(testSuite) - - testSuite.run(result) - print("Test success: {0}".format(str(result.wasSuccessful()))) - - return result diff --git a/capability/test/test_hlz_tools/HelicopterLandingZonesTestSuitePro.py b/capability/test/test_hlz_tools/HelicopterLandingZonesTestSuitePro.py deleted file mode 100644 index 2370d033..00000000 --- a/capability/test/test_hlz_tools/HelicopterLandingZonesTestSuitePro.py +++ /dev/null @@ -1,89 +0,0 @@ -# coding: utf-8 -''' ------------------------------------------------------------------------------ -Copyright 2015 Esri -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. ------------------------------------------------------------------------------ - -================================================== -HelicopterLandingZonesTestSuitePro.py --------------------------------------------------- -requirments: ArcGIS 1.X, Python 3.4 -author: ArcGIS Solutions -company: Esri -================================================== -description: This test suite runs the HLZ tools in ArcGIS Pro -using the 1.x version of the toolbox. -================================================== -history: - - - -================================================== -''' - -import os -import sys -import datetime -import logging -import unittest -import TestUtilities -import UnitTestUtilities -import HLZTouchdownPointsTestCase - - -class HelicopterLandingZoneTestSuiteDesktop(unittest.TestSuite): - ''' Test suite for all HLZ test for Desktop ''' - def addHLZTouchdownPoints001(self, suite): - ''' add the test_HLZ_Touchdown_Points_001 test to the test suite''' - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_HLZ_Touchdown_Points_001')) - return suite - - def addHLZTouchdownPoints002(self, suite): - ''' add the test_HLZ_Touchdown_Points_002 test to the test suite''' - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_HLZ_Touchdown_Points_002')) - return suite - - def addChooseFieldValueScriptTool(self, suite): - ''' add the test_Choose_Field_Value_Script_Tool test to the test suite''' - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_Choose_Field_Value_Script_Tool')) - return suite - - def addMinimumBoundingFishnet(self, suite): - ''' add the test_MinimumBoundingFishnet test to the test suite''' - suite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints('test_MinimumBoundingFishnet')) - return suite - - def runHLZTestSuite(self, testSuite, logger): - ''' run the HLZ tests in Desktop''' - result = unittest.TestResult() - sunPosPath = os.path.normpath(os.path.join(TestUtilities.currentPath, r"../../capability/test/test_hlz_tools/")) - if sunPosPath not in sys.path: - sys.path.insert(0, sunPosPath) - from HLZTouchdownPointsTestCase import HLZTouchdownPoints - tbxFolderPath = r"../../../capability/toolboxes/Helicopter Landing Zone Tools.tbx" - - # Setup the tests - HLZTouchdownPoints.setUp(tbxFolderPath) - # Add the tests in this test suite - self.addHLZTouchdownPoints001(testSuite) - self.addHLZTouchdownPoints002(testSuite) - self.addChooseFieldValueScriptTool(testSuite) - self.addMinimumBoundingFishnet(testSuite) - # Cleanup after tests are run - - testSuite.run(result) - print("Test success: {0}".format(str(result.wasSuccessful()))) - - HLZTouchdownPoints.tearDown() - - return result - \ No newline at end of file diff --git a/capability/test/test_poo_tools/TemplateConfigTest.py b/capability/test/test_poo_tools/TemplateConfigTest.py deleted file mode 100644 index c8efb38b..00000000 --- a/capability/test/test_poo_tools/TemplateConfigTest.py +++ /dev/null @@ -1,90 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.toolboxesPath, TestUtilities.toolDataPath, - TestUtilities.layerPath, TestUtilities.testDataPath]) - - for path2check in paths2Check: - if os.path.exists(path2check): - print("Valid Path: " + path2check) - else: - print("ERROR: Necessary Path not found: " + path2check) - raise Exception('Bad Path') - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolDataGDB, TestUtilities.toolbox, - TestUtilities.testDataGDB]) - for object2Check in objects2Check: - desc = arcpy.Describe(object2Check) - if desc is None: - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else: - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + \ - "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) diff --git a/capability/test/test_poo_tools/TestPointOfOrigin.py b/capability/test/test_poo_tools/TestPointOfOrigin.py deleted file mode 100644 index a36ee424..00000000 --- a/capability/test/test_poo_tools/TestPointOfOrigin.py +++ /dev/null @@ -1,143 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- -# TestPointOfOrigin.py -# Description: Test Point Of Origin Toolbox -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- -# history: -# 4/2/2015 - mf - update for Python 3 coding standards -# ================================================== - - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - - -def main(): - ''' main test method ''' - try: - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - # Set tool param variables - inputImpactPoints = os.path.join(TestUtilities.testDataGDB, "impact_pts_monterey_UTM10N") - inputWeaponsTable = os.path.join(TestUtilities.toolDataGDB, r"Weapons") - inModelField = 'Model' - inMinRangeField = 'Minimum_range' - inMaxRangeField = 'Maximum_range' - inputWeaponsAsString = ("'M120/121 120-mm American Mortar';'M224 60-mm American Mortar';'M252 81-mm American Mortar'") - print("inputWeaponsAsString: " + str(inputWeaponsAsString)) - inputWeaponsAsList = inputWeaponsAsString.split(";") - print("inputWeaponsAsList: " + str(inputWeaponsAsList)) - outputWorkspace = arcpy.env.scratchGDB - outImpactPrefix = r"imp" - outPooPrefix = r"poo" - outRangePrefix = r"rng" - # WGS_1984_UTM_Zone_10N using factoryCode - sr = arcpy.SpatialReference(32610) - - # Testing Point Of Origin Site Detection - arcpy.AddMessage("Starting Test: Point of Origin Site Detection") - results = arcpy.PointOfOriginSiteDetection_ptorigin(inputImpactPoints, inputWeaponsTable, - inModelField, inMinRangeField, inMaxRangeField, - inputWeaponsAsString, outputWorkspace, - outImpactPrefix, outPooPrefix, - outRangePrefix, sr) - - # print("results.outputCount: " + str(results.outputCount)) - # for i in range(0,results.outputCount): - # print("output " + str(i) + ": " + str(results.getOutput(i))) - - # Verify Results - print("Checking results...") - outImpactFeatures = results.getOutput(0) - outPOOFeatures = results.getOutput(1).split(";") - outRangeFeatures = results.getOutput(2).split(";") - - # check that the same number of impact points between the input and output - countInputImpactPoints = int(arcpy.GetCount_management(inputImpactPoints).getOutput(0)) - countOutputImpactPoints = int(arcpy.GetCount_management(outImpactFeatures).getOutput(0)) - if countInputImpactPoints != countOutputImpactPoints: - print("Error: Impact points are not the same. In: " + - str(countInputImpactPoints) + ", Out: " + - str(countOutputImpactPoints)) - raise Exception("Test Failed") - print("Number of input and output impact points match.") - - # check the number of combined POO feature classes returned by the tool - countPOOFeatureClasses = int(len(outPOOFeatures)) - if len(inputWeaponsAsList) != countPOOFeatureClasses: - print("""Error: Number of Output Point of Origin features do not match - number of selected weapon systems. # weaopns: """ + - str(len(inputWeaponsAsList)) + ", POO: " + - str(countPOOFeatureClasses)) - raise Exception("Test Failed") - print("Number of selected weapons match number of output Point Of Origin features.") - - # check the number of range feature classes returned by the tool - countImpactXWeapons = int(countInputImpactPoints * len(inputWeaponsAsList)) - countRangeFeatureClasses = int(len(outRangeFeatures)) - if countImpactXWeapons != countRangeFeatureClasses: - print("""Error: Number of Range feature classes does not match Impact Points - x Weapon Models. ImpxWeap: """ + - str(countImpactXWeapons) + ", Ranges:" + - str(countRangeFeatureClasses)) - raise Exception("Test Failed") - print("Number of Impacts x Weapons match output range features.") - - print("All tests passed.") - - - except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - - except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error - # into a message string - pymsg = ("PYTHON ERRORS:\nTraceback info:\n" + tbinfo + - "\nError Info:\n" + str(sys.exc_info()[1])) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - - -# MAIN ============================================= -if __name__ == "__main__": - main() diff --git a/capability/test/test_poo_tools/TestUtilities.py b/capability/test/test_poo_tools/TestUtilities.py deleted file mode 100644 index c08fba75..00000000 --- a/capability/test/test_poo_tools/TestUtilities.py +++ /dev/null @@ -1,29 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import os - -currentPath = os.path.dirname(__file__) -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../capability/toolboxes/")) -testDataPath = os.path.normpath(os.path.join(currentPath, r"../../../capability/data/geodatabases/")) -toolDataPath = os.path.join(toolboxesPath, r"tooldata") -layerPath = os.path.join(toolboxesPath, "layers") -toolDataGDB = os.path.join(toolDataPath, "PointOfOrigin.gdb") -testDataGDB = os.path.join(testDataPath, "test_poo_tools.gdb") -toolbox = os.path.join(toolboxesPath, "Point Of Origin Tools_10.3.tbx") diff --git a/capability/test/test_poo_tools/build.xml b/capability/test/test_poo_tools/build.xml deleted file mode 100644 index d6c317bf..00000000 --- a/capability/test/test_poo_tools/build.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/capability/test/versions.xml b/capability/test/versions.xml deleted file mode 100644 index 5098ed3e..00000000 --- a/capability/test/versions.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - OUTPUTS: ${dir.arcgisdesktop}, ${dir.arcpy} - Checks system environment variable and sets the above values depending on version detected. - Sets the correct ArcPy and ArcGIS Folder location depending on version detected. - IMPORTANT: If Python is not installed at the default location, - you will need to edit the task "SET_CUSTOM_PYTHON_LOCATION" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/capability/toolboxes/ERG Tools.ERGByChemical.pyt.xml b/capability/toolboxes/ERG Tools.ERGByChemical.pyt.xml index f0e49c17..46306049 100644 --- a/capability/toolboxes/ERG Tools.ERGByChemical.pyt.xml +++ b/capability/toolboxes/ERG Tools.ERGByChemical.pyt.xml @@ -1 +1 @@ -20130925131123001.0TRUE2015021391331001500000005000ItemDescriptionERG By Chemical<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2012 tool based upon an incident point and Chemical name input. The 2012 Emergency Response Guidebook (ERG2012) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV>Emergency ManagementERGEmergency Response GuidebookArcToolbox Tool<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Represents the initial point the spill occurred.</SPAN></P><P><SPAN>Select a location on the map.</SPAN></P><P><SPAN>NOTE: You must select an Incident Point. If the Input Feature Set is empty, the tool will fail.</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Pick from the dropdown list of materials. The choices represent the various types of materials provided by the ERG lookup table. </SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Enter a wind direction 0-360, with 0 being North. This represents the direction </SPAN><SPAN>towards </SPAN><SPAN>which the wind is blowing. </SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>DAY is any time after sunrise and before sunset. NIGHT is any time between sunset and sunrise. </SPAN></P></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Generally, a SMALL SPILL is one which involves a single, small package (e.g., a drum containing up to approximately 200 liters), a small cylinder, or a small leak from a large package. A LARGE SPILL is one which involves a spill from a large package, or multiple spills from many small packages. </SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><P><SPAN>Output area features.</SPAN></P></DIV></DIV><DIV STYLE="text-align:Left;"><DIV><P><SPAN>Output line features.</SPAN></P></DIV></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2012 tool based upon an incident point and Chemical name input. The 2012 Emergency Response Guidebook (ERG2012) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV>c:\program files (x86)\arcgis\desktop10.3\Help\gp +20130925131123001.0TRUE20170202154359001500000005000ItemDescriptionERG By Chemical<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2016 tool based upon an incident point and Chemical name input. The 2016 Emergency Response Guidebook (ERG2016) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV>Emergency ManagementERGEmergency Response GuidebookArcToolbox Tool<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Represents the initial point the spill occurred.</SPAN></P><P><SPAN>Select a location on the map.</SPAN></P><P><SPAN>NOTE: You must select an Incident Point. If the Input Feature Set is empty, the tool will fail.</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Pick from the dropdown list of materials. The choices represent the various types of materials provided by the ERG lookup table. </SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Enter a wind direction 0-360, with 0 being North. This represents the direction </SPAN><SPAN>towards </SPAN><SPAN>which the wind is blowing. </SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>DAY is any time after sunrise and before sunset. NIGHT is any time between sunset and sunrise. </SPAN></P></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Generally, a SMALL SPILL is one which involves a single, small package (e.g., a drum containing up to approximately 200 liters), a small cylinder, or a small leak from a large package. A LARGE SPILL is one which involves a spill from a large package, or multiple spills from many small packages. </SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><P><SPAN>Output area features.</SPAN></P></DIV></DIV><DIV STYLE="text-align:Left;"><DIV><P><SPAN>Output line features.</SPAN></P></DIV></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2016 tool based upon an incident point and Chemical name input. The 2016 Emergency Response Guidebook (ERG2016) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV>c:\program files (x86)\arcgis\desktop10.3\Help\gp diff --git a/capability/toolboxes/ERG Tools.ERGByPlacard.pyt.xml b/capability/toolboxes/ERG Tools.ERGByPlacard.pyt.xml index 1cc2f186..b475846f 100644 --- a/capability/toolboxes/ERG Tools.ERGByPlacard.pyt.xml +++ b/capability/toolboxes/ERG Tools.ERGByPlacard.pyt.xml @@ -1 +1 @@ -20130925131127001.0TRUE2015021391443001500000005000ItemDescriptionERG By Placard<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2012 tool based upon an incident point and Placard input. The 2012 Emergency Response Guidebook (ERG2012) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV>ERGEmergency Response GuidebookArcToolbox Tool<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Represents the initial point the spill occurred.</SPAN></P><P><SPAN>Select a point on the map.</SPAN></P><P><SPAN>NOTE: You must select an Incident Point. If the Input Feature Set is empty, the tool will fail.</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Pick from the dropdown list of Placards. Each chemical has a placard associated with it, which is a number which represents a certain chemical. Sometimes a person may see a incident occur (semi truck spill) and see the placard, but not know the chemical.</SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Enter a wind direction 0-360, with 0 being North. This represents the direction </SPAN><SPAN>towards </SPAN><SPAN>which the wind is blowing.</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>DAY is any time after sunrise and before sunset. NIGHT is any time between sunset and sunrise.</SPAN></P></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Generally, a SMALL SPILL is one which involves a single, small package (e.g., a drum containing up to approximately 200 liters), a small cylinder, or a small leak from a large package. A LARGE SPILL is one which involves a spill from a large package, or multiple spills from many small packages.</SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Output area features</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Output line features</SPAN></P></DIV></DIV></DIV>c:\program files (x86)\arcgis\desktop10.3\Help\gp<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2012 tool based upon an incident point and Placard input. The 2012 Emergency Response Guidebook (ERG2012) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV> +20130925131127001.0TRUE20170202154507001500000005000ItemDescriptionERG By Placard<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2016 tool based upon an incident point and Placard input. The 2016 Emergency Response Guidebook (ERG2016) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV>ERGEmergency Response GuidebookArcToolbox Tool<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Represents the initial point the spill occurred.</SPAN></P><P><SPAN>Select a point on the map.</SPAN></P><P><SPAN>NOTE: You must select an Incident Point. If the Input Feature Set is empty, the tool will fail.</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Pick from the dropdown list of Placards. Each chemical has a placard associated with it, which is a number which represents a certain chemical. Sometimes a person may see a incident occur (semi truck spill) and see the placard, but not know the chemical.</SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Enter a wind direction 0-360, with 0 being North. This represents the direction </SPAN><SPAN>towards </SPAN><SPAN>which the wind is blowing.</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>DAY is any time after sunrise and before sunset. NIGHT is any time between sunset and sunrise.</SPAN></P></DIV><DIV STYLE="text-align:Left;"><P STYLE="font-size:16ptmargin:7 0 7 0;"><SPAN>Generally, a SMALL SPILL is one which involves a single, small package (e.g., a drum containing up to approximately 200 liters), a small cylinder, or a small leak from a large package. A LARGE SPILL is one which involves a spill from a large package, or multiple spills from many small packages.</SPAN></P></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Output area features</SPAN></P></DIV></DIV></DIV><DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Output line features</SPAN></P></DIV></DIV></DIV>c:\program files (x86)\arcgis\desktop10.3\Help\gp<DIV STYLE="text-align:Left;"><DIV><DIV><P><SPAN>Runs the ERG 2016 tool based upon an incident point and Placard input. The 2016 Emergency Response Guidebook (ERG2016) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident. </SPAN></P></DIV></DIV></DIV> diff --git a/capability/toolboxes/ERG Tools.pyt b/capability/toolboxes/ERG Tools.pyt index 30f8b1b9..2ebc3b69 100644 --- a/capability/toolboxes/ERG Tools.pyt +++ b/capability/toolboxes/ERG Tools.pyt @@ -47,8 +47,9 @@ class ERGByChemical(object): direction="Input") # grab the list of materials from a dbf file - dbfFile = os.path.join(thisFolder, r"tooldata\ERG2012LookupTable.dbf") - matList = [row[0] for row in arcpy.da.SearchCursor(dbfFile, ("Material"))] + dbfFile = os.path.join(thisFolder, r"tooldata\ERG2016LookupTable.dbf") + expression = arcpy.AddFieldDelimiters(dbfFile, 'IDNum') + ' > 0 AND NOT ' + arcpy.AddFieldDelimiters(dbfFile, 'BLEVE') + ' = \'Yes\'' + matList = [row[0] for row in arcpy.da.SearchCursor(dbfFile, ["Material"], where_clause=expression)] param1.filter.type = "ValueList" param1.filter.list = sorted(set(matList)) @@ -167,7 +168,7 @@ class ERGByChemical(object): """The source code of the tool.""" # Get the paths to the ERG lookup file and the Template location - ergDbf = os.path.join(thisFolder, r"tooldata\ERG2012LookupTable.dbf") + ergDbf = os.path.join(thisFolder, r"tooldata\ERG2016LookupTable.dbf") templateLoc = os.path.join(thisFolder, r"tooldata\Templates.gdb") # Ensure the point of spill is in a projected coord system @@ -178,7 +179,12 @@ class ERGByChemical(object): # Look up the ERG for the relevant distances, given the input parameters iid, pad, materials, guidenum = ERG.LookUpERG(parameters[1].valueAsText, "", parameters[4].valueAsText, parameters[3].valueAsText, ergDbf) - + if (iid == 0 or pad == 0): + arcpy.AddWarning("The Initial Isolation Distance and/or the Protective Action Distance is zero. " + \ + "Output features will not be created. The selected material may be from Table 3 " + \ + "of the Emergency Response Guidebook, which is currently not supported.") + return + # Generate the output FCs and output them ERG.MakeERGFeatures(spillPoint, parameters[2].valueAsText, iid, pad, materials, guidenum, parameters[4].valueAsText, parameters[3].valueAsText, parameters[5].valueAsText, parameters[6].valueAsText, templateLoc) @@ -215,8 +221,9 @@ class ERGByPlacard(object): direction="Input") # grab the list of materials from a dbf file - dbfFile = os.path.join(thisFolder, r"tooldata\ERG2012LookupTable.dbf") - placList = [row[0] for row in arcpy.da.SearchCursor(dbfFile, ["Placard"])] + dbfFile = os.path.join(thisFolder, r"tooldata\ERG2016LookupTable.dbf") + expression = arcpy.AddFieldDelimiters(dbfFile, 'IDNum') + ' > 0 AND NOT ' + arcpy.AddFieldDelimiters(dbfFile, 'BLEVE') + ' = \'Yes\'' + placList = [row[0] for row in arcpy.da.SearchCursor(dbfFile, ["IDNum"], where_clause=expression)] param1.filter.type = "ValueList" param1.filter.list = sorted(set(placList)) @@ -335,7 +342,7 @@ class ERGByPlacard(object): """The source code of the tool.""" # Get the paths to the ERG lookup file and the Template location - ergDbf = os.path.join(thisFolder, r"tooldata\ERG2012LookupTable.dbf") + ergDbf = os.path.join(thisFolder, r"tooldata\ERG2016LookupTable.dbf") templateLoc = os.path.join(thisFolder, r"tooldata\Templates.gdb") # Ensure the point of spill is in a projected coord system @@ -346,6 +353,11 @@ class ERGByPlacard(object): # Look up the ERG for the relevant distances, given the input parameters iid, pad, materials, guidenum = ERG.LookUpERG("", parameters[1].valueAsText, parameters[4].valueAsText, parameters[3].valueAsText, ergDbf) + if (iid == 0 or pad == 0): + arcpy.AddWarning("The Initial Isolation Distance and/or the Protective Action Distance is zero. " + \ + "Output features will not be created. The selected material may be from Table 3 " + \ + "of the Emergency Response Guidebook, which is currently not supported.") + return # Generate the output FCs and output them ERG.MakeERGFeatures(spillPoint, parameters[2].valueAsText, iid, pad, materials, guidenum, parameters[4].valueAsText, diff --git a/capability/toolboxes/ERG Tools.pyt.xml b/capability/toolboxes/ERG Tools.pyt.xml index 3dcfa292..d5d43119 100644 --- a/capability/toolboxes/ERG Tools.pyt.xml +++ b/capability/toolboxes/ERG Tools.pyt.xml @@ -1,4 +1,4 @@ -20130925131113001.0TRUE201502130914471500000005000ItemDescriptionc:\program files (x86)\arcgis\desktop10.3\Help\gpERG ToolsThese tools implement the 2012 Emergency Response Guidebook, allowing the spill material to be entered either by the name of the chemical, or by the Placard ID. +20130925131113001.0TRUE201702021546061500000005000ItemDescriptionc:\program files (x86)\arcgis\desktop10.3\Help\gpERG ToolsThese tools implement the 2016 Emergency Response Guidebook, allowing the spill material to be entered either by the name of the chemical, or by the Placard ID. -The 2012 Emergency Response Guidebook (ERG2012) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident.ERGEmergency Response GuidebookERG2012<DIV STYLE="text-align:Left;"><DIV><P><SPAN>Two tools that enable the implementation of the 2012 Emergency Response Guidebook, for when an emergency responder encounters a spill of a hazardous substance. By entering either the name of the hazardous substance, or a Placard ID, along with a number of other parameters that define the size of the spill, the time of day and the wind direction, the areas of Initial Isolation and Protective Action can be calculated and displayed.</SPAN></P></DIV></DIV>ArcToolbox Toolbox +The 2016 Emergency Response Guidebook (ERG2016) was developed jointly by Transport Canada (TC), the U.S. Department of Transportation (DOT), the Secretariat of Transport and Communications of Mexico (SCT) and with the collaboration of CIQUIME (Centro de Información Química para Emergencias) of Argentina, for use by fire fighters, police, and other emergency services personnel who may be the first to arrive at the scene of a transportation incident involving dangerous goods. It is primarily a guide to aid first responders in quickly identifying the specific or generic hazards of the material(s) involved in the incident, and protecting themselves and the general public during the initial response phase of the incident.ERGEmergency Response GuidebookERG2016<DIV STYLE="text-align:Left;"><DIV><P><SPAN>Two tools that enable the implementation of the 2016 Emergency Response Guidebook, for when an emergency responder encounters a spill of a hazardous substance. By entering either the name of the hazardous substance, or a Placard ID, along with a number of other parameters that define the size of the spill, the time of day and the wind direction, the areas of Initial Isolation and Protective Action can be calculated and displayed.</SPAN></P></DIV></DIV>ArcToolbox Toolbox diff --git a/capability/toolboxes/Helicopter Landing Zone Tools.tbx b/capability/toolboxes/Helicopter Landing Zone Tools.tbx index f3e7d9b1..ae5cb87b 100644 Binary files a/capability/toolboxes/Helicopter Landing Zone Tools.tbx and b/capability/toolboxes/Helicopter Landing Zone Tools.tbx differ diff --git a/capability/toolboxes/Helicopter Landing Zone Tools_10.4.tbx b/capability/toolboxes/Helicopter Landing Zone Tools_10.4.tbx index d550dbe3..ec57ba5f 100644 Binary files a/capability/toolboxes/Helicopter Landing Zone Tools_10.4.tbx and b/capability/toolboxes/Helicopter Landing Zone Tools_10.4.tbx differ diff --git a/capability/toolboxes/Point Of Origin Tools.tbx b/capability/toolboxes/Point Of Origin Tools.tbx index 2617a97c..d09ff8f2 100644 Binary files a/capability/toolboxes/Point Of Origin Tools.tbx and b/capability/toolboxes/Point Of Origin Tools.tbx differ diff --git a/capability/toolboxes/Point Of Origin Tools_10.3.tbx b/capability/toolboxes/Point Of Origin Tools_10.3.tbx new file mode 100644 index 00000000..d95020d5 Binary files /dev/null and b/capability/toolboxes/Point Of Origin Tools_10.3.tbx differ diff --git a/capability/toolboxes/scripts/ERG.py b/capability/toolboxes/scripts/ERG.py index 85b34331..f367bc80 100644 --- a/capability/toolboxes/scripts/ERG.py +++ b/capability/toolboxes/scripts/ERG.py @@ -26,7 +26,7 @@ def LookUpERG(pChemical, pPlacardID, pSpillSize, pTimeOfDay, pERGdbf): # equal to pChemical) and the last the guide number that relates to the ERG entry materialFieldName = "Material" - placardFieldName = "Placard" + placardFieldName = "IDNum" guideNumFieldName = "GuideNum" scriptFolder = os.path.dirname(__file__) @@ -41,11 +41,11 @@ def LookUpERG(pChemical, pPlacardID, pSpillSize, pTimeOfDay, pERGdbf): if (pSpillSize == "Large"): prefix = "LG" - timeField = "DWD_DAY" + timeField = "_DY" if (pTimeOfDay == "Night"): - timeField = "DWD_NITE" + timeField = "_NTE" - iidField = prefix + "_RAD" + iidField = prefix + "_ISO" padField = prefix + timeField # Look up the dbf file for the relevant distances @@ -137,7 +137,7 @@ def MakeERGFeatures(pProjectedPointGeometry, pWindBlowingToDirection, pInitialIs # Convert the supplied distances into meters (if needed) sr = pProjectedPointGeometry.spatialReference metersPerUnit = sr.metersPerUnit - arcpy.AddMessage("Metres per map unit: " + str(metersPerUnit)) + arcpy.AddMessage("Meters per map unit: " + str(metersPerUnit)) iiDistanceInSrUnits = pInitialIsolationDistance / metersPerUnit paDistanceInSrUnits = pProtectiveActionDistance / metersPerUnit arcpy.AddMessage("IID: " + str(iiDistanceInSrUnits)) diff --git a/capability/toolboxes/tooldata/ERG2016LookupTable.dbf b/capability/toolboxes/tooldata/ERG2016LookupTable.dbf new file mode 100644 index 00000000..36f63e73 Binary files /dev/null and b/capability/toolboxes/tooldata/ERG2016LookupTable.dbf differ diff --git a/capability/toolboxes/tooldata/ERG2016LookupTable.dbf.xml b/capability/toolboxes/tooldata/ERG2016LookupTable.dbf.xml new file mode 100644 index 00000000..ebf5f27a --- /dev/null +++ b/capability/toolboxes/tooldata/ERG2016LookupTable.dbf.xml @@ -0,0 +1,2 @@ + +20170202145444001.0FALSEERG2016LookupTable0020.002file://\\ELINZ\C$\Backup\Projects\ERG\ERG2016\ERG2016LookupTable.dbfLocal Area NetworkTableToTable "C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$'" C:\Backup\Projects\ERG\ERG2016 ERG2016LookupTable.dbf # "GuideNum "GuideNum" true true false 8 Long 0 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',GuideNum,-1,-1;IDNum "IDNum" true true false 8 Long 0 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',IDNum,-1,-1;Material "Material" true true false 255 Text 0 0 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',Material,-1,-1;SM_ISO "SM_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SM_ISO,-1,-1;SM_DY "SM_DY" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SM_DY,-1,-1;SM_NTE "SM_NTE" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SM_NTE,-1,-1;LG_ISO "LG_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',LG_ISO,-1,-1;LG_DY "LG_DY" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',LG_DY,-1,-1;LG_NTE "LG_NTE" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',LG_NTE,-1,-1;ATM "ATM" true true false 5 Text 0 0 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',ATM,-1,-1;POLYMERIZE "POLYMERIZE" true true false 5 Text 0 0 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',POLYMERIZE,-1,-1;FIRE_ISO "FIRE_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',FIRE_ISO,-1,-1;BLEVE "BLEVE" true true false 5 Text 0 0 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLEVE,-1,-1;BLV100L "BLV100L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV100L,-1,-1;BLV400L "BLV400L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV400L,-1,-1;BLV2000L "BLV2000L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV2000L,-1,-1;BLV4000L "BLV4000L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV4000L,-1,-1;BLV8000L "BLV8000L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV8000L,-1,-1;BLV22000L "BLV22000L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV22000L,-1,-1;BLV42000L "BLV42000L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV42000L,-1,-1;BLV82000L "BLV82000L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV82000L,-1,-1;BLV140000L "BLV140000L" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',BLV140000L,-1,-1;TABLE3 "TABLE3" true true false 5 Text 0 0 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',TABLE3,-1,-1;RAIL_ISO "RAIL_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',RAIL_ISO,-1,-1;RAILDYLOW "RAILDYLOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',RAILDYLOW,-1,-1;RAILDYMOD "RAILDYMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',RAILDYMOD,-1,-1;RAILDYHI "RAILDYHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',RAILDYHI,-1,-1;RAILNTELOW "RAILNTELOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',RAILNTELOW,-1,-1;RAILNTEMOD "RAILNTEMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',RAILNTEMOD,-1,-1;RAILNTEHI "RAILNTEHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',RAILNTEHI,-1,-1;SEMI_ISO "SEMI_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SEMI_ISO,-1,-1;SEMIDYLOW "SEMIDYLOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SEMIDYLOW,-1,-1;SEMIDYMOD "SEMIDYMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SEMIDYMOD,-1,-1;SEMIDYHI "SEMIDYHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SEMIDYHI,-1,-1;SEMINTELOW "SEMINTELOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SEMINTELOW,-1,-1;SEMINTEMOD "SEMINTEMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SEMINTEMOD,-1,-1;SEMINTEHI "SEMINTEHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',SEMINTEHI,-1,-1;MTON_ISO "MTON_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MTON_ISO,-1,-1;MTONDYLOW "MTONDYLOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MTONDYLOW,-1,-1;MTONDYMOD "MTONDYMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MTONDYMOD,-1,-1;MTONDYHI "MTONDYHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MTONDYHI,-1,-1;MTONNTELOW "MTONNTELOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MTONNTELOW,-1,-1;MTONNTEMOD "MTONNTEMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MTONNTEMOD,-1,-1;MTONNTEHI "MTONNTEHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MTONNTEHI,-1,-1;STON_ISO "STON_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',STON_ISO,-1,-1;STONDYLOW "STONDYLOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',STONDYLOW,-1,-1;STONDYMOD "STONDYMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',STONDYMOD,-1,-1;STONDYHI "STONDYHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',STONDYHI,-1,-1;STONNTELOW "STONNTELOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',STONNTELOW,-1,-1;STONNTEMOD "STONNTEMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',STONNTEMOD,-1,-1;STONNTEHI "STONNTEHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',STONNTEHI,-1,-1;AG_ISO "AG_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',AG_ISO,-1,-1;AGDYLOW "AGDYLOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',AGDYLOW,-1,-1;AGDYMOD "AGDYMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',AGDYMOD,-1,-1;AGDYHI "AGDYHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',AGDYHI,-1,-1;AGNTELOW "AGNTELOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',AGNTELOW,-1,-1;AGNTEMOD "AGNTEMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',AGNTEMOD,-1,-1;AGNTEHI "AGNTEHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',AGNTEHI,-1,-1;MSM_ISO "MSM_ISO" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MSM_ISO,-1,-1;MSMDYLOW "MSMDYLOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MSMDYLOW,-1,-1;MSMDYMOD "MSMDYMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MSMDYMOD,-1,-1;MSMDYHI "MSMDYHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MSMDYHI,-1,-1;MSMNTELOW "MSMNTELOW" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MSMNTELOW,-1,-1;MSMNTEMOD "MSMNTEMOD" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MSMNTEMOD,-1,-1;MSMNTEHI "MSMNTEHI" true true false 8 Double 6 15 ,First,#,C:\Backup\Projects\ERG\ERG2016\ERG Data Table (Enhanced)_fields_directread.xlsx\'ERG Data Table Values$',MSMNTEHI,-1,-1" #20170202145445002017020214544500 Version 6.2 (Build 9200) ; Esri ArcGIS 10.3.1.4959ERG2016LookupTabledBASE Table0.002datasetERG2016LookupTableTable0OIDOIDOID400Internal feature number.EsriSequential unique whole numbers that are automatically generated.GuideNumGuideNumDouble15150IDNumIDNumDouble15150MaterialMaterialString25400SM_ISOSM_ISODouble16156SM_DYSM_DYDouble16156SM_NTESM_NTEDouble16156LG_ISOLG_ISODouble16156LG_DYLG_DYDouble16156LG_NTELG_NTEDouble16156ATMATMString500POLYMERIZEPOLYMERIZEString500FIRE_ISOFIRE_ISODouble16156BLEVEBLEVEString500BLV100LBLV100LDouble16156BLV400LBLV400LDouble16156BLV2000LBLV2000LDouble16156BLV4000LBLV4000LDouble16156BLV8000LBLV8000LDouble16156BLV22000LBLV22000LDouble16156BLV42000LBLV42000LDouble16156BLV82000LBLV82000LDouble16156BLV140000LBLV140000LDouble16156TABLE3TABLE3String500RAIL_ISORAIL_ISODouble16156RAILDYLOWRAILDYLOWDouble16156RAILDYMODRAILDYMODDouble16156RAILDYHIRAILDYHIDouble16156RAILNTELOWRAILNTELOWDouble16156RAILNTEMODRAILNTEMODDouble16156RAILNTEHIRAILNTEHIDouble16156SEMI_ISOSEMI_ISODouble16156SEMIDYLOWSEMIDYLOWDouble16156SEMIDYMODSEMIDYMODDouble16156SEMIDYHISEMIDYHIDouble16156SEMINTELOWSEMINTELOWDouble16156SEMINTEMODSEMINTEMODDouble16156SEMINTEHISEMINTEHIDouble16156MTON_ISOMTON_ISODouble16156MTONDYLOWMTONDYLOWDouble16156MTONDYMODMTONDYMODDouble16156MTONDYHIMTONDYHIDouble16156MTONNTELOWMTONNTELOWDouble16156MTONNTEMODMTONNTEMODDouble16156MTONNTEHIMTONNTEHIDouble16156STON_ISOSTON_ISODouble16156STONDYLOWSTONDYLOWDouble16156STONDYMODSTONDYMODDouble16156STONDYHISTONDYHIDouble16156STONNTELOWSTONNTELOWDouble16156STONNTEMODSTONNTEMODDouble16156STONNTEHISTONNTEHIDouble16156AG_ISOAG_ISODouble16156AGDYLOWAGDYLOWDouble16156AGDYMODAGDYMODDouble16156AGDYHIAGDYHIDouble16156AGNTELOWAGNTELOWDouble16156AGNTEMODAGNTEMODDouble16156AGNTEHIAGNTEHIDouble16156MSM_ISOMSM_ISODouble16156MSMDYLOWMSMDYLOWDouble16156MSMDYMODMSMDYMODDouble16156MSMDYHIMSMDYHIDouble16156MSMNTELOWMSMNTELOWDouble16156MSMNTEMODMSMNTEMODDouble16156MSMNTEHIMSMNTEHIDouble1615620170202 diff --git a/capability/toolboxes/tooldata/ERG2016LookupTable_DataDictionary.txt b/capability/toolboxes/tooldata/ERG2016LookupTable_DataDictionary.txt new file mode 100644 index 00000000..6d3d7589 --- /dev/null +++ b/capability/toolboxes/tooldata/ERG2016LookupTable_DataDictionary.txt @@ -0,0 +1,85 @@ +======================================================================================================================================================== +Data Dictionary - ERG2016LookupTable.dbf +======================================================================================================================================================== +FieldName Type Description +-------------------------------------------------------------------------------------------------------------------------------------------------------- +GuildeNum Double(Precision:15, Scale: 0) Guide number; orange section of ERG +IDNum Double(Precision:15, Scale: 0) 4-digit identification number (UN or NA) +Material Text (Length: 254) Name of Material + +SM_ISO Double(Precision:15, Scale: 6) Small spill isolation distance in all directions (meters) - Table 1. +SM_DY Double(Precision:15, Scale: 6) Small spill protection distance downwind during day (meters) - Table 1. +SM_NTE Double(Precision:15, Scale: 6) Small spill protection distance downwind during night (meters) - Table 1. +LG_ISO Double(Precision:15, Scale: 6) Large spill isolation distance in all directions (meters) - Table 1. +LG_DY Double(Precision:15, Scale: 6) Large spill protection distance downwind during day (meters) - Table 1. +LG_NTE Double(Precision:15, Scale: 6) Large spill protection distance downwind during night (meters) - Table 1. + +ATM Text (Length: 5) Atmospheric - indicates if material in ERG was marked with "+" which denotes that distance can be larger in certain atmospheric conditions +POLYMERIZE Text (Length: 5) Indicates if material can polymerize. +FIRE_ISO Double(Precision:15, Scale: 6) Isolation distance in all directions when material is involved in a fire. + +BLEVE Text (Length: 5) Indicates if the information from "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369) applies to this material as described in Guide section (orange) of ERG. +BLV100L Double(Precision:15, Scale: 6) BLEVE 100L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV400L Double(Precision:15, Scale: 6) BLEVE 400L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV2000L Double(Precision:15, Scale: 6) BLEVE 2000L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV4000L Double(Precision:15, Scale: 6) BLEVE 4000L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV8000L Double(Precision:15, Scale: 6) BLEVE 8000L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV22000L Double(Precision:15, Scale: 6) BLEVE 22000L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV42000L Double(Precision:15, Scale: 6) BLEVE 42000L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV82000L Double(Precision:15, Scale: 6) BLEVE 82000L- Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). +BLV140000L Double(Precision:15, Scale: 6) BLEVE 140000L - Preferred evacuation distance (meters) for this capacity tank defined in the "BLEVE - SAFETY PRECAUTIONS" section in ERG (page 369). + +TABLE3 Text (Length: 5) Indicates if the initial isolation and protective action distances for the material for large spills are defined by Table 3 of the ERG. +RAIL_ISO Double(Precision:15, Scale: 6) Rail tank car - Isolation distance in all directions (meters) - Table 3. +RAILDYLOW Double(Precision:15, Scale: 6) Rail tank car - Protection distance downwind during day, low wind (meters) - Table 3. +RAILDYMOD Double(Precision:15, Scale: 6) Rail tank car - Protection distance downwind during day, moderate wind (meters) - Table 3. +RAILDYHI Double(Precision:15, Scale: 6) Rail tank car - Protection distance downwind during day, high wind (meters) - Table 3. +RAILNTELOW Double(Precision:15, Scale: 6) Rail tank car - Protection distance downwind during night, low wind (meters) - Table 3. +RAILNTEMOD Double(Precision:15, Scale: 6) Rail tank car - Protection distance downwind during night, moderate wind (meters) - Table 3. +RAILNTEHI Double(Precision:15, Scale: 6) Rail tank car - Protection distance downwind during night, high wind (meters) - Table 3. + NOTE: Field name prefix "RAIL", derived from "(Rail) tank car" + +SEMI_ISO Double(Precision:15, Scale: 6) Highway tank truck or trailer - Isolation distance in all directions (meters) - Table 3. +SEMIDYLOW Double(Precision:15, Scale: 6) Highway tank truck or trailer - Protection distance downwind during day, low wind (meters) - Table 3. +SEMIDYMOD Double(Precision:15, Scale: 6) Highway tank truck or trailer - Protection distance downwind during day, moderate wind (meters) - Table 3. +SEMIDYHI Double(Precision:15, Scale: 6) Highway tank truck or trailer - Protection distance downwind during day, high wind (meters) - Table 3. +SEMINTELOW Double(Precision:15, Scale: 6) Highway tank truck or trailer - Protection distance downwind during night, low wind (meters) - Table 3. +SEMINTEMOD Double(Precision:15, Scale: 6) Highway tank truck or trailer - Protection distance downwind during night, moderate wind (meters) - Table 3. +SEMINTEHI Double(Precision:15, Scale: 6) Highway tank truck or trailer - Protection distance downwind during night, high wind (meters) - Table 3. + NOTE: Field name prefix "SEMI", derived from common term to describe a tractor and trailer combination + +MTON_ISO Double(Precision:15, Scale: 6) Multiple ton cylinders - Isolation distance in all directions (meters) - Table 3. +MTONDYLOW Double(Precision:15, Scale: 6) Multiple ton cylinders - Protection distance downwind during day, low wind (meters) - Table 3. +MTONDYMOD Double(Precision:15, Scale: 6) Multiple ton cylinders - Protection distance downwind during day, moderate wind (meters) - Table 3. +MTONDYHI Double(Precision:15, Scale: 6) Multiple ton cylinders - Protection distance downwind during day, high wind (meters) - Table 3. +MTONNTELOW Double(Precision:15, Scale: 6) Multiple ton cylinders - Protection distance downwind during night, low wind (meters) - Table 3. +MTONNTEMOD Double(Precision:15, Scale: 6) Multiple ton cylinders - Protection distance downwind during night, moderate wind (meters) - Table 3. +MTONNTEHI Double(Precision:15, Scale: 6) Multiple ton cylinders - Protection distance downwind during night, high wind (meters) - Table 3. + NOTE: Field name prefix "MTON", derived from "(M)ultiple (ton) cylinders" + +STON_ISO Double(Precision:15, Scale: 6) Multiple small cylinders or single ton cylinder - Isolation distance in all directions (meters) - Table 3. +STONDYLOW Double(Precision:15, Scale: 6) Multiple small cylinders or single ton cylinder - Protection distance downwind during day, low wind (meters) - Table 3. +STONDYMOD Double(Precision:15, Scale: 6) Multiple small cylinders or single ton cylinder - Protection distance downwind during day, moderate wind (meters) - Table 3. +STONDYHI Double(Precision:15, Scale: 6) Multiple small cylinders or single ton cylinder - Protection distance downwind during day, high wind (meters) - Table 3. +STONNTELOW Double(Precision:15, Scale: 6) Multiple small cylinders or single ton cylinder - Protection distance downwind during night, low wind (meters) - Table 3. +STONNTEMOD Double(Precision:15, Scale: 6) Multiple small cylinders or single ton cylinder - Protection distance downwind during night, moderate wind (meters) - Table 3. +STONNTEHI Double(Precision:15, Scale: 6) Multiple small cylinders or single ton cylinder - Protection distance downwind during night, high wind (meters) - Table 3. + NOTE: Field name prefix "STON", derived from "Multiple small cylinders or (s)ingle (ton) cylinder" + +AG_ISO Double(Precision:15, Scale: 6) Agricultural nurse tank - Isolation distance in all directions (meters) - Table 3. +AGDYLOW Double(Precision:15, Scale: 6) Agricultural nurse tank - Protection distance downwind during day, low wind (meters) - Table 3. +AGDYMOD Double(Precision:15, Scale: 6) Agricultural nurse tank - Protection distance downwind during day, moderate wind (meters) - Table 3. +AGDYHI Double(Precision:15, Scale: 6) Agricultural nurse tank - Protection distance downwind during day, high wind (meters) - Table 3. +AGNTELOW Double(Precision:15, Scale: 6) Agricultural nurse tank - Protection distance downwind during night, low wind (meters) - Table 3. +AGNTEMOD Double(Precision:15, Scale: 6) Agricultural nurse tank - Protection distance downwind during night, moderate wind (meters) - Table 3. +AGNTEHI Double(Precision:15, Scale: 6) Agricultural nurse tank - Protection distance downwind during night, high wind (meters) - Table 3. + NOTE: Field name prefix "AG", derived from "(Ag)ricultural nurse tank" + +MSM_ISO Double(Precision:15, Scale: 6) Multiple small cylinders - Isolation distance in all directions (meters) - Table 3. +MSMDYLOW Double(Precision:15, Scale: 6) Multiple small cylinders - Protection distance downwind during day, low wind (meters) - Table 3. +MSMDYMOD Double(Precision:15, Scale: 6) Multiple small cylinders - Protection distance downwind during day, moderate wind (meters) - Table 3. +MSMDYHI Double(Precision:15, Scale: 6) Multiple small cylinders - Protection distance downwind during day, high wind (meters) - Table 3. +MSMNTELOW Double(Precision:15, Scale: 6) Multiple small cylinders - Protection distance downwind during night, low wind (meters) - Table 3. +MSMNTEMOD Double(Precision:15, Scale: 6) Multiple small cylinders - Protection distance downwind during night, moderate wind (meters) - Table 3. +MSMNTEHI Double(Precision:15, Scale: 6) Multiple small cylinders - Protection distance downwind during night, high wind (meters) - Table 3. + NOTE: Field name prefix "MSM", derived from "(M)ultiple (sm)all cylinders" \ No newline at end of file diff --git a/data_management/README.md b/data_management/README.md index 3e205369..29641a95 100644 --- a/data_management/README.md +++ b/data_management/README.md @@ -32,7 +32,8 @@ MDCS is maintained as a separate repository from Solutions Geoprocessing Toolbox ## Adjust Sample Data Dates Tools -This toolbox contains a tool to adjust the date fields of the sample data included with the Inciedent Analysis toolbox. +This toolbox contains a tool to adjust the date fields of the sample data included with the Incident Analysis toolbox. +Supports the [Incident Analysis](http://solutions.arcgis.com/defense/templates/incident-analysis/) template. * Change Sample Data Dates to Recent Dates @@ -40,28 +41,37 @@ These tools are a part of the [Incident Analysis Template](http://www.arcgis.com ## CADRG ECRG Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + This toolbox will help to automate the creation of CADRG/ECRG Mosaic Datasets. * CADRG/ECRG Mosaic Datasets ## CIB Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + * Create CIB Mosaic ## Elevation Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + * Create Derived Elevation Mosaic * Create Source Elevation Mosaic ## Geonames Tools Tools for building geonames locator. +Supports the [Geonames Locator](http://solutions.arcgis.com/defense/templates/geonames-locator/) template. * Create Geonames Gazetter Locator * Load Geonames File ## Import and Conversion Tools (formerly Position Analysis Tools) +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + Tools for converting tabular information to different geometries, and generating coordinate location datasets. * Convert Coordinates @@ -86,6 +96,8 @@ This toolbox contains tools that create surface or terrain mosaics from LiDAR d ## Network Data Preparation Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + These tools are used to prepare road data for use in a road network dataset. * Add Orientation Angle To Lines @@ -95,6 +107,8 @@ These tools are used to prepare road data for use in a road network dataset. ## Patrol Data Capture Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + Includes tools to import data that has been gathered on or after a patrol. This includes GPS data, saved in .gpx files, and Patrol Report data, saved in .xml files (as saved by an Infopath form) * Append Tracks to DB @@ -111,6 +125,8 @@ These tools are a part of the [Patrol Data Capture](http://www.arcgis.com/home/i ## Publishable Task Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + Publishable Tasks are a series of models that should be published as geoprocessing services for: * Fast Visibility: visibility tools optimized to be run as geoprocessing services diff --git a/data_management/test/build.xml b/data_management/test/build.xml deleted file mode 100644 index 4ef71570..00000000 --- a/data_management/test/build.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_CADRG_ECRG/TemplateConfigTest.py b/data_management/test/test_CADRG_ECRG/TemplateConfigTest.py deleted file mode 100644 index f3675646..00000000 --- a/data_management/test/test_CADRG_ECRG/TemplateConfigTest.py +++ /dev/null @@ -1,96 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath, TestUtilities.cadrgSourcePath]) - - for path2check in paths2Check: - if os.path.exists(path2check): - print("Valid Path: " + path2check) - else: - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.scratchGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None: - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else: - print("Valid Object: " + desc.Name ) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - \ No newline at end of file diff --git a/data_management/test/test_CADRG_ECRG/TestCADRG_ECRGMosaic.py b/data_management/test/test_CADRG_ECRG/TestCADRG_ECRGMosaic.py deleted file mode 100644 index 862d8a87..00000000 --- a/data_management/test/test_CADRG_ECRG/TestCADRG_ECRGMosaic.py +++ /dev/null @@ -1,87 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestCreateSourceElevationMosaic.py -# Description: Test Create Source Elevation Mosaic -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - - -try: - - print("Setting environment...") - arcpy.ImportToolbox(TestUtilities.toolbox, "cadrg") - arcpy.env.overwriteOutput = True - - # Set tool param variables - print("Setting inputs...") - targetGeodatabase = TestUtilities.scratchGDB - targetMosaicName = "cadrgMD" - coordinateSystem = arcpy.SpatialReference(4326) - dataPath = TestUtilities.cadrgSourcePath - dataFilter = "*.*" - #Testing CADRG/ECRG tool - arcpy.AddMessage("Starting Test: CADRB/ECRG Mosaic") - # cadrgecrg_cadrg (workspace, md_name, spref, {datapath}, {datafilter}, {useoview}, {ovscale}, {psValue}) - arcpy.cadrgecrg_cadrg(targetGeodatabase, targetMosaicName, coordinateSystem, dataPath, dataFilter) - - # #Verify Results - print("Verifying results...") - countFootprints = int(arcpy.GetCount_management(os.path.join(targetGeodatabase, targetMosaicName)).getOutput(0)) - print("Footprint count: " + str(countFootprints)) - - if (countFootprints < 3): - print("ERROR: Less than 3 footprints! (found " + str(countFootprints) + ")") - raise Exception("Test Failed") - else: - print("Test Passed") - if arcpy.Exists(os.path.join(targetGeodatabase, targetMosaicName)): - arcpy.Delete_management(os.path.join(targetGeodatabase, targetMosaicName)) - - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - - \ No newline at end of file diff --git a/data_management/test/test_CADRG_ECRG/TestUtilities.py b/data_management/test/test_CADRG_ECRG/TestUtilities.py deleted file mode 100644 index bca57b65..00000000 --- a/data_management/test/test_CADRG_ECRG/TestUtilities.py +++ /dev/null @@ -1,47 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) -cadrgSourcePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/rpf/")) - -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -toolbox = os.path.join(toolboxesPath, "CADRG ECRG Tools.pyt") - -def createScratch(): - try: - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - return - -def deleteScratch(): - try: - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - return - -# create scratch -createScratch() diff --git a/data_management/test/test_CADRG_ECRG/build.xml b/data_management/test/test_CADRG_ECRG/build.xml deleted file mode 100644 index 94d7ea98..00000000 --- a/data_management/test/test_CADRG_ECRG/build.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_CIB/TemplateConfigTest.py b/data_management/test/test_CIB/TemplateConfigTest.py deleted file mode 100644 index a07b7702..00000000 --- a/data_management/test/test_CIB/TemplateConfigTest.py +++ /dev/null @@ -1,96 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath, TestUtilities.cibSourcePath]) - - for path2check in paths2Check: - if os.path.exists(path2check): - print("Valid Path: " + path2check) - else: - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.scratchGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None: - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else: - print("Valid Object: " + desc.Name ) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - \ No newline at end of file diff --git a/data_management/test/test_CIB/TestCIBMosaic.py b/data_management/test/test_CIB/TestCIBMosaic.py deleted file mode 100644 index 0daca887..00000000 --- a/data_management/test/test_CIB/TestCIBMosaic.py +++ /dev/null @@ -1,86 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestCIBMosaic.py -# Description: Test CIB mosaic tool -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - - -try: - - print("Setting environment...") - arcpy.ImportToolbox(TestUtilities.toolbox, "cib") - arcpy.env.overwriteOutput = True - - # Set tool param variables - print("Setting inputs...") - targetGeodatabase = TestUtilities.scratchGDB - targetMosaicName = "cibMD" - coordinateSystem = arcpy.SpatialReference(4326) - dataPath = TestUtilities.cibSourcePath - - arcpy.AddMessage("Starting Test: CIB Mosaic") - # createCIBMD_cib (workspace, md_name, spref, datapath) - arcpy.createCIBMD_cib(targetGeodatabase, targetMosaicName, coordinateSystem, dataPath) - - # #Verify Results - print("Verifying results...") - countFootprints = int(arcpy.GetCount_management(os.path.join(targetGeodatabase, targetMosaicName)).getOutput(0)) - print("Footprint count: " + str(countFootprints)) - - if (countFootprints < 1): - print("ERROR: Fewer footprints found than expected! (found " + str(countFootprints) + ")") - raise Exception("Test Failed") - else: - print("Test Passed") - if arcpy.Exists(os.path.join(targetGeodatabase, targetMosaicName)): - arcpy.Delete_management(os.path.join(targetGeodatabase, targetMosaicName)) - - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - - \ No newline at end of file diff --git a/data_management/test/test_CIB/TestUtilities.py b/data_management/test/test_CIB/TestUtilities.py deleted file mode 100644 index 19dd9290..00000000 --- a/data_management/test/test_CIB/TestUtilities.py +++ /dev/null @@ -1,47 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) -cibSourcePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/rpf/")) - -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -toolbox = os.path.join(toolboxesPath, "CIB Tools.pyt") - -def createScratch(): - try: - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - return - -def deleteScratch(): - try: - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - return - -# create scratch -createScratch() diff --git a/data_management/test/test_CIB/build.xml b/data_management/test/test_CIB/build.xml deleted file mode 100644 index 6b4ba5cc..00000000 --- a/data_management/test/test_CIB/build.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_LiDAR/TemplateConfigTest.py b/data_management/test/test_LiDAR/TemplateConfigTest.py deleted file mode 100644 index 0f048169..00000000 --- a/data_management/test/test_LiDAR/TemplateConfigTest.py +++ /dev/null @@ -1,96 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath, TestUtilities.lasSourcePath]) - - for path2check in paths2Check: - if os.path.exists(path2check): - print("Valid Path: " + path2check) - else: - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.scratchGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None: - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else: - print("Valid Object: " + desc.Name ) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - \ No newline at end of file diff --git a/data_management/test/test_LiDAR/TestLASGroundMosaic.py b/data_management/test/test_LiDAR/TestLASGroundMosaic.py deleted file mode 100644 index 5de79449..00000000 --- a/data_management/test/test_LiDAR/TestLASGroundMosaic.py +++ /dev/null @@ -1,123 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestLASGroundMosaic.py -# Description: Test Create Source LAS Ground Elevation Mosaic -# Requirements: ArcGIS Desktop Advanced -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os -import datetime - - -try: - print("==============================================================================") - print("IMPORTANT:") - print("This is a time-consuming test and will take several minutes to complete.") - print("The test may not update status, or show progress during this time.") - print("==============================================================================") - - print("Setting environment...") - arcpy.ImportToolbox(TestUtilities.toolbox, "LidarTools") - arcpy.env.overwriteOutput = True - - # Set tool param variables - print("Setting inputs...") - targetGeodatabase = TestUtilities.scratchGDB - targetMosaicName = "S_DTMGround" - srWGS84 = arcpy.SpatialReference(4326) #GCS_WGS_1984 - srNAD83StatePlaneCA4Ft = arcpy.SpatialReference(2228) #NAD_1983_StatePlane_California_IV_FIPS_0404_Feet - coordinateSystem = srNAD83StatePlaneCA4Ft - #rasterType = "LAS" - rasterType = "#" - dataPath = TestUtilities.lasSourcePath - - arcpy.AddMessage("Starting Test: Create Source LAS Ground Elevation Mosaic (" + str(datetime.datetime.now().strftime("%m/%d/%Y %H:%M:%S")) + ")") - # CreateSourceLASGroundElevationMosaic_elevationmosaics (Target_Geodatabase, Source_Elevation_Mosaic_Dataset_Name, - # Coordinate_System, Raster_Type, - # Input_LAS_Files,{Coordinate_System_for_Input_Data}) - arcpy.CreateSourceLASGroundElevationMosaic_LidarTools(targetGeodatabase, targetMosaicName, coordinateSystem, - rasterType, dataPath) - arcpy.AddMessage("Finished running tool (" + str(datetime.datetime.now().strftime("%m/%d/%Y %H:%M:%S") + ")")) - # #Verify Results - print("Verifying results...") - countFootprints = int(arcpy.GetCount_management(os.path.join(targetGeodatabase, targetMosaicName)).getOutput(0)) - print("Footprint count: " + str(countFootprints)) - - if not countFootprints == 5: - print("ERROR: Expected five (5) footprints, found " + str(countFootprints)) - raise Exception("Test Failed") - - #Check for two 'primary' and three 'overview' in the 'category' field - #Frequency_analysis (in_table, out_table, frequency_fields, {summary_fields}) - tempFreqTable = os.path.join(TestUtilities.scratchGDB, "tempFreqTable") - arcpy.Frequency_analysis(os.path.join(targetGeodatabase, targetMosaicName), tempFreqTable, "Category") - freqTable = {} - rows = arcpy.da.SearchCursor(tempFreqTable, ["Category", "FREQUENCY"]) - for row in rows: - if row[0] == 1: - category = "Primary" - if row[0] == 2: - category = "Overview" - frequency = row[1] - freqTable[category] = frequency - - fail = False - if not freqTable["Primary"] == 2: - print("ERROR: Expected two (2) Primary footprints, found " + str(freqTable["Primary"])) - fail = True - if not freqTable["Overview"] == 3: - print("ERROR: Expected three (3) Overview footprints, found " + str(freqTable["Overview"])) - fail = True - if fail == True: - raise Exception("Test Failed") - else: - print("Test Passed") - - if arcpy.Exists(os.path.join(targetGeodatabase, targetMosaicName)): - arcpy.Delete_management(os.path.join(targetGeodatabase, targetMosaicName)) - if arcpy.Exists(tempFreqTable): - arcpy.Delete_management(tempFreqTable) - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) diff --git a/data_management/test/test_LiDAR/TestLASSurfaceMosaic.py b/data_management/test/test_LiDAR/TestLASSurfaceMosaic.py deleted file mode 100644 index 66c0df41..00000000 --- a/data_management/test/test_LiDAR/TestLASSurfaceMosaic.py +++ /dev/null @@ -1,123 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestLASSurfaceMosaic.py -# Description: Test Create Source LAS Surface Elevation Mosaic -# Requirements: ArcGIS Desktop Advanced -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - - -try: - print("==============================================================================") - print("IMPORTANT:") - print("This is a time-consuming test and will take several minutes to complete.") - print("The test may not update status, or show progress during this time.") - print("==============================================================================") - - print("Setting environment...") - arcpy.ImportToolbox(TestUtilities.toolbox, "LidarTools") - arcpy.env.overwriteOutput = True - - # Set tool param variables - print("Setting inputs...") - targetGeodatabase = TestUtilities.scratchGDB - targetMosaicName = "S_DSMGround" - srWGS84 = arcpy.SpatialReference(4326) #GCS_WGS_1984 - srNAD83StatePlaneCA4Ft = arcpy.SpatialReference(2228) #NAD_1983_StatePlane_California_IV_FIPS_0404_Feet - coordinateSystem = srNAD83StatePlaneCA4Ft - #rasterType = "LAS" - rasterType = "#" - dataPath = TestUtilities.lasSourcePath - - arcpy.AddMessage("Starting Test: Create Source LAS Surface Elevation Mosaic (" + str(datetime.datetime.now().strftime("%m/%d/%Y %H:%M:%S")) + ")") - # CreateSourceLASSurfaceElevationMosaic_elevationmosaics (Target_Geodatabase, Source_Elevation_Mosaic_Dataset_Name, - # Coordinate_System, Raster_Type, - # Input_LAS_Files, {Coordinate_System_for_Input_Data}) - arcpy.CreateSourceLASSurfaceElevationMosaic_LidarTools(targetGeodatabase, targetMosaicName, coordinateSystem, - rasterType, dataPath) - - arcpy.AddMessage("Finished running tool (" + str(datetime.datetime.now().strftime("%m/%d/%Y %H:%M:%S") + ")")) - # #Verify Results - print("Verifying results...") - countFootprints = int(arcpy.GetCount_management(os.path.join(targetGeodatabase, targetMosaicName)).getOutput(0)) - print("Footprint count: " + str(countFootprints)) - - if not countFootprints == 5: - print("ERROR: Expected five (5) footprints, found " + str(countFootprints)) - raise Exception("Test Failed") - - #Check for two 'primary' and three 'overview' in the 'category' field - #Frequency_analysis (in_table, out_table, frequency_fields, {summary_fields}) - tempFreqTable = os.path.join(TestUtilities.scratchGDB, "tempFreqTable") - arcpy.Frequency_analysis(os.path.join(targetGeodatabase, targetMosaicName), tempFreqTable, "Category") - freqTable = {} - rows = arcpy.da.SearchCursor(tempFreqTable, ["Category", "FREQUENCY"]) - for row in rows: - if row[0] == 1: - category = "Primary" - if row[0] == 2: - category = "Overview" - frequency = row[1] - freqTable[category] = frequency - - fail = False - if not freqTable["Primary"] == 2: - print("ERROR: Expected two (2) Primary footprints, found " + str(freqTable["Primary"])) - fail = True - if not freqTable["Overview"] == 3: - print("ERROR: Expected three (3) Overview footprints, found " + str(freqTable["Overview"])) - fail = True - if fail == True: - raise Exception("Test Failed") - else: - print("Test Passed") - - if arcpy.Exists(os.path.join(targetGeodatabase, targetMosaicName)): - arcpy.Delete_management(os.path.join(targetGeodatabase, targetMosaicName)) - if arcpy.Exists(tempFreqTable): - arcpy.Delete_management(tempFreqTable) - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) diff --git a/data_management/test/test_LiDAR/TestUtilities.py b/data_management/test/test_LiDAR/TestUtilities.py deleted file mode 100644 index 6be56c55..00000000 --- a/data_management/test/test_LiDAR/TestUtilities.py +++ /dev/null @@ -1,47 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) -lasSourcePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/las/")) - -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -toolbox = os.path.join(toolboxesPath, "LiDAR Elevation Tools_10.3.tbx") - -def createScratch(): - try: - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - return - -def deleteScratch(): - try: - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - return - -# create scratch -createScratch() diff --git a/data_management/test/test_LiDAR/build.xml b/data_management/test/test_LiDAR/build.xml deleted file mode 100644 index ad3f9530..00000000 --- a/data_management/test/test_LiDAR/build.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_adjust_sample_dates/TemplateConfigTest.py b/data_management/test/test_adjust_sample_dates/TemplateConfigTest.py deleted file mode 100644 index cb2fd0e5..00000000 --- a/data_management/test/test_adjust_sample_dates/TemplateConfigTest.py +++ /dev/null @@ -1,91 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name ) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) diff --git a/data_management/test/test_adjust_sample_dates/TestAdjustSampleDataDates.py b/data_management/test/test_adjust_sample_dates/TestAdjustSampleDataDates.py deleted file mode 100644 index b48a82d0..00000000 --- a/data_management/test/test_adjust_sample_dates/TestAdjustSampleDataDates.py +++ /dev/null @@ -1,135 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestAdjustSampleDataDates.py -# Description: Test Adjust Sample Daa Dates Toolbox -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os -import datetime - -class LicenseError(Exception): - ''' ''' - pass - -def createFeatureSet(): - ''' create in-memory features ''' - sr = arcpy.SpatialReference(4326) - fc = arcpy.CreateFeatureclass_management("in_memory", "tempfc", "POINT", - None, "DISABLED", "DISABLED", - sr)[0] - arcpy.AddField_management(fc, "datetimestart", "DATE",) - fields = ["SHAPE@XY", "datetimestart"] - rows = arcpy.da.InsertCursor(fc, fields) - pnt = arcpy.Point(0.0, 0.0) - dtValue = datetime.datetime(2000,01,01,00,00,00) - for x in range(0, 100): - rows.insertRow([pnt, dtValue]) - del rows - return fc - -def getFieldBefore(fc): - ''' get date/time field values before ''' - datetimeStart = {} - beforeRows = arcpy.da.SearchCursor(fc, ["OID@", "datetimestart"]) - for row in beforeRows: - datetimeStart[row[0]] = row[1] - del beforeRows - return datetimeStart - -def appendFieldAfter(fc,datetimeStart): - ''' add the date/time field values after the change ''' - afterRows = arcpy.da.SearchCursor(fc, ["OID@", "datetimestart"]) - for row in afterRows: - before = datetimeStart[row[0]] - after = row[1] - datetimeStart[row[0]] = [before,after] - return datetimeStart - -try: - print("Importing toolbox... ") - arcpy.ImportToolbox(TestUtilities.toolbox,"ajdustdates") - arcpy.env.overwriteOutput = True - - #Set tool param variables - print("Creating feature set... ") - inputFeatures = createFeatureSet() - - # get 'datetimestart' field values and OIDs - # {:[,]} - print("getting 'before' dates... ") - checkDates = getFieldBefore(inputFeatures) - - #Testing - arcpy.AddMessage("Running tool: Change Sample Data Dates to Recent Dates") - arcpy.ChangeSampleDataDatestoRecentDates_ajdustdates(inputFeatures) - - # get list of 'datetimestart' after tool run - print("getting 'after' dates... ") - checkDates = appendFieldAfter(inputFeatures, checkDates) - - # compare before and after values and report OIDs that are haven't changed or are NULL - print("Comparing values... ") - foundError = False - for key in checkDates.keys(): - vals = checkDates[key] - before, after = vals[0], vals[1] - if after == None: - print("OID " + str(key) + " has value NONE and was not updated: " + str(vals)) - foundError = True - if before == after: - print("OID " + str(key) + " value has not changed and was not updated: " + str(vals)) - foundError = True - else: - print("OID " + str(key) + " OK: " + str(vals)) - - if foundError == True: - raise "Date/time update failed!!!" - - print("Test Passed") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - \ No newline at end of file diff --git a/data_management/test/test_adjust_sample_dates/TestUtilities.py b/data_management/test/test_adjust_sample_dates/TestUtilities.py deleted file mode 100644 index 38951c68..00000000 --- a/data_management/test/test_adjust_sample_dates/TestUtilities.py +++ /dev/null @@ -1,29 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) - -toolbox = os.path.join(toolboxesPath, "Adjust Sample Data Dates Tools_10.3.tbx") - diff --git a/data_management/test/test_adjust_sample_dates/build.xml b/data_management/test/test_adjust_sample_dates/build.xml deleted file mode 100644 index 13eb8945..00000000 --- a/data_management/test/test_adjust_sample_dates/build.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_elevation_tools/TemplateConfigTest.py b/data_management/test/test_elevation_tools/TemplateConfigTest.py deleted file mode 100644 index 53cb6405..00000000 --- a/data_management/test/test_elevation_tools/TemplateConfigTest.py +++ /dev/null @@ -1,96 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath, TestUtilities.elevSourcePath]) - - for path2check in paths2Check: - if os.path.exists(path2check): - print("Valid Path: " + path2check) - else: - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.scratchGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None: - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else: - print("Valid Object: " + desc.Name ) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - \ No newline at end of file diff --git a/data_management/test/test_elevation_tools/TestCreateDerivedElevationMosaic.py b/data_management/test/test_elevation_tools/TestCreateDerivedElevationMosaic.py deleted file mode 100644 index effa23a3..00000000 --- a/data_management/test/test_elevation_tools/TestCreateDerivedElevationMosaic.py +++ /dev/null @@ -1,93 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestCreateDerivedElevationMosaic.py -# Description: Test Create Derived Elevation Mosaic -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - - print("Setting environment...") - arcpy.ImportToolbox(TestUtilities.toolbox,"elev") - arcpy.env.overwriteOutput = True - - #Set tool param variables - print("Setting inputs...") - targetGeodatabase = TestUtilities.scratchGDB - targetMosaicName = "DerivedDTM" - inputSourceMosaic = os.path.join(TestUtilities.scratchGDB,"DigitalTerrainModel") - - #Testing Create Derived Elevation Mosaic - arcpy.AddMessage("Starting Test: Create Derived Elevation Mosaic") - arcpy.createDerivedMD_elev(targetGeodatabase, targetMosaicName, arcpy.Describe(inputSourceMosaic).spatialReference, inputSourceMosaic) - - #Verify Results - print("Verifying results...") - countDTMFootprints = int(arcpy.GetCount_management(os.path.join(targetGeodatabase, targetMosaicName)).getOutput(0)) - print "DTM Footprint count: " + str(countDTMFootprints) - - if (countDTMFootprints < 1): - print("Less than one footprint! (" + str(countDTMFootprints) + ")") - raise Exception("Test Failed") - else: - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") - print("Deleting source mosaic...") - arcpy.Delete_management(inputSourceMosaic) - print("Deleteing derived mosaic...") - arcpy.Delete_management(os.path.join(targetGeodatabase, targetMosaicName)) diff --git a/data_management/test/test_elevation_tools/TestCreateSourceElevationMosaic.py b/data_management/test/test_elevation_tools/TestCreateSourceElevationMosaic.py deleted file mode 100644 index e7a9bcf6..00000000 --- a/data_management/test/test_elevation_tools/TestCreateSourceElevationMosaic.py +++ /dev/null @@ -1,94 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestCreateSourceElevationMosaic.py -# Description: Test Create Source Elevation Mosaic -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - - print("Setting environment...") - arcpy.ImportToolbox(TestUtilities.toolbox,"elev") - arcpy.env.overwriteOutput = True - - #Set tool param variables - print("Setting inputs...") - targetGeodatabase = TestUtilities.scratchGDB - rastypeDTED = "DTED" - targetMosaicName = "DigitalTerrainModel" - # TODO: need to define for GCS_WGS_1984 - coordinateSystem = arcpy.SpatialReference(4326) - inputElevationFolderPath = os.path.join(TestUtilities.elevSourcePath) - - #Testing Create Derived Elevation Mosaic - arcpy.AddMessage("Starting Test: Create Source Elevation Mosaic") - #createSourceMD_elev (workspace, md_name, spref, rastertype, datapath) - arcpy.createSourceMD_elev(targetGeodatabase, targetMosaicName, coordinateSystem, rastypeDTED, inputElevationFolderPath) - - #Verify Results - print("Verifying results...") - countDTMFootprints = int(arcpy.GetCount_management(os.path.join(targetGeodatabase, targetMosaicName)).getOutput(0)) - print "DTM Footprint count: " + str(countDTMFootprints) - - if (countDTMFootprints < 1): - print("Less than one footprint! (" + str(countDTMFootprints) + ")") - raise Exception("Test Failed") - else: - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") - \ No newline at end of file diff --git a/data_management/test/test_elevation_tools/TestUtilities.py b/data_management/test/test_elevation_tools/TestUtilities.py deleted file mode 100644 index 77e73039..00000000 --- a/data_management/test/test_elevation_tools/TestUtilities.py +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) -inputSourceMosaic = None -elevSourcePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/Topographic/Elevation/Source/")) - -inputGDB = os.path.join(geodatabasePath, "test_build_elevation_mosaic_inputs.gdb") -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -toolbox = os.path.join(toolboxesPath, "Elevation Tools.pyt") - -def createScratch(): - try: - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - return - -def deleteScratch(): - try: - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - return - -# create scratch -createScratch() diff --git a/data_management/test/test_elevation_tools/build.xml b/data_management/test/test_elevation_tools/build.xml deleted file mode 100644 index 3cabfc20..00000000 --- a/data_management/test/test_elevation_tools/build.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_geonames_tools/.project b/data_management/test/test_geonames_tools/.project deleted file mode 100644 index c7325105..00000000 --- a/data_management/test/test_geonames_tools/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - TestGeonamesTools - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/data_management/test/test_geonames_tools/.pydevproject b/data_management/test/test_geonames_tools/.pydevproject deleted file mode 100644 index c91cdd4e..00000000 --- a/data_management/test/test_geonames_tools/.pydevproject +++ /dev/null @@ -1,8 +0,0 @@ - - - -/TestGeonamesTools - -python 2.7 -Default - diff --git a/data_management/test/test_geonames_tools/TemplateConfigTest.py b/data_management/test/test_geonames_tools/TemplateConfigTest.py deleted file mode 100644 index f29d8676..00000000 --- a/data_management/test/test_geonames_tools/TemplateConfigTest.py +++ /dev/null @@ -1,95 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print "Testing ArcPy" - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/data_management/test/test_geonames_tools/TestCreateGeonamesGazetteerLocator.py b/data_management/test/test_geonames_tools/TestCreateGeonamesGazetteerLocator.py deleted file mode 100644 index 0bc35483..00000000 --- a/data_management/test/test_geonames_tools/TestCreateGeonamesGazetteerLocator.py +++ /dev/null @@ -1,94 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestCreateGeonamesGazetteerLocator.py -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -#This tool must be run after Load Geonames File Tool - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: Create Geonames Gazetteer Locator") - - toolbox = TestUtilities.toolbox - arcpy.ImportToolbox(toolbox, "DefenseGeonames") - arcpy.env.overwriteOutput = True - featureClass = os.path.join(TestUtilities.inputGDB, "GeonamesTestPy") - - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - - locatorName = "GeonamesLocator" - locatorFullPath = os.path.join(TestUtilities.inputGDB, locatorName) - - if arcpy.Exists(locatorFullPath): - print("deleting: " + locatorFullPath) - - # ================================================================== - # ERROR 000317: ..\Geonames.gdb\GeonamesLocator cannot be deleted - # https://github.com/Esri/solutions-geoprocessing-toolbox/issues/101 - # THIS IS A BUG IN ArcGIS Desktop 10.2.2, and 10.3 - arcpy.Delete_management(locatorFullPath,r"AddressLocator") - # - # ================================================================== - - - arcpy.AddMessage("Starting Create Geonames Gazetteer Locator tool...") - ########################################################3 - # Execute the Model under test: - arcpy.CreateGeonamesGazetteerLocator_DefenseGeonames(featureClass,locatorFullPath) - ######################################################## - - # Check For Valid Input - print("Locator Created: " + str(locatorFullPath)) - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_geonames_tools/TestLoadGeonamesFile.py b/data_management/test/test_geonames_tools/TestLoadGeonamesFile.py deleted file mode 100644 index 32d32ee5..00000000 --- a/data_management/test/test_geonames_tools/TestLoadGeonamesFile.py +++ /dev/null @@ -1,91 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestLoadGeonamesFile.py -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -#This tool must be run first, before create geonames gazetteer locator - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: Load Geonames File") - - toolbox = TestUtilities.toolbox - arcpy.ImportToolbox(toolbox, "DefenseGeonames") - arcpy.env.overwriteOutput = True - - featureClass = os.path.join(TestUtilities.inputGDB, "GeonamesTestPy") - textfile = os.path.join(TestUtilities.geodatabasePath, "fr.txt") - #textfile = os.path.join(TestUtilities.geodatabasePath, "af.txt") - countryCodes = os.path.join(TestUtilities.inputGDB, "CountryCodes") - adminCodes = os.path.join(TestUtilities.inputGDB, "AdminCodes") - featureCodes = os.path.join(TestUtilities.inputGDB, "FeatureCodes") - - - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - - arcpy.AddMessage("Deleting features from GeonamesTestPy") - arcpy.DeleteFeatures_management(featureClass) - - arcpy.AddMessage("Starting Load Geonames File tool...") - ######################################################## - # Execute the Model under test: - arcpy.LoadGeonamesFile_DefenseGeonames(featureClass,textfile,countryCodes,adminCodes,featureCodes) - ######################################################## - - # Check For Valid Input - inputFeatureCount = int(arcpy.GetCount_management(featureClass).getOutput(0)) - print("Input FeatureClass: " + str(featureClass)) - print("Input Feature Count: " + str(inputFeatureCount)) - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_geonames_tools/TestUtilities.py b/data_management/test/test_geonames_tools/TestUtilities.py deleted file mode 100644 index aa7ccadd..00000000 --- a/data_management/test/test_geonames_tools/TestUtilities.py +++ /dev/null @@ -1,32 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestUtilities.py -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import os - - -currentPath = os.path.dirname(__file__) -print "currentPath: " + currentPath -geodatabasePath = os.path.normpath(os.path.join(os.path.join(currentPath, r"../../../data_management/data/Geonames"))) -print "geodatabasePath: " + geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) -print "toolboxesPath: " + toolboxesPath - -inputGDB = os.path.join(geodatabasePath, "Geonames.gdb") - -toolbox = os.path.join(toolboxesPath, "Geonames Tools_10.3.tbx") - diff --git a/data_management/test/test_geonames_tools/build.xml b/data_management/test/test_geonames_tools/build.xml deleted file mode 100644 index ed70d2f5..00000000 --- a/data_management/test/test_geonames_tools/build.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_import_and_conversion/TestCoordinateConversion.py b/data_management/test/test_import_and_conversion/TestCoordinateConversion.py deleted file mode 100644 index 6aaae08f..00000000 --- a/data_management/test/test_import_and_conversion/TestCoordinateConversion.py +++ /dev/null @@ -1,101 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestCoordinateConversion.py -# Description: Automatic Test of Range Rings Model -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: CoordinateConversion") - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - inputTable = os.path.join(TestUtilities.csvPath, "SigActs.csv") - outputDbf = os.path.join(TestUtilities.scratchPath, "test_coordinate_cc.dbf") - toolbox = TestUtilities.toolbox - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "InC") - - inputFeatureCount = int(arcpy.GetCount_management(inputTable).getOutput(0)) - print("Input FeatureClass: " + str(inputTable)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - coordinateConversionFrom = 'MGRS' - coordinateFieldX = 'Location' - coordinateFieldY = None - - ########################################################3 - arcpy.ConvertCoordinates_InC(inputTable, coordinateConversionFrom, coordinateFieldX, coordinateFieldY, outputDbf) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputDbf).getOutput(0)) - print("Output FeatureClass: " + str(outputDbf)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount <> inputFeatureCount) : - print("Input / Output Feature Count don't match: " + str(inputFeatureCount) + ":" + str(outputFeatureCount)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_import_and_conversion/TestTableToGeometry.py b/data_management/test/test_import_and_conversion/TestTableToGeometry.py deleted file mode 100644 index 3aed059d..00000000 --- a/data_management/test/test_import_and_conversion/TestTableToGeometry.py +++ /dev/null @@ -1,247 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TableToGeometry.py -# Description: Automatic Test of Range Rings Model -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTestTableToPoints(): - - arcpy.AddMessage("Starting Test: TableToPoint") - - inputTable = os.path.join(TestUtilities.csvPath, "pointwizard.csv") - outputPointsFC = os.path.join(TestUtilities.outputGDB, "TableToPoint") - - inputFeatureCount = int(arcpy.GetCount_management(inputTable).getOutput(0)) - print("Input FeatureClass: " + str(inputTable)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - coordinateConversionFormat = 'MGRS' - coordinateFieldX = 'MGRS' - coordinateFieldY = 'MGRS' - - ########################################################3 - # Execute the Model under test: - - # sample params: - # '\csv\ConversionPoints.csv', 'MGRS', 'MGRS', 'MGRS', 'geodatabases\test_outputs.gdb\TableToPoint' - - arcpy.TableToPoint_InC(inputTable, coordinateConversionFormat, coordinateFieldX, coordinateFieldY, outputPointsFC) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount <> inputFeatureCount) : - print("Input / Output Feature Count don't match: " + str(inputFeatureCount) + ":" + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Successful") - -def RunTestTableToPolyline(): - - arcpy.AddMessage("Starting Test: TableToPolyline") - - inputTable = os.path.join(TestUtilities.csvPath, "linewizard.csv") - outputLinesFC = os.path.join(TestUtilities.outputGDB, "TableToLine") - - inputFeatureCount = int(arcpy.GetCount_management(inputTable).getOutput(0)) - print("Input FeatureClass: " + str(inputTable)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - coordinateConversionFormat = 'DD_2' - coordinateFieldX = 'Lond' - coordinateFieldY = 'Latd' - lineJoinIdField = 'Id' - - ########################################################3 - # Execute the Model under test: - - # sample params: - # 'data\csv\linewizard.csv', 'DD_2', 'Lond', 'Latd', - # 'data\geodatabases\test_outputs.gdb\TableToMultipoint', 'Id', "#', "#' - - arcpy.TableToPolyline_InC(inputTable, coordinateConversionFormat, coordinateFieldX, coordinateFieldY, outputLinesFC, lineJoinIdField) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputLinesFC).getOutput(0)) - print("Output FeatureClass: " + str(outputLinesFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1) : - print("Input / Output Feature Count < 1: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Successful") - -def RunTestTableToEllipse(): - - arcpy.AddMessage("Starting Test: TableToEllipse") - - inputTable = os.path.join(TestUtilities.csvPath, "ellipsewizard.csv") - outputEllipsesFC = os.path.join(TestUtilities.outputGDB, "TableToEllipse") - - inputFeatureCount = int(arcpy.GetCount_management(inputTable).getOutput(0)) - print("Input FeatureClass: " + str(inputTable)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - coordinateConversionFormat = 'DD_2' - coordinateFieldX = 'Lond' - coordinateFieldY = 'Latd' - majorAxisField = 'Major' - minorAxisField = 'Minor' - axisUnit = 'KILOMETERS' - orientationField = 'Orient' - orientationUnit = 'DEGREES' - sr = '#' - - ########################################################3 - # Execute the Model under test: - - # sample params: - # 'data\csv\ellipsewizard.csv', 'DD_2', 'Lond', 'Latd', 'Major', 'Minor', 'KILOMETERS', 'Orient', 'DEGREES' - # '#', 'geodatabases\test_outputs.gdb\TableToEllipse' - arcpy.TableToEllipse_InC(inputTable, coordinateConversionFormat, coordinateFieldX, coordinateFieldY, majorAxisField, - minorAxisField, axisUnit, outputEllipsesFC, orientationField, orientationUnit, sr) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputEllipsesFC).getOutput(0)) - print("Output FeatureClass: " + str(outputEllipsesFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount <> inputFeatureCount) : - print("Input / Output Feature Count don't match: " + str(inputFeatureCount) + ":" + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Successful") - -def RunTestTableToLOB(): - - arcpy.AddMessage("Starting Test: TableToLOB") - - inputTable = os.path.join(TestUtilities.csvPath, "lobwizard.csv") - outputLinesFC = os.path.join(TestUtilities.outputGDB, "TableToLOB") - - inputFeatureCount = int(arcpy.GetCount_management(inputTable).getOutput(0)) - print("Input FeatureClass: " + str(inputTable)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - coordinateConversionFormat = 'DD_2' - coordinateFieldX = 'Lond' - coordinateFieldY = 'Latd' - bearingUnit = 'DEGREES' - bearingField = 'Azimuth' - distanceUnit = 'METERS' - distanceField = 'Distance' - lineType = 'GEODESIC' - - ########################################################3 - # Execute the Model under test: - - # sample params: - # 'data\csv\lobwizard.csv', 'DD_2', 'Lond', 'Latd', 'DEGREES', 'Azimuth', 'METERS', - # 'Distance', 'GEODESIC', 'data\geodatabases\test_outputs\TableToLOB' - - arcpy.TableToLOB_InC(inputTable, coordinateConversionFormat, coordinateFieldX, coordinateFieldY, bearingUnit, - bearingField, distanceUnit, distanceField, outputLinesFC, lineType) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputLinesFC).getOutput(0)) - print("Output FeatureClass: " + str(outputLinesFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount <> inputFeatureCount) : - print("Input / Output Feature Count don't match: " + str(inputFeatureCount) + ":" + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Successful") - -try: - - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - print("Creating New Scratch Workspace") - TestUtilities.createScratch() - - toolbox = TestUtilities.toolbox - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "InC") - - ################################################ - # Run Individual Geometry Importer Tests - print("Testing all TableTo{Geometry} Models...") - - RunTestTableToPoints() - RunTestTableToPolyline() - RunTestTableToEllipse() - RunTestTableToLOB() - - - ################################################ - - print("Deleting Scratch Workspace") - TestUtilities.deleteScratch() - -except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - diff --git a/data_management/test/test_import_and_conversion/TestTemplateConfig.py b/data_management/test/test_import_and_conversion/TestTemplateConfig.py deleted file mode 100644 index 1bcdb996..00000000 --- a/data_management/test/test_import_and_conversion/TestTemplateConfig.py +++ /dev/null @@ -1,101 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - - if not arcpy.Exists(TestUtilities.scratchGDB) == True: - print("scratchGDB does not exist ... creating...") - TestUtilities.createScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, \ - TestUtilities.csvPath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB, TestUtilities.defaultGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/data_management/test/test_import_and_conversion/TestUtilities.py b/data_management/test/test_import_and_conversion/TestUtilities.py deleted file mode 100644 index cc202f25..00000000 --- a/data_management/test/test_import_and_conversion/TestUtilities.py +++ /dev/null @@ -1,51 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -csvPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/csv/")) - -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../toolboxes/")) - -inputGDB = os.path.join(geodatabasePath, "test_position_analysis_inputs.gdb") -#outputGDB = os.path.join(geodatabasePath, "test_outputs.gdb") -#defaultGDB = os.path.join(geodatabasePath, "default.gdb") -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -outputGDB = scratchGDB -defaultGDB = scratchGDB -toolbox = os.path.join(toolboxesPath, "Import and Conversion Tools_10.3.tbx") - -def createScratch() : - try : - print("creating 'scratch' in " + str(scratchPath)) - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - return - -def deleteScratch() : - try : - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - return diff --git a/data_management/test/test_import_and_conversion/build.xml b/data_management/test/test_import_and_conversion/build.xml deleted file mode 100644 index fb92ca08..00000000 --- a/data_management/test/test_import_and_conversion/build.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_network_data_prep/TestAddOrientationAngleToLines.py b/data_management/test/test_network_data_prep/TestAddOrientationAngleToLines.py deleted file mode 100644 index ba4f1ca5..00000000 --- a/data_management/test/test_network_data_prep/TestAddOrientationAngleToLines.py +++ /dev/null @@ -1,81 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestAddOrienationAngleToLines.py -# Description: Test Add Orienation Angle To Lines -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - #Set tool param variables - # mfunk 7/30/2013: this tool must run AFTER TestSplitLinesAtIntersections.py - inputRoadFeatures = os.path.join(TestUtilities.outputGDB,"RoadFeat") - inputAngleField = "aoo" - - #Testing Add Orientation Angle To Lines - arcpy.AddMessage("Starting Test: Add Orientation Angle To Lines") - arcpy.AddOrientationAngleToLines_netprep(inputRoadFeatures,inputAngleField) - - #Verify Results - - # mfunk 7/29/2013: Not sure best way to verify results of this test. This tool - # modifies an existing field in the input data. Guess as long as it doesn't fail? - print("Test Passed") - - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_network_data_prep/TestAddTravelTimeToRoads.py b/data_management/test/test_network_data_prep/TestAddTravelTimeToRoads.py deleted file mode 100644 index 0ab5503d..00000000 --- a/data_management/test/test_network_data_prep/TestAddTravelTimeToRoads.py +++ /dev/null @@ -1,85 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestAddTravelTimeToRoads.py -# Description: Test Add Travel Time To Roads Tool -# Requirements: ArcGIS Desktop Advanced -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - #Set tool param variables - # mfunk 7/30/2013: this tool must run AFTER TestSplitLinesAtIntersections.py - inputRoadFeatures = os.path.join(TestUtilities.outputGDB,"RoadFeat") - inputTravelVelocityTable = os.path.join(TestUtilities.inputGDB,"RoadTravelVelocity") - - #Testing - arcpy.AddMessage("Starting Test: Add Travel Time To Roads") - arcpy.AddTravelTimeToRoads_netprep(inputRoadFeatures,inputTravelVelocityTable) - - #Verify Results - - #check output fields are there - fieldNames = [] - for field in arcpy.ListFields(inputRoadFeatures): fieldNames.append(field.name) - if not ("FT_MINUTES" in fieldNames) or not ("TF_MINUTES" in fieldNames): - raise Exception("Output field (TF_MINUTES or FT_MINUTES) are not present in output") - - print("Test Passed") - - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_network_data_prep/TestSplitLinesAtIntersections.py b/data_management/test/test_network_data_prep/TestSplitLinesAtIntersections.py deleted file mode 100644 index 1c579e03..00000000 --- a/data_management/test/test_network_data_prep/TestSplitLinesAtIntersections.py +++ /dev/null @@ -1,97 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestSplitLinesAtIntersections.py -# Description: Test Split Lines At Intersections Tool -# Requirements: ArcGIS Desktop Advanced -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - #check product for Advanced (ArcInfo) - productLevel = arcpy.CheckProduct("ArcInfo") - print("CheckProduct(ArcInfo): " + productLevel) - - if (productLevel == "Available"): - import arcinfo - elif (productLevel != "Available") and (productLevel != "AlreadyInitialized"): - raise Exception("Advanced license is required") - - - #Set tool param variables - inputUTDSRoadFeatures = os.path.join(TestUtilities.inputGDB,"UTDSRoads") - outputSplitRoadFeatures = os.path.join(TestUtilities.outputGDB,"RoadFeat") - - #Testing Build Elevation Mosaics - DTED input - arcpy.AddMessage("Starting Test: Split Lines At Intersection (this test may take a while)") - arcpy.SplitLinesAtIntersections_netprep(inputUTDSRoadFeatures,outputSplitRoadFeatures) - - #Verify Results - countBeforeRoadFeatures = int(arcpy.GetCount_management(inputUTDSRoadFeatures).getOutput(0)) - print("Before road feature count: " + str(countBeforeRoadFeatures)) - - countAfterRoadFeatures = int(arcpy.GetCount_management(outputSplitRoadFeatures).getOutput(0)) - print("After road feature count: " + str(countAfterRoadFeatures)) - - if (countBeforeRoadFeatures >= countAfterRoadFeatures): - print("Feature count is not greater") - raise Exception("Test Failed") - - print("Test Passed") - - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_network_data_prep/TestTemplateConfig.py b/data_management/test/test_network_data_prep/TestTemplateConfig.py deleted file mode 100644 index 0dcccf05..00000000 --- a/data_management/test/test_network_data_prep/TestTemplateConfig.py +++ /dev/null @@ -1,95 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Advanced -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/data_management/test/test_network_data_prep/TestUtilities.py b/data_management/test/test_network_data_prep/TestUtilities.py deleted file mode 100644 index 8579504d..00000000 --- a/data_management/test/test_network_data_prep/TestUtilities.py +++ /dev/null @@ -1,52 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Advanced -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys - -# properties: paths -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) -# properties: geodatabases -inputGDB = os.path.join(geodatabasePath, "NetworkPrepData.gdb") -outputGDB = os.path.join(geodatabasePath, "test_outputs.gdb") -# if the output doesn't exist, create it -if not arcpy.Exists(outputGDB): arcpy.CreateFileGDB_management(os.path.dirname(outputGDB),os.path.basename(outputGDB)[:-4]) - -# properties: toolboxescls -toolbox = os.path.join(toolboxesPath, "Network Data Preparation Tools_10.3.tbx") - -def createScratch() : - try : - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print "scratch.gdb already exists" - - return - -def deleteScratch() : - try : - arcpy.Delete_management(scratchGDB) - except: - print "scratch.gdb delete failed" - - return diff --git a/data_management/test/test_network_data_prep/build.xml b/data_management/test/test_network_data_prep/build.xml deleted file mode 100644 index 7fe3881a..00000000 --- a/data_management/test/test_network_data_prep/build.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_patrol_data_capture/TestAppendTrackstoDB.py b/data_management/test/test_patrol_data_capture/TestAppendTrackstoDB.py deleted file mode 100644 index fe68ee32..00000000 --- a/data_management/test/test_patrol_data_capture/TestAppendTrackstoDB.py +++ /dev/null @@ -1,108 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestAppendTrackstoDB.py -# Description: Automatic Test of GP script/toolbox -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback -import TestUtilities - -def RunTest(): - try: - print("Starting Test: TestAppendTrackstoDB") - print("Setting up inputs and environment...") - inputLinesFC = os.path.join(TestUtilities.outputGDB, "TrackLines") - inputPointsFC = os.path.join(TestUtilities.outputGDB, "SeparatedGPSData") - print("Setting up targetPoints...") - arcpy.env.overwriteOutput = True - arcpy.ImportToolbox(TestUtilities.toolbox, "pdc") - targetTrackPoints = os.path.join(TestUtilities.scratchGDB, "targetPoints") - arcpy.CreateFeatureclass_management(TestUtilities.scratchGDB, os.path.basename(targetTrackPoints), "POINT", - inputPointsFC, "SAME_AS_TEMPLATE", "SAME_AS_TEMPLATE", - arcpy.Describe(inputPointsFC).spatialReference) - print("Setting up targetLines...") - targetTrackLines = os.path.join(TestUtilities.scratchGDB, "targetLines") - arcpy.CreateFeatureclass_management(TestUtilities.scratchGDB, os.path.basename(targetTrackLines), "POLYLINE", - inputLinesFC, "SAME_AS_TEMPLATE", "SAME_AS_TEMPLATE", - arcpy.Describe(inputLinesFC).spatialReference) - - # How many rows before joining? - beforeSourcePointRowCount = int(arcpy.GetCount_management(inputPointsFC).getOutput(0)) - print("Number of rows in source points before: " + str(beforeSourcePointRowCount)) - beforeSourceLineRowCount = int(arcpy.GetCount_management(inputLinesFC).getOutput(0)) - print("Number of rows in source lines before: " + str(beforeSourceLineRowCount)) - beforeTargetPointRowCount = int(arcpy.GetCount_management(targetTrackPoints).getOutput(0)) - print("Number of rows in target points before: " + str(beforeTargetPointRowCount)) - beforeTargetLineRowCount = int(arcpy.GetCount_management(targetTrackLines).getOutput(0)) - print("Number of rows in target lines before: " + str(beforeTargetLineRowCount)) - - print("running AppendTrackstoDB_pdc...") - ######################################################## - # Execute the Model under test: - # AppendTrackstoDB_pdc (SeparatedGPSData, TrackLines, Patrol_Track_Points, PatrolTracks) - arcpy.AppendTrackstoDB_pdc(inputPointsFC, inputLinesFC, targetTrackPoints, targetTrackLines) - ######################################################## - - print("Verify the results...") - afterTargetPointRowCount = int(arcpy.GetCount_management(targetTrackPoints).getOutput(0)) - afterTargetLineRowCount = int(arcpy.GetCount_management(targetTrackLines).getOutput(0)) - - if not (afterTargetPointRowCount == beforeSourcePointRowCount): - print("ERROR: Target point rows don't match source point rows: source " + \ - str(beforeSourcePointRowCount) + ", target: " + str(afterTargetPointRowCount)) - raise Exception("Test Failed") - elif not (afterTargetLineRowCount == beforeSourceLineRowCount): - print("ERROR: Target line rows don't match source line rows: source" + \ - str(beforeSourceLineRowCount) + ", target: " + str(afterTargetLineRowCount)) - raise Exception("Test Failed") - else: - print("Test Successful") - print("Number of rows in target points after: " + str(afterTargetPointRowCount)) - print("Number of rows in target lines after: " + str(afterTargetLineRowCount)) - print("Deleteing target datasets...") - arcpy.Delete_management(targetTrackPoints) - arcpy.Delete_management(targetTrackLines) - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - print(pymsg) - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestDespikeGps.py b/data_management/test/test_patrol_data_capture/TestDespikeGps.py deleted file mode 100644 index 0fbccdb3..00000000 --- a/data_management/test/test_patrol_data_capture/TestDespikeGps.py +++ /dev/null @@ -1,106 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestDespikeGps.py -# Description: Automatic Test of GP script/toolbox -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: TestDespikeGps") - - # Prior to this, run TestTemplateConfig.py to verify the expected configuration exists - - inputTrackPointsFC = os.path.join(TestUtilities.inputGDB, "SeparatedGPSData") - - outputPointsFC = os.path.join(TestUtilities.outputGDB, "DespikedGPSData") - - toolbox = TestUtilities.toolbox - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.ImportToolbox(toolbox, "pdc") - - dateTimeField = "Date_Time" - trackIdField = "TrackGUID" - percent2Test = 0.5 - maximumDeviation = 90.0 - - ######################################################## - # Execute the Model under test: - # Format: DespikeGPSLog_MyAlias(GPS_Data_with_Track_Identifiers, DateTime_Field, Track_ID_Field, Despiked_GPS_Log, Percent_to_test, Maximum_Deviation) - arcpy.DespikeGPSLog_pdc(inputTrackPointsFC, dateTimeField, trackIdField, outputPointsFC, percent2Test, maximumDeviation) - ######################################################## - - # Verify the results (Spike Points) - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass (Points): " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - outputSpikePointsLayer = "DespikedGPSData_layer" - - arcpy.MakeFeatureLayer_management(outputPointsFC, outputSpikePointsLayer) - query = "IsSpike = 'true'" - - arcpy.SelectLayerByAttribute_management(outputSpikePointsLayer, "NEW_SELECTION", query) - - spikedCount = arcpy.GetCount_management(outputSpikePointsLayer) - print("Number of Spiked Records is: " + str(spikedCount)) - - if (spikedCount < 1): - print("Invalid Spiked Feature Count: " + str(spikedCount)) - raise Exception("Test Failed") - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestDistiguishTracks.py b/data_management/test/test_patrol_data_capture/TestDistiguishTracks.py deleted file mode 100644 index 788d2630..00000000 --- a/data_management/test/test_patrol_data_capture/TestDistiguishTracks.py +++ /dev/null @@ -1,96 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestDistiguishTracks.py -# Description: Automatic Test of GP script/toolbox -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: TestDistiguishTracks") - - # Prior to this, run TestTemplateConfig.py to verify the expected configuration exists - inputTrackPointsFC = os.path.join(TestUtilities.inputGDB, "GPSData") - outputPointsFC = os.path.join(TestUtilities.outputGDB, "SeparatedGPSData") - outputLinesFC = os.path.join(TestUtilities.outputGDB, "TrackLines") - toolbox = TestUtilities.toolbox - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.ImportToolbox(toolbox, "pdc") - - dateTimeField = "Date_Time" - maximumTimeDelta = 100.0 - - ######################################################## - # Execute the Model under test: - # Format: DistinguishTracks_MyAlias(GPS_Data, DateTime_Field, Maximum_Time_Difference, SeparatedGPSData, TrackLines) - arcpy.DistinguishTracks_pdc(inputTrackPointsFC, dateTimeField, maximumTimeDelta, outputPointsFC, outputLinesFC) - ######################################################## - - # Verify the results (Track Points) - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass (Points): " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - # Verify the results (Track Lines) - outputFeatureCount = int(arcpy.GetCount_management(outputLinesFC).getOutput(0)) - print("Output FeatureClass (Lines): " + str(outputLinesFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestGpx2Layer.py b/data_management/test/test_patrol_data_capture/TestGpx2Layer.py deleted file mode 100644 index 54f8eab2..00000000 --- a/data_management/test/test_patrol_data_capture/TestGpx2Layer.py +++ /dev/null @@ -1,84 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------- -# TestGpx2Layer.py -# Description: Automatic Test of GP script/toolbox -# Requirements: ArcGIS Desktop Standard -# ------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: TestGpx2Layer") - - # Prior to this, run TestTemplateConfig.py to verify the expected configuration exists - - inputGpxFile = TestUtilities.gpxFile - outputPointsFC = os.path.join(TestUtilities.outputGDB, "GPSData") - toolbox = TestUtilities.toolbox - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.ImportToolbox(toolbox, "pdc") - - ########################################################3 - # Execute the Model under test: - arcpy.GPX2Layer_pdc(inputGpxFile, outputPointsFC) - ########################################################3 - - # Verify the results (Track Points) - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass (Points): " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestImportPatrolRpt.py b/data_management/test/test_patrol_data_capture/TestImportPatrolRpt.py deleted file mode 100644 index 5d7c4993..00000000 --- a/data_management/test/test_patrol_data_capture/TestImportPatrolRpt.py +++ /dev/null @@ -1,112 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestImportPatrolRpt.py -# Description: Automatic Test of GP script/toolbox -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback -import TestUtilities - -def RunTest(): - try: - print("Starting Test: TestImportPatrolRpt") - print("Setting up inputs and environment...") - inputLinesFC = os.path.join(TestUtilities.outputGDB, "TrackLines") - inputPatrolReportTable = os.path.join(TestUtilities.patrolReportTable) - inputEnemySightingsTable = os.path.join(TestUtilities.enemySightingsTable) - xmlPatrolReport = os.path.join(TestUtilities.xmlPatrolReport) - arcpy.env.overwriteOutput = True - arcpy.ImportToolbox(TestUtilities.toolbox, "pdc") - - # How many rows before joining? - beforePRRowCount = int(arcpy.GetCount_management(inputPatrolReportTable).getOutput(0)) - print("Number of rows in Patrol Report Table before: " + str(beforePRRowCount)) - beforeESRowCount = int(arcpy.GetCount_management(inputEnemySightingsTable).getOutput(0)) - print("Number of rows in Enemy Sightings Table before: " + str(beforeESRowCount)) - - print("Selecting track OBJECTID = 2 for report...") - arcpy.MakeFeatureLayer_management(inputLinesFC, "inputLinesFC_layer") - selectionType = "NEW_SELECTION" - expression = "OBJECTID = 2" - arcpy.SelectLayerByAttribute_management("inputLinesFC_layer", selectionType, expression) - tempInputTracks = os.path.join(TestUtilities.scratchGDB,"tracks") - arcpy.CopyFeatures_management("inputLinesFC_layer",tempInputTracks) - print("Input features have " + str(arcpy.GetCount_management(tempInputTracks).getOutput(0)) + " rows") - - print("Checking input field type...") - trackIDFieldName = "TrackGUID" - trackIDField = None - fields = arcpy.ListFields(tempInputTracks,trackIDFieldName) - for field in fields: - trackIDField = field - - - print("Executing ImportPatrolReport_pdc...") - import types - print("trackIDField python type: " + str(type(trackIDField))) - print("trackIDField.type: " + str(trackIDField.type)) - print("trackIDField.name: " + str(trackIDField.name)) - ######################################################## - # Execute the Model under test: - # ImportPatrolReport_pdc (Track_Lines, Track_ID_Field, Infopath_Patrol_Report_XML, PatrolReport_Table, EnemySightings_Table) - arcpy.ImportPatrolReport_pdc(tempInputTracks, trackIDField.name, xmlPatrolReport, inputPatrolReportTable, inputEnemySightingsTable) - ######################################################## - - print("Verify the results...") - afterPRRowCount = int(arcpy.GetCount_management(inputPatrolReportTable).getOutput(0)) - afterESRowCount = int(arcpy.GetCount_management(inputEnemySightingsTable).getOutput(0)) - - if not (afterPRRowCount > beforePRRowCount): - print("ERROR: Patrol Report rows before: " + str(beforePRRowCount) + ", after: " + str(afterPRRowCount)) - raise Exception("Test Failed") - elif not (afterESRowCount > beforeESRowCount): - print("ERROR: Enemy Sightings rows before: " + str(beforeESRowCount) + ", after: " + str(afterESRowCount)) - raise Exception("Test Failed") - else: - print("Test Successful") - print("Number of rows in Patrol Report Table after: " + str(afterPRRowCount)) - print("Number of rows in Enemy Sightings Table after: " + str(afterESRowCount)) - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - print(pymsg) - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestRejoinTrackParts.py b/data_management/test/test_patrol_data_capture/TestRejoinTrackParts.py deleted file mode 100644 index 5da84996..00000000 --- a/data_management/test/test_patrol_data_capture/TestRejoinTrackParts.py +++ /dev/null @@ -1,116 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestRejoinTrackParts.py -# Description: Automatic Test of GP script/toolbox -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback -import TestUtilities - -def UniquePointGUIDs(pointFC,guidFieldName): - countPointGUIDs = 0 - freqTable = os.path.join(TestUtilities.scratchGDB, "freqTable") - arcpy.Frequency_analysis(pointFC, freqTable, guidFieldName) - countPointGUIDs = int(arcpy.GetCount_management(freqTable).getOutput(0)) - arcpy.Delete_management(freqTable) - return countPointGUIDs - -def RunTest(): - try: - print("Starting Test: TestRejoinTrackParts") - print("Setting up inputs and environment...") - inputLinesFC = os.path.join(TestUtilities.outputGDB, "TrackLines") - inputSeparatedPointsFC = os.path.join(TestUtilities.outputGDB, "SeparatedGPSData") - arcpy.env.overwriteOutput = True - arcpy.ImportToolbox(TestUtilities.toolbox, "pdc") - trackIDField = "TrackGUID" - startDateTimeField = "StartDateTime" - finishDateTimeField = "FinishDateTime" - dateTimeField = "Date_Time" - - # How many tracks before joining? - beforeTrackCount = int(arcpy.GetCount_management(inputLinesFC).getOutput(0)) - print("Number of tracks before joining: " + str(beforeTrackCount)) - beforePointCount = UniquePointGUIDs(inputSeparatedPointsFC,trackIDField) - print("Number of unique track GUIDs in points before joining: " + str(beforePointCount)) - - print("Selecting 4 tracks to join (OIDs: 2,3,4,5)...") - arcpy.MakeFeatureLayer_management(inputLinesFC, "inputLinesFC") - selectionType = "NEW_SELECTION" - expression = "OBJECTID = 2 OR OBJECTID = 3 OR OBJECTID = 4 OR OBJECTID = 5" - arcpy.SelectLayerByAttribute_management("inputLinesFC", selectionType, expression) - - print("Executing RejoinTrackParts_pdc...") - ######################################################## - # Execute the Model under test: - # RejoinTrackParts_pdc (TrackLines, SeparatedGPSData, Track_ID_Field, Start_DateTime_Field, Finish_DateTime_Field, DateTime_Field) - arcpy.RejoinTrackParts_pdc ("inputLinesFC", inputSeparatedPointsFC, trackIDField, startDateTimeField, finishDateTimeField, dateTimeField) - ######################################################## - - # Verify the results - afterTrackCount = int(arcpy.GetCount_management(inputLinesFC).getOutput(0)) - afterPointCount = UniquePointGUIDs(inputSeparatedPointsFC,trackIDField) - - if (beforeTrackCount == afterTrackCount): - print("ERROR: Before track count (" + str(beforeTrackCount) + ") is the same as after track count (" + str(afterTrackCount) + "). No track joined.") - raise Exception("Test Failed") - elif (beforePointCount == afterPointCount): - print("ERROR: Before gps point GUID count (" + str(beforePointCount) + ") is the same as afterwards (" + str(afterPointCount) + "). Expecting fewer GUIDs.") - print("Track lines before: " + str(beforeTrackCount)) - print("Track lines after: " + str(afterTrackCount)) - raise Exception("Test Failed") - elif (beforeTrackCount < afterTrackCount): - print("ERROR: Found " + str(afterTrackCount) + " tracks after joining. Expected fewer than " + str(beforeTrackCount) + ".") - raise Exception("Test Failed") - elif (beforePointCount < afterPointCount): - print("ERROR: Found " + str(afterPointCount) + " gps GUIDs points after joining. Expected fewer than " + str(beforePointCount) + ".") - print("Track lines before: " + str(beforeTrackCount)) - print("Track lines after: " + str(afterTrackCount)) - raise Exception("Test Failed") - else: - print("Test Successful") - print("Track lines before: " + str(beforeTrackCount)) - print("Track lines after: " + str(afterTrackCount)) - - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestRemoveDuplicateData.py b/data_management/test/test_patrol_data_capture/TestRemoveDuplicateData.py deleted file mode 100644 index 01dfb411..00000000 --- a/data_management/test/test_patrol_data_capture/TestRemoveDuplicateData.py +++ /dev/null @@ -1,113 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestRemoveDuplicateData.py -# Description: Automatic Test of GP script/toolbox -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: TestRemoveDuplicateData") - - # Prior to this, run TestTemplateConfig.py to verify the expected configuration exists - - inputTrackPointsFC = os.path.join(TestUtilities.inputGDB, "GPSData") - - outputPointsFC = os.path.join(TestUtilities.outputGDB, "GPSData_Duplicates") - - try : - # Delete Output if it exists - desc = arcpy.Describe(outputPointsFC) - if desc != None : - print("Deleting: " + str(outputPointsFC)) - arcpy.Delete_management(outputPointsFC) - except: - print("Delete failed for: " + str(outputPointsFC)) - - try : - # Copy Input (with Duplicates) to Output - print("Copying " + str(inputTrackPointsFC) + " --> " + str(outputPointsFC)) - arcpy.Copy_management(inputTrackPointsFC, outputPointsFC) - except: - print("Copy failed for: " + str(inputTrackPointsFC) + ":" + str(outputPointsFC)) - - toolbox = TestUtilities.toolbox - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.ImportToolbox(toolbox, "pdc") - - ########################################################3 - # Execute the Model under test: - arcpy.RemoveDuplicateGPSData_pdc(outputPointsFC) - ########################################################3 - - # Verify the results (Original Track Points) - inputFeatureCount = int(arcpy.GetCount_management(inputTrackPointsFC).getOutput(0)) - print("Input FeatureClass: " + str(inputTrackPointsFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Output Feature Count: " + str(inputFeatureCount)) - raise Exception("Test Failed") - - # There is only 1 duplicate record so new count will be inputFeatureCount - 1 - - # Verify the results (New Track Point) - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount >= inputFeatureCount) : - print("Output Feature Count >= Input Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestTemplateConfig.py b/data_management/test/test_patrol_data_capture/TestTemplateConfig.py deleted file mode 100644 index f7abc7cc..00000000 --- a/data_management/test/test_patrol_data_capture/TestTemplateConfig.py +++ /dev/null @@ -1,94 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Automatic test of template configuration -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print "Testing ArcPy" - arcpy.AddMessage("ArcPy works") - - if not arcpy.Exists(TestUtilities.scratchGDB): - TestUtilities.createScratch() - - # Add all datasets that will be needed by the unit tests here - print("Checking that all necessary objects exist.") - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB, - TestUtilities.gpxFile, TestUtilities.defaultGDB, - TestUtilities.patrolReportTable, TestUtilities.enemySightingsTable]) - - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/data_management/test/test_patrol_data_capture/TestUtilities.py b/data_management/test/test_patrol_data_capture/TestUtilities.py deleted file mode 100644 index 08fa679c..00000000 --- a/data_management/test/test_patrol_data_capture/TestUtilities.py +++ /dev/null @@ -1,54 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) -gpxPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/PatrolDataCapture/")) - -inputGDB = os.path.join(geodatabasePath, "test_patrol_data_capture_inputs.gdb") -scratchGDB = os.path.join(scratchPath, "pdc_scratch.gdb") -outputGDB = scratchGDB -defaultGDB = scratchGDB -gpxFile = os.path.join(gpxPath, "JBad_20100706.gpx") -xmlPatrolReport = os.path.join(gpxPath, "PatrolReport017.xml") -patrolReportTable = os.path.join(inputGDB, "PatrolReport") -enemySightingsTable = os.path.join(inputGDB, "EnemySightings") -toolbox = os.path.join(toolboxesPath, "Patrol Data Capture Tools_10.3.tbx") - -def createScratch(): - ''' create scratch geodatabase''' - try: - arcpy.CreateFileGDB_management(scratchPath, "pdc_scratch") - except: - print("scratch.gdb already exists") - return - -def deleteScratch(): - ''' delete scratch geodatabase''' - try: - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - return diff --git a/data_management/test/test_patrol_data_capture/build.xml b/data_management/test/test_patrol_data_capture/build.xml deleted file mode 100644 index 8c8b741c..00000000 --- a/data_management/test/test_patrol_data_capture/build.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/test_publishable_tasks/TemplateConfigTest.py b/data_management/test/test_publishable_tasks/TemplateConfigTest.py deleted file mode 100644 index 25fdbac3..00000000 --- a/data_management/test/test_publishable_tasks/TemplateConfigTest.py +++ /dev/null @@ -1,98 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - if not arcpy.Exists(TestUtilities.scratchGDB): - TestUtilities.createScratch() - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print("Creating New Scratch Workspace (Workaround)") - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB, TestUtilities.defaultGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestDriveTime_Simple.py b/data_management/test/test_publishable_tasks/TestDriveTime_Simple.py deleted file mode 100644 index cd4d98ad..00000000 --- a/data_management/test/test_publishable_tasks/TestDriveTime_Simple.py +++ /dev/null @@ -1,95 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestDriveTime_Simple.py -# Description: Test Publishable Tasks Toolbox > Drive Time with no barriers -# Requirements: ArcGIS Desktop Standard with Network Analyst -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Network") == "Available": - arcpy.CheckOutExtension("Network") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputDriveTimeStartPoint = os.path.join(TestUtilities.inputGDB, "DT_StartPoint") - inputDriveTimeValue = "1 2 3 5" - inputDriveTimeUnit = "Minutes" - inputPointBarrier = "#" - inputLineBarrier = "#" - inputPolygonBarrier = "#" - psOutput = os.path.join(TestUtilities.outputGDB, "DriveTime_Simple") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Drive Time - Simple - single start point, no barriers") - arcpy.DriveTime_pubtask(inputDriveTimeStartPoint,inputDriveTimeValue,inputDriveTimeUnit,inputPointBarrier,inputLineBarrier,inputPolygonBarrier,psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Drive Time: " + str(psOutput)) - print("Output Drive Time polygon count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output poly count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Network Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestFastVisibilityByCircle_MultipleInput.py b/data_management/test/test_publishable_tasks/TestFastVisibilityByCircle_MultipleInput.py deleted file mode 100644 index 6bec42d5..00000000 --- a/data_management/test/test_publishable_tasks/TestFastVisibilityByCircle_MultipleInput.py +++ /dev/null @@ -1,92 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestFastVisibilityByCircle_MultipleInput.py -# Description: Test Publishable Tasks Toolbox > Fast Visibility By Circle with multiple input circles -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputCircle = os.path.join(TestUtilities.inputGDB, "FVBC_InputCircles") - inputHeightAboveSurface = 5.0 - inputElevationURL = TestUtilities.inputElevationURL - psOutput = os.path.join(TestUtilities.outputGDB, "FVBCircle_m_vshed") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Fast Visibility By Circle - Multiple input circles") - arcpy.FastVisibilityByCircle_pubtask(inputCircle, inputHeightAboveSurface, inputElevationURL,psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Viewshed: " + str(psOutput)) - print("Output Observer Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestFastVisibilityByCircle_SingleInput.py b/data_management/test/test_publishable_tasks/TestFastVisibilityByCircle_SingleInput.py deleted file mode 100644 index 94096996..00000000 --- a/data_management/test/test_publishable_tasks/TestFastVisibilityByCircle_SingleInput.py +++ /dev/null @@ -1,92 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestFastVisibilityByCircle_SingleInput.py -# Description: Test Publishable Tasks Toolbox > Fast Visibility By Circle with single input circle -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputCircle = os.path.join(TestUtilities.inputGDB, "FVBC_InputCircle") - inputHeightAboveSurface = 5.0 - inputElevationURL = TestUtilities.inputElevationURL - psOutput = os.path.join(TestUtilities.outputGDB, "FVBCircle_1_vshed") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Fast Visibility By Circle - Single input circle") - arcpy.FastVisibilityByCircle_pubtask(inputCircle, inputHeightAboveSurface, inputElevationURL,psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Viewshed: " + str(psOutput)) - print("Output Observer Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable" ) - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestFastVisibilityByDistance.py b/data_management/test/test_publishable_tasks/TestFastVisibilityByDistance.py deleted file mode 100644 index bd308c74..00000000 --- a/data_management/test/test_publishable_tasks/TestFastVisibilityByDistance.py +++ /dev/null @@ -1,93 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestFastVisibilityByDistance.py -# Description: Test Publishable Tasks Toolbox > Fast Visibility By Distance -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputPoint = os.path.join(TestUtilities.inputGDB, "FV_InputPoint") - inputDistance = "3000.0 meters" - inputHeightAboveSurface = 5.0 - inputElevationURL = TestUtilities.inputElevationURL - psOutput = os.path.join(TestUtilities.outputGDB, "FVBDist_m_vshed") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Fast Visibility By Distance") - arcpy.FastVisibilityByDistance_pubtask(inputPoint, inputDistance, inputHeightAboveSurface, inputElevationURL, psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Viewshed: " + str(psOutput)) - print("Output Observer Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestFastVisibilityByLine.py b/data_management/test/test_publishable_tasks/TestFastVisibilityByLine.py deleted file mode 100644 index 9dfa72a5..00000000 --- a/data_management/test/test_publishable_tasks/TestFastVisibilityByLine.py +++ /dev/null @@ -1,93 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestFastVisibilityByLine.py -# Description: Test Publishable Tasks Toolbox > Fast Visibility By Line -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputLine = os.path.join(TestUtilities.inputGDB, "FVBL_InputLine") - inputDistance = "2000.0 meters" - inputHeightAboveSurface = 5.0 - inputElevationURL = TestUtilities.inputElevationURL - psOutput = os.path.join(TestUtilities.outputGDB, "FVBLine_vshed") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Fast Visibility By Line") - arcpy.FastVisibilityByLine_pubtask(inputLine, inputDistance, inputHeightAboveSurface, inputElevationURL, psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Viewshed: " + str(psOutput)) - print("Output Observer Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestFastVisibilityByParameters.py b/data_management/test/test_publishable_tasks/TestFastVisibilityByParameters.py deleted file mode 100644 index f2e92820..00000000 --- a/data_management/test/test_publishable_tasks/TestFastVisibilityByParameters.py +++ /dev/null @@ -1,99 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestFastVisibilityByParameters.py -# Description: Test Publishable Tasks Toolbox > Fast Visibility By Parameters -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputPoint = os.path.join(TestUtilities.inputGDB, "FV_InputPoint") - OFFSETA = 2.0 - OFFSETB = 0.0 - RADIUS1 = 0.0 - RADIUS2 = 2000.0 - AZIMUTH1 = 0.0 - AZIMUTH2 = 360.0 - VERT1 = 90.0 - VERT2 = -90.0 - inputElevationURL = TestUtilities.inputElevationURL - psOutput = os.path.join(TestUtilities.outputGDB, "FVBParam_vshed") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Fast Visibility By Parameters") - arcpy.FastVisibilityByParameters_pubtask(inputPoint,OFFSETA,OFFSETB,RADIUS1,RADIUS2,AZIMUTH1,AZIMUTH2,VERT1,VERT2, inputElevationURL, psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Viewshed: " + str(psOutput)) - print("Output Observer Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestFastVisibilityByParameters_MultipleInput.py b/data_management/test/test_publishable_tasks/TestFastVisibilityByParameters_MultipleInput.py deleted file mode 100644 index 820745eb..00000000 --- a/data_management/test/test_publishable_tasks/TestFastVisibilityByParameters_MultipleInput.py +++ /dev/null @@ -1,99 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestFastVisibilityByParameters_MulitpleInput.py -# Description: Test Publishable Tasks Toolbox > Fast Visibility By Parameters with multiple input points -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputPoint = os.path.join(TestUtilities.inputGDB, "FV_InputPoint") - OFFSETA = 2.0 - OFFSETB = 0.0 - RADIUS1 = 0.0 - RADIUS2 = 2000.0 - AZIMUTH1 = 0.0 - AZIMUTH2 = 360.0 - VERT1 = 90.0 - VERT2 = -90.0 - inputElevationURL = TestUtilities.inputElevationURL - psOutput = os.path.join(TestUtilities.outputGDB, "FVBParam_m_vshed") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Fast Visibility By Parameters _ Multiple Points") - arcpy.FastVisibilityByParameters_pubtask(inputPoint,OFFSETA,OFFSETB,RADIUS1,RADIUS2,AZIMUTH1,AZIMUTH2,VERT1,VERT2, inputElevationURL, psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Viewshed: " + str(psOutput)) - print("Output Observer Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestPoint2Point_Simple.py b/data_management/test/test_publishable_tasks/TestPoint2Point_Simple.py deleted file mode 100644 index 63699027..00000000 --- a/data_management/test/test_publishable_tasks/TestPoint2Point_Simple.py +++ /dev/null @@ -1,93 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestPoint2Point_Simple.py -# Description: Test Publishable Tasks Toolbox > Point-to-Point Route with no barriers -# Requirements: ArcGIS Desktop Standard with Network Analyst -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Network") == "Available": - arcpy.CheckOutExtension("Network") - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputStopPoints = os.path.join(TestUtilities.inputGDB, "DT_StartPoints") - inputPointBarrier = "#" - inputLineBarrier = "#" - inputPolygonBarrier = "#" - psOutput = os.path.join(TestUtilities.outputGDB, "Point2Point_Simple") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Point to Point Route - Simple - no barriers") - arcpy.P2PRoute_pubtask(inputStopPoints,inputPointBarrier,inputLineBarrier,inputPolygonBarrier,psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output Route: " + str(psOutput)) - print("Output Route feature count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output route count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Network Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/data_management/test/test_publishable_tasks/TestUtilities.py b/data_management/test/test_publishable_tasks/TestUtilities.py deleted file mode 100644 index 37922bf1..00000000 --- a/data_management/test/test_publishable_tasks/TestUtilities.py +++ /dev/null @@ -1,55 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/data/geodatabases/")) - -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../data_management/toolboxes/")) - -#inputElevationURL = r"http://afmcloud.esri.com/arcgis/services/Environment/DigitalTerrainModel/ImageServer"in -inputElevationURL = r"http://afmcloud.esri.com/arcgis/rest/services/Environment/D_DigitalTerrainModel/ImageServer" -inputGDB = os.path.join(geodatabasePath, "PublishableTasksData.gdb") -#outputGDB = os.path.join(geodatabasePath, "test_outputs.gdb") -#defaultGDB = os.path.join(geodatabasePath, "default.gdb") -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -outputGDB = scratchGDB -defaultGDB = scratchGDB - -toolbox = os.path.join(toolboxesPath, "Publishable Task Tools_10.3.tbx") - -def createScratch() : - try : - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - - return - -def deleteScratch() : - try : - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - - return diff --git a/data_management/test/test_publishable_tasks/build.xml b/data_management/test/test_publishable_tasks/build.xml deleted file mode 100644 index cde0d09b..00000000 --- a/data_management/test/test_publishable_tasks/build.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/test/versions.xml b/data_management/test/versions.xml deleted file mode 100644 index 5098ed3e..00000000 --- a/data_management/test/versions.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - OUTPUTS: ${dir.arcgisdesktop}, ${dir.arcpy} - Checks system environment variable and sets the above values depending on version detected. - Sets the correct ArcPy and ArcGIS Folder location depending on version detected. - IMPORTANT: If Python is not installed at the default location, - you will need to edit the task "SET_CUSTOM_PYTHON_LOCATION" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data_management/toolboxes/Adjust Sample Data Dates Tools.tbx b/data_management/toolboxes/Adjust Sample Data Dates Tools.tbx index 09f098b6..454834b8 100644 Binary files a/data_management/toolboxes/Adjust Sample Data Dates Tools.tbx and b/data_management/toolboxes/Adjust Sample Data Dates Tools.tbx differ diff --git a/data_management/toolboxes/Adjust Sample Data Dates Tools_10.4.tbx b/data_management/toolboxes/Adjust Sample Data Dates Tools_10.4.tbx index 63be5421..fa0536ec 100644 Binary files a/data_management/toolboxes/Adjust Sample Data Dates Tools_10.4.tbx and b/data_management/toolboxes/Adjust Sample Data Dates Tools_10.4.tbx differ diff --git a/data_management/toolboxes/Geonames Tools.tbx b/data_management/toolboxes/Geonames Tools.tbx index 76c30b85..3fc41a4d 100644 Binary files a/data_management/toolboxes/Geonames Tools.tbx and b/data_management/toolboxes/Geonames Tools.tbx differ diff --git a/data_management/toolboxes/Geonames Tools_10.4.tbx b/data_management/toolboxes/Geonames Tools_10.4.tbx index 552ab0d4..3fc41a4d 100644 Binary files a/data_management/toolboxes/Geonames Tools_10.4.tbx and b/data_management/toolboxes/Geonames Tools_10.4.tbx differ diff --git a/data_management/toolboxes/Patrol Data Capture Tools.tbx b/data_management/toolboxes/Patrol Data Capture Tools.tbx index dc8be4eb..89a6dd18 100644 Binary files a/data_management/toolboxes/Patrol Data Capture Tools.tbx and b/data_management/toolboxes/Patrol Data Capture Tools.tbx differ diff --git a/data_management/toolboxes/Patrol Data Capture Tools_10.4.tbx b/data_management/toolboxes/Patrol Data Capture Tools_10.4.tbx index 86294dac..de86a2fb 100644 Binary files a/data_management/toolboxes/Patrol Data Capture Tools_10.4.tbx and b/data_management/toolboxes/Patrol Data Capture Tools_10.4.tbx differ diff --git a/data_management/toolboxes/scripts/CheckInput.py b/data_management/toolboxes/scripts/CheckInput.py index 6f4cf4d1..1a4d6d88 100644 --- a/data_management/toolboxes/scripts/CheckInput.py +++ b/data_management/toolboxes/scripts/CheckInput.py @@ -44,7 +44,7 @@ arcpy.AddMessage("Geometry Check: Make sure input feature class geometry is point...") - if desc.shapeType.upper() <> "POINT": + if desc.shapeType.upper() != "POINT": arcpy.AddError("Error: Input feature class does not have geometry type of point") hasError = hasError + 1 @@ -62,7 +62,7 @@ "COUNTRYNAME1", "ADM1CODE", "ADM1NAMEALL", "ADM1NAME", "ADM1CLASSALL", \ "ADM1CLASS", "PLACENAME", "DSGNAME", "USER_FLD", \ "DISPLAY", "NAME_RANK", "NAME_LINK", "TRANSL_CD", "NM_MODIFY_DATE", \ - "POINT_X", "POINT_Y"] + "POINT_X", "POINT_Y", "F_EFCTV_DT", "F_TERM_DT"] numMissing = 0 @@ -83,7 +83,10 @@ # ====================================================== # Check if input has any features # ====================================================== - numCount = long(arcpy.GetCount_management(featClass).getOutput(0)) + if sys.version_info[0] > 2: + numCount = int(arcpy.GetCount_management(featClass).getOutput(0)) + else: + numCount = long(arcpy.GetCount_management(featClass).getOutput(0)) arcpy.AddMessage("Feature Count Check: Make sure input feature class does not have any features...") @@ -98,7 +101,7 @@ arcpy.AddMessage("Spatial Reference Check: Make sure input feature class is 'GCS_WGS_1984'...") - if SR.name.upper() <> "GCS_WGS_1984": + if SR.name.upper() != "GCS_WGS_1984": arcpy.AddError("Error: Spatial Reference is " + SR.name) hasError = hasError + 1 diff --git a/data_management/toolboxes/scripts/LoadGeonames.py b/data_management/toolboxes/scripts/LoadGeonames.py index bda57652..7b339c27 100644 --- a/data_management/toolboxes/scripts/LoadGeonames.py +++ b/data_management/toolboxes/scripts/LoadGeonames.py @@ -109,7 +109,10 @@ # Open geoname file arcpy.AddMessage("- Opening geoname file " + geonameFilePath + "...") - fileGeoname = open(geonameFilePath, "r") + if sys.version_info[0] > 2: + fileGeoname = open(geonameFilePath, "r", encoding="utf8") + else: + fileGeoname = open(geonameFilePath, "r") # Get list of fields in geoname file for lineGeoname in fileGeoname: @@ -168,10 +171,10 @@ fieldName = fileFieldList[fieldIndex].rstrip('\n') fieldValue = fieldValue.rstrip('\n') - if fieldValue <> '': + if fieldValue != '': # Format date value - if fieldName.upper() in ["MODIFY_DATE", "NM_MODIFY_DATE"]: + if fieldName.upper() in ["MODIFY_DATE", "NM_MODIFY_DATE", "F_EFCTV_DT", "F_TERM_DT"]: fieldValue = fieldValue + " 00:00:00 AM" if fieldName.upper() == "CC1": @@ -232,7 +235,7 @@ fieldIndex = fieldIndex + 1 # Set CountryCode/First-order Administrative Class field value - if countryCode1 <> '' and adm1 <> '': + if countryCode1 != '' and adm1 != '': row.setValue("ADM1CODE", countryCode1 + adm1) # Populate primary admin field value @@ -257,7 +260,7 @@ adm1Name = adm1NameAll.split("/")[0].split("[")[0].strip() row.setValue("ADM1NAME", adm1Name) - userValue = "Principal Admin Division: " + adm1Name + userValue = "Primary Admin Division: " + adm1Name ## Populate Admin Division Class field (ADM1CLASS) adm1ClassAll = admin1ClassDict.get(countryCode1 + adm1) @@ -292,7 +295,7 @@ row.setValue("USER_FLD", userValue) # Set Feature Designation Name field value - if featDSGCode <> '': + if featDSGCode != '': featDSGName = featCodeDict.get(featDSGCode) diff --git a/data_management/toolboxes/scripts/PointToLine.py b/data_management/toolboxes/scripts/PointToLine.py index f05cbf49..f8cecedf 100644 --- a/data_management/toolboxes/scripts/PointToLine.py +++ b/data_management/toolboxes/scripts/PointToLine.py @@ -23,6 +23,7 @@ def convertPoints(): + overwriteOutputDefault = arcpy.overwriteOutput arcpy.overwriteOutput = True # Input point FC @@ -36,7 +37,8 @@ def convertPoints(): sortField = arcpy.GetParameterAsText(3) closeLine = arcpy.GetParameterAsText(4) - if IDField in ["", "#"]: IDField = None + if IDField in ["", "#"]: + IDField = None if sortField in ["", "#"]: cursorSort = IDField @@ -53,6 +55,7 @@ def convertPoints(): close = True convertPointsToLine(inPts, outFeatures, IDField, cursorSort, close) + arcpy.overwriteOutput = overwriteOutputDefault def enableParam(hasMZ): if hasMZ: diff --git a/data_management/toolboxes/scripts/PolylineToPolygon.py b/data_management/toolboxes/scripts/PolylineToPolygon.py index 3f29b430..bbdc7370 100644 --- a/data_management/toolboxes/scripts/PolylineToPolygon.py +++ b/data_management/toolboxes/scripts/PolylineToPolygon.py @@ -18,91 +18,124 @@ import arcpy, traceback from arcpy import env -inputPolylines = arcpy.GetParameterAsText(0) -inputIDFieldName = arcpy.GetParameterAsText(1) -outputPolygons = arcpy.GetParameterAsText(2) -delete_me = [] -debug = False - -try: - currentOverwriteOutput = env.overwriteOutput - env.overwriteOutput = True - - #Create output Poly FC - sr = arcpy.Describe(inputPolylines).spatialReference - arcpy.AddMessage("Spatial reference is " + str(sr)) - arcpy.AddMessage("Creating output feature class...") - outpolygonsFC = arcpy.CreateFeatureclass_management(os.path.dirname(outputPolygons),os.path.basename(outputPolygons),"POLYGON","#","#","#",sr) - - #Add ID field - arcpy.AddMessage("Adding ID field ...") - arcpy.AddField_management(outpolygonsFC,inputIDFieldName,"LONG") - arcpy.AddMessage("Opening cursors ...") - - #Open Search cursor on polyline - inFields = ["SHAPE@", inputIDFieldName] - inRows = arcpy.da.SearchCursor(inputPolylines, inFields) - - #Open Insert cursor on polygons - outRows = arcpy.da.InsertCursor(outpolygonsFC,inFields) - - for row in inRows: - feat = row[0] - inID = row[1] - - arcpy.AddMessage("Building points from lines.") - #Build array of points for the line +# LOCALS =========================================== + +debug = True # extra messaging during development + +# FUNCTIONS ======================================== + +def polylineToPolygon(inputPolylines, inputIDFieldName, outputPolygons): + ''' + Converts polyline to polygon features. All closed features will + be converted to polygons. Unclosed polylines, or polylines with + less than 2 vertices will not convert. + + inputPolylines - input polyline feature class + idFieldName - field in inputPolylines to separate individual features + outputPolygons - polygon feature class to be created + + returns polygon feature class + ''' + try: + env.overwriteOutput = True + #Create output Poly FC + sr = arcpy.Describe(inputPolylines).spatialReference + # if debug: + # arcpy.AddMessage("Spatial reference is " + str(sr.name)) + # arcpy.AddMessage("Creating output feature class...") + outpolygonsFC = arcpy.CreateFeatureclass_management(os.path.dirname(outputPolygons), \ + os.path.basename(outputPolygons), \ + "POLYGON", \ + "#", \ + "#", \ + "#", \ + sr) + + inFields = ["SHAPE@"] + if inputIDFieldName: + #Add ID field + if debug: + arcpy.AddMessage("Adding ID field: %s ..." % str(inputIDFieldName)) + arcpy.AddField_management(outpolygonsFC,inputIDFieldName, "LONG") + inFields = ["SHAPE@", inputIDFieldName] + + if debug: + arcpy.AddMessage("Converting Polylines to Polygons...") + + #Open Search cursor on polyline + inRows = arcpy.da.SearchCursor(inputPolylines, inFields) + + #Open Insert cursor on polygons + outRows = arcpy.da.InsertCursor(outpolygonsFC, inFields) + polyArray = arcpy.Array() - partnum = 0 - for part in feat: - for pnt in feat.getPart(partnum): - polyArray.add(arcpy.Point(pnt.X, pnt.Y)) - partnum += 1 - - arcpy.AddMessage("Creating polygon from points.") - #convert the array to a polygon, and insert the features - outPoly = arcpy.Polygon(polyArray) - outRows.insertRow([outPoly, inID]) - - #close cursors - del outRows - del inRows - - #set outputs - arcpy.SetParameter(2,outpolygonsFC) - - # cleanup - arcpy.AddMessage("Removing scratch datasets:") - for ds in delete_me: - arcpy.AddMessage(str(ds)) - arcpy.Delete_management(ds) - - env.overwriteOutput = currentOverwriteOutput - -except arcpy.ExecuteError: - error = True - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - #print msgs #UPDATE - print(msgs) - -except: - # Get the traceback object - error = True - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - #print pymsg + "\n" #UPDATE - print(pymsg + "\n") - #print msgs #UPDATE - print(msgs) + + rowCount = 0 + + for row in inRows: + + rowCount += 1 + + # Provide feedback, since this method may take a while for large datasets + if debug and not (rowCount % 100): + arcpy.AddMessage('Processing Row: ' + str(rowCount)) + + if inputIDFieldName: + inID = row[1] + + # Polyline will only have one part + featShape = row[0] + polyline = featShape.getPart(0) + + polyArray.removeAll() + polyArray.append(polyline) + + outPoly = arcpy.Polygon(polyArray, sr) + + if inputIDFieldName: + outRows.insertRow([outPoly, inID]) + else: + outRows.insertRow([outPoly]) + + if debug: + arcpy.AddMessage("Done converting polylines to polygons ...") + + #close cursors + del outRows + del inRows + return outputPolygons + + except arcpy.ExecuteError: + # Get the tool error messages + msgs = arcpy.GetMessages() + arcpy.AddError(msgs) + print(msgs) + + except: + # Get the traceback object + tb = sys.exc_info()[2] + tbinfo = traceback.format_tb(tb)[0] + + # Concatenate information together concerning the error into a message string + pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) + msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" + + # Return python error messages for use in script tool or Python Window + arcpy.AddError(pymsg) + arcpy.AddError(msgs) + + # Print Python error messages for use in Python / Python Window + print(pymsg + "\n") + print(msgs) + +def main(): + + inputPolylines = arcpy.GetParameterAsText(0) + inputIDFieldName = arcpy.GetParameterAsText(1) + outputPolygons = arcpy.GetParameterAsText(2) + + #Polyline To Polygon + polylineToPolygon(inputPolylines, inputIDFieldName, outputPolygons) + +if __name__ == "__main__": + main() diff --git a/data_management/versions.xml b/data_management/versions.xml deleted file mode 100644 index 5098ed3e..00000000 --- a/data_management/versions.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - OUTPUTS: ${dir.arcgisdesktop}, ${dir.arcpy} - Checks system environment variable and sets the above values depending on version detected. - Sets the correct ArcPy and ArcGIS Folder location depending on version detected. - IMPORTANT: If Python is not installed at the default location, - you will need to edit the task "SET_CUSTOM_PYTHON_LOCATION" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/img/CreateNewBranchDialogScreenshot.png b/img/CreateNewBranchDialogScreenshot.png new file mode 100644 index 00000000..7ade2774 Binary files /dev/null and b/img/CreateNewBranchDialogScreenshot.png differ diff --git a/NewPullRequestButtonIcon.png b/img/NewPullRequestButtonIcon.png similarity index 100% rename from NewPullRequestButtonIcon.png rename to img/NewPullRequestButtonIcon.png diff --git a/img/solutions-geoprocessing-toolbox_screenshot_14APR2016_824x400.png b/img/solutions-geoprocessing-toolbox_screenshot_14APR2016_824x400.png new file mode 100644 index 00000000..936a31a5 Binary files /dev/null and b/img/solutions-geoprocessing-toolbox_screenshot_14APR2016_824x400.png differ diff --git a/operational_graphics/README.md b/operational_graphics/README.md index beebe293..935833df 100644 --- a/operational_graphics/README.md +++ b/operational_graphics/README.md @@ -14,6 +14,7 @@ Create and visualize graphic products in support of operations. ## Clearing Operations Tools Tools for building gridded reference graphics (GRG) for marking buildings and structures for clearing operations. +Supports the [Clearing Operations](http://solutions.arcgis.com/defense/templates/clearing-operations/) template. * Canvas Area GRG * Linear Line Of Sight @@ -25,6 +26,8 @@ These tools are part of the [Clearing Operations](http://www.arcgis.com/home/ite ## Range Card Tools +> IMPORTANT: This toolbox is moving to Mature Support and will be removed in the future, but will be available from earlier [releases](https://github.com/Esri/solutions-geoprocessing-toolbox/releases). + Tools to build range cards for defensive positions. * Create Range Fan Index Features diff --git a/operational_graphics/test/build.xml b/operational_graphics/test/build.xml deleted file mode 100644 index 6c688e60..00000000 --- a/operational_graphics/test/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/operational_graphics/test/test_clearing_operations/TemplateConfigTest.py b/operational_graphics/test/test_clearing_operations/TemplateConfigTest.py deleted file mode 100644 index 268c0b83..00000000 --- a/operational_graphics/test/test_clearing_operations/TemplateConfigTest.py +++ /dev/null @@ -1,95 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.scratchGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name ) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/operational_graphics/test/test_clearing_operations/TestCanvasAreaGRG.py b/operational_graphics/test/test_clearing_operations/TestCanvasAreaGRG.py deleted file mode 100644 index ca71acef..00000000 --- a/operational_graphics/test/test_clearing_operations/TestCanvasAreaGRG.py +++ /dev/null @@ -1,77 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestCanvasAreaGRG.py -# Description: Test Canvas Area GRG tool in the Clearing Operations Tools_10.3.tbx. -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -try: - arcpy.AddMessage("Starting Test: TestCanvasAreaGRG.") - - arcpy.ImportToolbox(TestUtilities.toolbox, "ClearingOperations") - arcpy.env.overwriteOutput = True - inputCellWidth = 40 - inputCellHeight = 40 - inputCellUnits = "Meters" - inputCanvasAreaPath = os.path.join(TestUtilities.inputGDB, "AO") - inputLabelingStartPosition = "Lower-Left" - inputLabelingStyle = "Alpha-Numeric" - outputFeatureClass = os.path.join(TestUtilities.scratchGDB, "testOutput") - - #CanvasAreaGRG_ClearingOperations (Canvas_Area, Cell_Width, Cell_Height, Cell_Units, {Draw_Cell}, Labeling_Start_Position, Labeling_Style, Output_Name) - arcpy.CanvasAreaGRG_ClearingOperations(inputCanvasAreaPath, inputCellWidth, inputCellHeight, inputCellUnits, "#", inputLabelingStartPosition, inputLabelingStyle, outputFeatureClass) - countOutputFeatures = int(arcpy.GetCount_management(outputFeatureClass).getOutput(0)) - print("Output Feature count: " + str(countOutputFeatures)) - if (countOutputFeatures != 294): - print("Invalid output feature count.") - raise Exception("Test Failed") - else: - print("Test Passed") - - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) diff --git a/operational_graphics/test/test_clearing_operations/TestNumberFeatures.py b/operational_graphics/test/test_clearing_operations/TestNumberFeatures.py deleted file mode 100644 index 185f1aab..00000000 --- a/operational_graphics/test/test_clearing_operations/TestNumberFeatures.py +++ /dev/null @@ -1,81 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestNumberFeatures.py -# Description: Test Number Features tool in the Clearing Operations Tools_10.3.tbx. -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -try: - arcpy.AddMessage("Starting Test: TestNumberFeatures.") - - arcpy.ImportToolbox(TestUtilities.toolbox, "ClearingOperations") - arcpy.env.overwriteOutput = True - - # Inputs - # areaToNumber = os.path.join(TestUtilities.layerPath, "AO.lyr") - areaToNumber = os.path.join(TestUtilities.inputGDB, "AO") - # pointFeatures = os.path.join(TestUtilities.layerPath, "Structures.lyr") - pointFeatures = os.path.join(TestUtilities.inputGDB, "Structures") - - numberField = "Number" - outputFeatureClass = os.path.join(TestUtilities.scratchGDB, "NumberFeaturesOutput") - - arcpy.NumberFeatures_ClearingOperations(areaToNumber, pointFeatures, numberField, outputFeatureClass) - - # Results - outputCount = int(arcpy.GetCount_management(outputFeatureClass).getOutput(0)) - print("Output Feature count: " + str(outputCount)) - - if(outputCount != 90): - print("Invalid output feature count.") - raise Exception("Test Failed") - else: - print("Test Passed") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n"\ - + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/operational_graphics/test/test_clearing_operations/TestPointTargetGRG.py b/operational_graphics/test/test_clearing_operations/TestPointTargetGRG.py deleted file mode 100644 index 5a583afb..00000000 --- a/operational_graphics/test/test_clearing_operations/TestPointTargetGRG.py +++ /dev/null @@ -1,78 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestPointTargetGRG.py -# Description: Test Point Target GRG tool in the Clearing Operations Tools_10.3.tbx. -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback -import TestUtilities - -try: - - arcpy.AddMessage("Starting Test: TestPointTargetGRG.") - - arcpy.ImportToolbox(TestUtilities.toolbox, "ClearingOperations") - arcpy.env.overwriteOutput = True - - # Inputs - inputTargetPoint = os.path.join(TestUtilities.inputGDB, "CenterPoint") - inputHorizontalCells = 10 - inputVerticalCells = 10 - inputCellWidth = 100 - inputCellHeight = 100 - inputCellUnits = "Meters" - inputLabelStartPosition = "Upper-Left" - inputLabelStyle = "Alpha-Numeric" - outputFeatureClass = os.path.join(TestUtilities.scratchGDB, "PointTargetGRGOutput") - - arcpy.PointTargetGRG_ClearingOperations(inputTargetPoint, inputHorizontalCells, inputVerticalCells, inputCellWidth, inputCellHeight, inputCellUnits, "#", inputLabelStartPosition, inputLabelStyle, outputFeatureClass) - - # Verify the results - outputCount = int(arcpy.GetCount_management(outputFeatureClass).getOutput(0)) - print("Output Feature count: " + str(outputCount)) - - if(outputCount != 100): - print("Invalid output feature count.") - raise Exception("Test Failed") - else: - print("Test Passed") - -except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) diff --git a/operational_graphics/test/test_clearing_operations/TestUtilities.py b/operational_graphics/test/test_clearing_operations/TestUtilities.py deleted file mode 100644 index a37cf085..00000000 --- a/operational_graphics/test/test_clearing_operations/TestUtilities.py +++ /dev/null @@ -1,50 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../operational_graphics/data/geodatabases/")) -layerPath = os.path.normpath(os.path.join(currentPath, r"../../../operational_graphics/data/layers/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../operational_graphics/toolboxes/")) - -inputGDB = os.path.join(geodatabasePath, "test_clearing_operations.gdb") -scratchGDB = os.path.join(scratchPath, "scratch.gdb") - -toolbox = os.path.join(toolboxesPath, "Clearing Operations Tools_10.3.tbx") - -def createScratch() : - try : - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - return - -def deleteScratch() : - try : - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - return - -# create scratch -createScratch() diff --git a/operational_graphics/test/test_clearing_operations/build.xml b/operational_graphics/test/test_clearing_operations/build.xml deleted file mode 100644 index ceabc9dc..00000000 --- a/operational_graphics/test/test_clearing_operations/build.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/operational_graphics/test/test_range_cards/TestCreateRangeFanIndexFeatures.py b/operational_graphics/test/test_range_cards/TestCreateRangeFanIndexFeatures.py deleted file mode 100644 index ece10b10..00000000 --- a/operational_graphics/test/test_range_cards/TestCreateRangeFanIndexFeatures.py +++ /dev/null @@ -1,103 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestCreateRangeFanIndexFeatures.py -# Description: Automatic Test of Range Rings Model -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: TestCreateRangeFanIndexFeatures") - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - inputPolygonFC = os.path.join(TestUtilities.inputGDB, "RangeFans") - outputExtentBoxes = os.path.join(TestUtilities.outputGDB, "OutputExtentBoxes") - outputRangeVertices = os.path.join(TestUtilities.outputGDB, "RangeVertices") - toolbox = TestUtilities.toolbox - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "Range") - - inputFeatureCount = int(arcpy.GetCount_management(inputPolygonFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPolygonFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputPolygonFC < 1) : - print("Invalid Input Feature Count: " + str(inputPolygonFC) ) - - ########################################################3 - # Execute the Model under test: - arcpy.CreateRangeFanIndexFeatures_Range(inputPolygonFC, outputExtentBoxes, outputRangeVertices) - ########################################################3 - - # Verify the results - outputFeatureCountExtent = int(arcpy.GetCount_management(outputExtentBoxes).getOutput(0)) - print("Output FeatureClass: " + str(outputExtentBoxes)) - print("Output Feature Count: " + str(outputFeatureCountExtent)) - - outputFeatureCountPoints = int(arcpy.GetCount_management(outputRangeVertices).getOutput(0)) - print("Output FeatureClass: " + str(outputRangeVertices)) - print("Output Feature Count: " + str(outputFeatureCountPoints)) - - if (outputFeatureCountExtent < 1) or (outputFeatureCountPoints < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCountExtent) + ":" + str(outputFeatureCountPoints)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print "Deleting Scratch Workspace (Workaround)" - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/operational_graphics/test/test_range_cards/TestTemplateConfig.py b/operational_graphics/test/test_range_cards/TestTemplateConfig.py deleted file mode 100644 index 4c19397f..00000000 --- a/operational_graphics/test/test_range_cards/TestTemplateConfig.py +++ /dev/null @@ -1,100 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestTemplateConfig.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - if not arcpy.Exists(TestUtilities.scratchGDB): - TestUtilities.createScratch() - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths" ) - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, \ - TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB, \ - TestUtilities.defaultGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check) ) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/operational_graphics/test/test_range_cards/TestUtilities.py b/operational_graphics/test/test_range_cards/TestUtilities.py deleted file mode 100644 index 902b21d1..00000000 --- a/operational_graphics/test/test_range_cards/TestUtilities.py +++ /dev/null @@ -1,50 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestTemplateConfig.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import arcpy -import os - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../operational_graphics/data/geodatabases/")) - -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../operational_graphics/toolboxes/")) - -inputGDB = os.path.join(geodatabasePath, "test_range_card_inputs.gdb") -#outputGDB = os.path.join(geodatabasePath, "test_outputs.gdb") -#defaultGDB = os.path.join(geodatabasePath, "RangeCard.gdb") -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -outputGDB = scratchGDB -defaultGDB = scratchGDB - -toolbox = os.path.join(toolboxesPath, "Range Card Tools_10.3.tbx") - -def createScratch() : - try : - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print "scratch.gdb already exists" - return - -def deleteScratch() : - try : - arcpy.Delete_management(scratchGDB) - except: - print "scratch.gdb delete failed" - return diff --git a/operational_graphics/test/test_range_cards/build.xml b/operational_graphics/test/test_range_cards/build.xml deleted file mode 100644 index 4f656c8c..00000000 --- a/operational_graphics/test/test_range_cards/build.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/operational_graphics/test/versions.xml b/operational_graphics/test/versions.xml deleted file mode 100644 index 5098ed3e..00000000 --- a/operational_graphics/test/versions.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - OUTPUTS: ${dir.arcgisdesktop}, ${dir.arcpy} - Checks system environment variable and sets the above values depending on version detected. - Sets the correct ArcPy and ArcGIS Folder location depending on version detected. - IMPORTANT: If Python is not installed at the default location, - you will need to edit the task "SET_CUSTOM_PYTHON_LOCATION" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/operational_graphics/toolboxes/Clearing Operations Tools_10.4.tbx b/operational_graphics/toolboxes/Clearing Operations Tools_10.4.tbx index 7f0b77b4..c7511b42 100644 Binary files a/operational_graphics/toolboxes/Clearing Operations Tools_10.4.tbx and b/operational_graphics/toolboxes/Clearing Operations Tools_10.4.tbx differ diff --git a/operational_graphics/toolboxes/scripts/CanvasAreaGRG.py b/operational_graphics/toolboxes/scripts/CanvasAreaGRG.py index e77efb04..7a660251 100644 --- a/operational_graphics/toolboxes/scripts/CanvasAreaGRG.py +++ b/operational_graphics/toolboxes/scripts/CanvasAreaGRG.py @@ -417,7 +417,7 @@ def main(): if appEnvironment == "ARCGIS_PRO": toolboxPath = os.path.join(os.path.dirname(sysPath), "Clearing Operations Tools.tbx") else: - toolboxPath = os.path.join(os.path.dirname(sysPath), "Clearing Operations Tools_10.3.tbx") + toolboxPath = os.path.join(os.path.dirname(sysPath), "Clearing Operations Tools_10.4.tbx") arcpy.ImportToolbox(toolboxPath) arcpy.AddMessage("Creating Fishnet Grid...") diff --git a/operational_graphics/toolboxes/scripts/PointTargetGRG.py b/operational_graphics/toolboxes/scripts/PointTargetGRG.py index 90db1ada..9039a94e 100644 --- a/operational_graphics/toolboxes/scripts/PointTargetGRG.py +++ b/operational_graphics/toolboxes/scripts/PointTargetGRG.py @@ -468,7 +468,7 @@ def main(): if appEnvironment == "ARCGIS_PRO": toolboxPath = os.path.join(os.path.dirname(sysPath), "Clearing Operations Tools.tbx") else: - toolboxPath = os.path.join(os.path.dirname(sysPath), "Clearing Operations Tools_10.3.tbx") + toolboxPath = os.path.join(os.path.dirname(sysPath), "Clearing Operations Tools_10.4.tbx") arcpy.ImportToolbox(toolboxPath) arcpy.AddMessage("Creating Fishnet Grid") diff --git a/patterns/README.md b/patterns/README.md index 246e91db..b356b063 100644 --- a/patterns/README.md +++ b/patterns/README.md @@ -14,6 +14,7 @@ Find patterns and trends through statistical and visual analysis. ## Incident Analysis Tools These tools help you discover spatial patterns and trends in significant activity in your area of interest. +Supports the [Incident Analysis](http://solutions.arcgis.com/defense/templates/incident-analysis/) template. * Cluster Analysis * Count Incidents By LOC @@ -21,7 +22,6 @@ These tools help you discover spatial patterns and trends in significant activit * Hot Spots By Area * Incident Density * Incident Hot Spots -* Incident Table To Point These tools are part of the [Incident Analysis Template](http://www.arcgis.com/home/item.html?id=fd6e2c3272c14826b9781e93580dacfe) diff --git a/patterns/test/build.xml b/patterns/test/build.xml deleted file mode 100644 index 7ae9890b..00000000 --- a/patterns/test/build.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/patterns/test/test_incident_analysis/ClusterAnalysisTestCase.py b/patterns/test/test_incident_analysis/ClusterAnalysisTestCase.py deleted file mode 100644 index e511f191..00000000 --- a/patterns/test/test_incident_analysis/ClusterAnalysisTestCase.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# ClusterAnalysisTestCase.py -# -------------------------------------------------- -# requirments: ArcGIS X.X, Python 2.7 or Python 3.4 -# author: ArcGIS Solutions -# contact: ArcGISTeam@esri.com -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== - -import unittest -import UnitTestCase -import UnitTestUtilities -import TestUtilities diff --git a/patterns/test/test_incident_analysis/CountIncidentsByLOCTestCase.py b/patterns/test/test_incident_analysis/CountIncidentsByLOCTestCase.py deleted file mode 100644 index 7bad6613..00000000 --- a/patterns/test/test_incident_analysis/CountIncidentsByLOCTestCase.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# CountIncidentsByLOCTestCase.py -# -------------------------------------------------- -# requirments: ArcGIS X.X, Python 2.7 or Python 3.4 -# author: ArcGIS Solutions -# contact: ArcGISTeam@esri.com -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== diff --git a/patterns/test/test_incident_analysis/FindPercentChangeTestCase.py b/patterns/test/test_incident_analysis/FindPercentChangeTestCase.py deleted file mode 100644 index def5151c..00000000 --- a/patterns/test/test_incident_analysis/FindPercentChangeTestCase.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# FindPercentChangeTestCase.py -# -------------------------------------------------- -# requirments: ArcGIS X.X, Python 2.7 or Python 3.4 -# author: ArcGIS Solutions -# contact: ArcGISTeam@esri.com -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== diff --git a/patterns/test/test_incident_analysis/HotSpotsByAreaTestCase.py b/patterns/test/test_incident_analysis/HotSpotsByAreaTestCase.py deleted file mode 100644 index 8696a8ea..00000000 --- a/patterns/test/test_incident_analysis/HotSpotsByAreaTestCase.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# HotSpotsByAreaTestCase.py -# -------------------------------------------------- -# requirments: ArcGIS X.X, Python 2.7 or Python 3.4 -# author: ArcGIS Solutions -# contact: ArcGISTeam@esri.com -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== diff --git a/patterns/test/test_incident_analysis/IncidentAnalysisTestSuiteDesktop.py b/patterns/test/test_incident_analysis/IncidentAnalysisTestSuiteDesktop.py deleted file mode 100644 index 390a0efa..00000000 --- a/patterns/test/test_incident_analysis/IncidentAnalysisTestSuiteDesktop.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# IncidentAnalysisTestSuiteDesktop.py -# -------------------------------------------------- -# requirments: ArcGIS 10.X, Python 2.7 -# author: ArcGIS Solutions -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== - -import unittest -import ClusterAnalysisTestCase -import CountIncidentsByLOCTestCase -import FindPercentChangeTestCase -import HotSpotsByAreaTestCase -import IncidentDensityTestCase -import IncidentHotSpotsTestCase -import IncidentTableToPointTestCase diff --git a/patterns/test/test_incident_analysis/IncidentAnalysisTestSuitePro.py b/patterns/test/test_incident_analysis/IncidentAnalysisTestSuitePro.py deleted file mode 100644 index d826c969..00000000 --- a/patterns/test/test_incident_analysis/IncidentAnalysisTestSuitePro.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# IncidentAnalysisTestSuitePro.py -# -------------------------------------------------- -# requirments: ArcGIS Pro 1.2, Python 3.4 -# author: ArcGIS Solutions -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== - -import unittest -import ClusterAnalysisTestCase -import CountIncidentsByLOCTestCase -import FindPercentChangeTestCase -import HotSpotsByAreaTestCase -import IncidentDensityTestCase -import IncidentHotSpotsTestCase -import IncidentTableToPointTestCase diff --git a/patterns/test/test_incident_analysis/IncidentDensityTestCase.py b/patterns/test/test_incident_analysis/IncidentDensityTestCase.py deleted file mode 100644 index 44aaeb89..00000000 --- a/patterns/test/test_incident_analysis/IncidentDensityTestCase.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# IncidentDensityTestCase.py -# -------------------------------------------------- -# requirments: ArcGIS X.X, Python 2.7 or Python 3.4 -# author: ArcGIS Solutions -# contact: ArcGISTeam@esri.com -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== diff --git a/patterns/test/test_incident_analysis/IncidentHotSpotsTestCase.py b/patterns/test/test_incident_analysis/IncidentHotSpotsTestCase.py deleted file mode 100644 index 34514feb..00000000 --- a/patterns/test/test_incident_analysis/IncidentHotSpotsTestCase.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# IncidentHotSpotsTestCase.py -# -------------------------------------------------- -# requirments: ArcGIS X.X, Python 2.7 or Python 3.4 -# author: ArcGIS Solutions -# contact: ArcGISTeam@esri.com -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== diff --git a/patterns/test/test_incident_analysis/IncidentTableToPointTestCase.py b/patterns/test/test_incident_analysis/IncidentTableToPointTestCase.py deleted file mode 100644 index 464f5a0d..00000000 --- a/patterns/test/test_incident_analysis/IncidentTableToPointTestCase.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 -# ----------------------------------------------------------------------------- -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ----------------------------------------------------------------------------- - -# ================================================== -# IncidentTableToPointTestCase.py -# -------------------------------------------------- -# requirments: ArcGIS X.X, Python 2.7 or Python 3.4 -# author: ArcGIS Solutions -# contact: ArcGISTeam@esri.com -# company: Esri -# ================================================== -# description: -# ================================================== -# history: -# - - -# ================================================== diff --git a/patterns/test/versions.xml b/patterns/test/versions.xml deleted file mode 100644 index 5098ed3e..00000000 --- a/patterns/test/versions.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - OUTPUTS: ${dir.arcgisdesktop}, ${dir.arcpy} - Checks system environment variable and sets the above values depending on version detected. - Sets the correct ArcPy and ArcGIS Folder location depending on version detected. - IMPORTANT: If Python is not installed at the default location, - you will need to edit the task "SET_CUSTOM_PYTHON_LOCATION" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/patterns/toolboxes/Incident Analysis Tools.tbx b/patterns/toolboxes/Incident Analysis Tools.tbx index c3cd30bd..03ab8b95 100644 Binary files a/patterns/toolboxes/Incident Analysis Tools.tbx and b/patterns/toolboxes/Incident Analysis Tools.tbx differ diff --git a/patterns/toolboxes/Incident Analysis Tools_10.4.tbx b/patterns/toolboxes/Incident Analysis Tools_10.4.tbx index 2b6c7986..beffcb1c 100644 Binary files a/patterns/toolboxes/Incident Analysis Tools_10.4.tbx and b/patterns/toolboxes/Incident Analysis Tools_10.4.tbx differ diff --git a/patterns/toolboxes/layers/ClusterAnalysis.lyr b/patterns/toolboxes/layers/ClusterAnalysis.lyr index 83988e08..adb929ea 100644 Binary files a/patterns/toolboxes/layers/ClusterAnalysis.lyr and b/patterns/toolboxes/layers/ClusterAnalysis.lyr differ diff --git a/patterns/toolboxes/layers/ClusterAnalysis.lyrx b/patterns/toolboxes/layers/ClusterAnalysis.lyrx index c155cfd7..72150c8c 100644 --- a/patterns/toolboxes/layers/ClusterAnalysis.lyrx +++ b/patterns/toolboxes/layers/ClusterAnalysis.lyrx @@ -1,6 +1,7 @@ { "type" : "CIMLayerDocument", - "version" : "1.0.0", + "version" : "1.4.0", + "build" : 7198, "layers" : [ "CIMPATH=gp_arcpy_map/cluster_analysis.xml" ], @@ -12,16 +13,19 @@ "sourceModifiedTime" : { "type" : "TimeInstant" }, + "metadataURI" : "CIMPATH=Metadata/95ba227ac3aa0d4c1bf488d9f5ccf516.xml", "layerElevation" : { "type" : "CIMLayerElevationSurface", - "mapElevationID" : "{DEBAA02C-6E95-4392-84FE-6E503CC8DD02}" + "mapElevationID" : "{C57EE817-32A4-4173-86FD-6157EBA40993}" }, + "expanded" : true, "layerType" : "Operational", "showLegends" : true, "visibility" : true, "displayCacheType" : "Permanent", "maxDisplayCacheAge" : 5, "showPopups" : true, + "serviceLayerID" : -1, "autoGenerateFeatureTemplates" : true, "featureTable" : { "type" : "CIMFeatureTable", @@ -41,7 +45,7 @@ }, "dataConnection" : { "type" : "CIMStandardDataConnection", - "workspaceConnectionString" : "DATABASE=..\\Results.gdb", + "workspaceConnectionString" : "DATABASE=D:\\GitHub\\solutions-geoprocessing-toolbox\\patterns\\toolboxes\\Results.gdb", "workspaceFactory" : "FileGDB", "dataset" : "ClusterAnalysis", "datasetType" : "esriDTFeatureClass" @@ -65,7 +69,6 @@ { "type" : "CIMVectorMarker", "enable" : true, - "colorLocked" : false, "anchorPointUnits" : "Relative", "dominantSizeAxis3D" : "Z", "size" : 8, @@ -83,13 +86,13 @@ "curveRings" : [ [ [ - 1.2246467991473532e-016, + 1.2246467991473532e-16, 2 ], { "a" : [ [ - 1.2246467991473532e-016, + 1.2246467991473532e-16, 2 ], [ @@ -107,35 +110,33 @@ "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 255, - 255, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 255, + 255, + 100 + ] } } ] } } - ] + ], + "respectFrame" : true } ], "haloSize" : 1, - "scaleX" : 1 + "scaleX" : 1, + "angleAlignment" : "Display" }, "symbolName" : "Symbol_133" }, - "exclusionSet" : { - }, + "featureCacheType" : "None", + "enableDisplayFilters" : true, "labelClasses" : [ { "type" : "CIMLabelClass", @@ -256,6 +257,45 @@ }, "name" : "Default", "priority" : 14, + "standardLabelPlacementProperties" : { + "type" : "CIMStandardLabelPlacementProperties", + "featureType" : "Line", + "featureWeight" : "Low", + "labelWeight" : "High", + "numLabelsOption" : "OneLabelPerName", + "lineLabelPosition" : { + "type" : "CIMStandardLineLabelPosition", + "above" : true, + "inLine" : true, + "parallel" : true + }, + "lineLabelPriorities" : { + "type" : "CIMStandardLineLabelPriorities", + "aboveStart" : 3, + "aboveAlong" : 3, + "aboveEnd" : 3, + "centerStart" : 3, + "centerAlong" : 3, + "centerEnd" : 3, + "belowStart" : 3, + "belowAlong" : 3, + "belowEnd" : 3 + }, + "pointPlacementMethod" : "AroundPoint", + "pointPlacementPriorities" : { + "type" : "CIMStandardPointPlacementPriorities", + "aboveLeft" : 2, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerLeft" : 3, + "centerRight" : 2, + "belowLeft" : 3, + "belowCenter" : 3, + "belowRight" : 2 + }, + "rotationType" : "Arithmetic", + "polygonPlacementMethod" : "AlwaysHorizontal" + }, "textSymbol" : { "type" : "CIMSymbolReference", "symbol" : { @@ -292,20 +332,16 @@ "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] } } ] @@ -320,7 +356,8 @@ "symbolName" : "Symbol_132" }, "useCodedValue" : true, - "visibility" : true + "visibility" : true, + "iD" : -1 } ], "labelVisibility" : true, @@ -340,7 +377,6 @@ { "type" : "CIMCharacterMarker", "enable" : true, - "colorLocked" : false, "anchorPointUnits" : "Relative", "dominantSizeAxis3D" : "Y", "size" : 10.285714285714285, @@ -348,29 +384,27 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 0, - 62, - 87, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 0, + 62, + 87, + 100 + ] } } ] - } + }, + "respectFrame" : true }, { "type" : "CIMCharacterMarker", @@ -383,33 +417,32 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 255, - 255, - 255, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 255, + 255, + 100 + ] } } ] - } + }, + "respectFrame" : true } ], "haloSize" : 1, - "scaleX" : 1 + "scaleX" : 1, + "angleAlignment" : "Display" }, "symbolName" : "Symbol_127" }, @@ -427,7 +460,6 @@ { "type" : "CIMCharacterMarker", "enable" : true, - "colorLocked" : false, "anchorPointUnits" : "Relative", "dominantSizeAxis3D" : "Y", "size" : 16.285714285714281, @@ -435,29 +467,27 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 0, - 62, - 87, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 0, + 62, + 87, + 100 + ] } } ] - } + }, + "respectFrame" : true }, { "type" : "CIMCharacterMarker", @@ -470,33 +500,32 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 255, - 255, - 255, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 255, + 255, + 100 + ] } } ] - } + }, + "respectFrame" : true } ], "haloSize" : 1, - "scaleX" : 1 + "scaleX" : 1, + "angleAlignment" : "Display" }, "symbolName" : "Symbol_128" }, @@ -514,7 +543,6 @@ { "type" : "CIMCharacterMarker", "enable" : true, - "colorLocked" : false, "anchorPointUnits" : "Relative", "dominantSizeAxis3D" : "Y", "size" : 22.285714285714281, @@ -522,29 +550,27 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 0, - 62, - 87, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 0, + 62, + 87, + 100 + ] } } ] - } + }, + "respectFrame" : true }, { "type" : "CIMCharacterMarker", @@ -557,33 +583,32 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 255, - 255, - 255, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 255, + 255, + 100 + ] } } ] - } + }, + "respectFrame" : true } ], "haloSize" : 1, - "scaleX" : 1 + "scaleX" : 1, + "angleAlignment" : "Display" }, "symbolName" : "Symbol_129" }, @@ -601,7 +626,6 @@ { "type" : "CIMCharacterMarker", "enable" : true, - "colorLocked" : false, "anchorPointUnits" : "Relative", "dominantSizeAxis3D" : "Y", "size" : 28.285714285714278, @@ -609,29 +633,27 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 0, - 62, - 87, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 0, + 62, + 87, + 100 + ] } } ] - } + }, + "respectFrame" : true }, { "type" : "CIMCharacterMarker", @@ -644,33 +666,32 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 255, - 255, - 255, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 255, + 255, + 100 + ] } } ] - } + }, + "respectFrame" : true } ], "haloSize" : 1, - "scaleX" : 1 + "scaleX" : 1, + "angleAlignment" : "Display" }, "symbolName" : "Symbol_130" }, @@ -688,7 +709,6 @@ { "type" : "CIMCharacterMarker", "enable" : true, - "colorLocked" : false, "anchorPointUnits" : "Relative", "dominantSizeAxis3D" : "Y", "size" : 34.285714285714278, @@ -696,29 +716,27 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 0, - 62, - 87, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 0, + 62, + 87, + 100 + ] } } ] - } + }, + "respectFrame" : true }, { "type" : "CIMCharacterMarker", @@ -731,33 +749,32 @@ "characterIndex" : 33, "fontFamilyName" : "ESRI Default Marker", "fontStyleName" : "Regular", + "fontType" : "Unspecified", "scaleX" : 1, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 255, - 255, - 255, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 255, + 255, + 100 + ] } } ] - } + }, + "respectFrame" : true } ], "haloSize" : 1, - "scaleX" : 1 + "scaleX" : 1, + "angleAlignment" : "Display" }, "symbolName" : "Symbol_131" }, @@ -777,7 +794,7 @@ "zeroPad" : true }, "showInAscendingOrder" : true, - "heading" : "ICOUNT", + "heading" : "Incident Count", "sampleSize" : 10000, "useExclusionSymbol" : false, "normalizationTotal" : 1, @@ -787,13 +804,30 @@ "snappable" : true } ], + "binaryReferences" : [ + { + "type" : "CIMBinaryReference", + "uRI" : "CIMPATH=Metadata/95ba227ac3aa0d4c1bf488d9f5ccf516.xml", + "data" : "\r\n20170504093837001.0TRUECluster Analysis\r\n" + } + ], "elevationSurfaces" : [ { "type" : "CIMMapElevationSurface", "elevationMode" : "BaseGlobeSurface", "name" : "Ground", "verticalExaggeration" : 1, - "mapElevationID" : "{DEBAA02C-6E95-4392-84FE-6E503CC8DD02}" + "mapElevationID" : "{C57EE817-32A4-4173-86FD-6157EBA40993}", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 255, + 255, + 100 + ] + }, + "surfaceTINShadingMode" : "Smooth" } ] } \ No newline at end of file diff --git a/patterns/toolboxes/layers/CountIncidentByLOC.lyr b/patterns/toolboxes/layers/CountIncidentByLOC.lyr index 7679c819..3cf61f0d 100644 Binary files a/patterns/toolboxes/layers/CountIncidentByLOC.lyr and b/patterns/toolboxes/layers/CountIncidentByLOC.lyr differ diff --git a/patterns/toolboxes/layers/CountIncidentByLOC.lyrx b/patterns/toolboxes/layers/CountIncidentByLOC.lyrx index 239c904a..437b6cbc 100644 --- a/patterns/toolboxes/layers/CountIncidentByLOC.lyrx +++ b/patterns/toolboxes/layers/CountIncidentByLOC.lyrx @@ -1,33 +1,159 @@ { "type" : "CIMLayerDocument", - "version" : "1.0.0", + "version" : "1.4.0", + "build" : 7198, "layers" : [ - "CIMPATH=gp_arcpy_map/count_incidents_by_loc.xml" + "CIMPATH=roadwic_fix5.xml" ], "layerDefinitions" : [ { "type" : "CIMFeatureLayer", - "name" : "Count Incidents by LOC", - "uRI" : "CIMPATH=gp_arcpy_map/count_incidents_by_loc.xml", - "sourceModifiedTime" : { - "type" : "TimeInstant" - }, - "description" : "Jalalabad Road Hotspots - Count by LOC", - "layerElevation" : { - "type" : "CIMLayerElevationSurface", - "mapElevationID" : "{A56F15D5-996B-4A94-A31B-1D83EF964646}" - }, + "name" : "RoadWIC_fix5", + "uRI" : "CIMPATH=roadwic_fix5.xml", + "attribution" : "Esri", + "description" : "Incident Fequency", "layerType" : "Operational", "showLegends" : true, - "visibility" : false, + "visibility" : true, "displayCacheType" : "Permanent", "maxDisplayCacheAge" : 5, "showPopups" : true, + "serviceLayerID" : -1, "autoGenerateFeatureTemplates" : true, "featureTable" : { "type" : "CIMFeatureTable", - "displayField" : "FID_roads", + "displayField" : "fcsubtype", "editable" : true, + "fieldDescriptions" : [ + { + "type" : "CIMFieldDescription", + "alias" : "OBJECTID", + "fieldName" : "OBJECTID", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "readOnly" : true, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Shape", + "fieldName" : "shape", + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Feature Code Subtype", + "fieldName" : "fcsubtype", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Feature Code", + "fieldName" : "f_code", + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Length", + "fieldName" : "lzn", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Route Designation", + "fieldName" : "rtn", + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Route Designation (route designation type)", + "fieldName" : "rtn_roi", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Width", + "fieldName" : "wid", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Geographic Name Information : Full Name", + "fieldName" : "zi005_fna", + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "shape_Length", + "fieldName" : "shape_Length", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "readOnly" : true, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "FREQUENCY", + "fieldName" : "FREQUENCY", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "visible" : true, + "searchMode" : "Exact" + } + ], "timeFields" : { "type" : "CIMTimeTableDefinition" }, @@ -42,9 +168,9 @@ }, "dataConnection" : { "type" : "CIMStandardDataConnection", - "workspaceConnectionString" : "DATABASE=..\\Results.gdb", + "workspaceConnectionString" : "DATABASE=C:\\Users\\matt2542\\Documents\\ArcGIS\\scratch.gdb", "workspaceFactory" : "FileGDB", - "dataset" : "CountIncidentsbyLOC", + "dataset" : "RoadWIC_fix5", "datasetType" : "esriDTFeatureClass" }, "studyAreaSpatialRel" : "esriSpatialRelUndefined", @@ -66,7 +192,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -84,25 +209,25 @@ } ] }, - "symbolName" : "Symbol_139" - }, - "exclusionSet" : { + "symbolName" : "Symbol_18" }, + "featureCacheType" : "None", + "enableDisplayFilters" : true, "labelClasses" : [ { "type" : "CIMLabelClass", - "expression" : "[FID_roads]", - "expressionEngine" : "VBScript", + "expression" : "[f_code]", + "expressionEngine" : "Python", "featuresToLabel" : "AllVisibleFeatures", "maplexLabelPlacementProperties" : { "type" : "CIMMaplexLabelPlacementProperties", - "featureType" : "Point", + "featureType" : "Line", "avoidPolygonHoles" : true, "canOverrunFeature" : true, "canPlaceLabelOutsidePolygon" : true, "canRemoveOverlappingLabel" : true, "canStackLabel" : true, - "connectionType" : "MinimizeLabels", + "connectionType" : "Unambiguous", "constrainOffset" : "AboveLine", "contourAlignmentType" : "Page", "contourLadderType" : "Straight", @@ -206,7 +331,7 @@ "truncationPreferredCharacters" : "aeiou" }, "name" : "Default", - "priority" : 10, + "priority" : 19, "textSymbol" : { "type" : "CIMSymbolReference", "symbol" : { @@ -223,12 +348,12 @@ "fontStyleName" : "Regular", "fontType" : "Unspecified", "haloSize" : 1, - "height" : 8, + "height" : 12, "hinting" : "Default", - "horizontalAlignment" : "Center", + "horizontalAlignment" : "Left", "kerning" : true, "letterWidth" : 100, - "ligatures" : false, + "ligatures" : true, "lineGapType" : "ExtraLeading", "shadowColor" : { "type" : "CIMRGBColor", @@ -243,35 +368,32 @@ "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 112, + 255, + 100 + ] } } ] }, "textCase" : "Normal", "textDirection" : "LTR", - "verticalAlignment" : "Bottom", + "verticalAlignment" : "Baseline", "verticalGlyphOrientation" : "Right", "wordSpacing" : 100, "billboardMode3D" : "FaceNearPlane" }, - "symbolName" : "Symbol_138" + "symbolName" : "Symbol_17" }, "useCodedValue" : true, - "visibility" : true + "visibility" : true, + "iD" : -1 } ], "renderer" : { @@ -290,7 +412,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -308,9 +429,9 @@ } ] }, - "symbolName" : "Symbol_134" + "symbolName" : "Symbol_13" }, - "upperBound" : 10.011133839331503 + "upperBound" : 10 }, { "type" : "CIMClassBreak", @@ -324,7 +445,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -342,13 +462,13 @@ } ] }, - "symbolName" : "Symbol_135" + "symbolName" : "Symbol_14" }, - "upperBound" : 20.992267478383116 + "upperBound" : 21 }, { "type" : "CIMClassBreak", - "label" : "22 - 31", + "label" : "22 - 46", "patch" : "Default", "symbol" : { "type" : "CIMSymbolReference", @@ -358,7 +478,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -376,13 +495,13 @@ } ] }, - "symbolName" : "Symbol_136" + "symbolName" : "Symbol_15" }, - "upperBound" : 31 + "upperBound" : 46 }, { "type" : "CIMClassBreak", - "label" : "32 - 76", + "label" : "47 - 85", "patch" : "Default", "symbol" : { "type" : "CIMSymbolReference", @@ -392,7 +511,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -410,13 +528,13 @@ } ] }, - "symbolName" : "Symbol_137" + "symbolName" : "Symbol_16" }, - "upperBound" : 76 + "upperBound" : 85 } ], "classBreakType" : "GraduatedColor", - "classificationMethod" : "Manual", + "classificationMethod" : "NaturalBreaks", "colorRamp" : { "type" : "CIMLinearContinuousColorRamp", "colorSpace" : { @@ -443,7 +561,7 @@ } }, "field" : "FREQUENCY", - "minimumBreak" : 1, + "minimumBreak" : 5, "numberFormat" : { "type" : "CIMNumericFormat", "alignmentOption" : "esriAlignLeft", @@ -453,9 +571,8 @@ "zeroPad" : true }, "showInAscendingOrder" : true, - "heading" : "FREQUENCY", + "heading" : "Incident Frequency", "sampleSize" : 10000, - "exclusionClause" : "FREQUENCY \u003c= 4", "useExclusionSymbol" : false, "normalizationTotal" : 1, "normalizationType" : "Nothing" @@ -463,14 +580,5 @@ "scaleSymbols" : true, "snappable" : true } - ], - "elevationSurfaces" : [ - { - "type" : "CIMMapElevationSurface", - "elevationMode" : "BaseGlobeSurface", - "name" : "Ground", - "verticalExaggeration" : 1, - "mapElevationID" : "{A56F15D5-996B-4A94-A31B-1D83EF964646}" - } ] } \ No newline at end of file diff --git a/patterns/toolboxes/layers/HotSpotsByArea.lyr b/patterns/toolboxes/layers/HotSpotsByArea.lyr index 994feee6..9d1b7d3c 100644 Binary files a/patterns/toolboxes/layers/HotSpotsByArea.lyr and b/patterns/toolboxes/layers/HotSpotsByArea.lyr differ diff --git a/patterns/toolboxes/layers/HotSpotsByArea.lyrx b/patterns/toolboxes/layers/HotSpotsByArea.lyrx index e9d686a2..d493a65e 100644 --- a/patterns/toolboxes/layers/HotSpotsByArea.lyrx +++ b/patterns/toolboxes/layers/HotSpotsByArea.lyrx @@ -1,6 +1,7 @@ { "type" : "CIMLayerDocument", - "version" : "1.0.0", + "version" : "1.4.0", + "build" : 7198, "layers" : [ "CIMPATH=gp_arcpy_map/d1_hotspots.xml" ], @@ -12,16 +13,19 @@ "sourceModifiedTime" : { "type" : "TimeInstant" }, + "metadataURI" : "CIMPATH=Metadata/32aadbc524fa3998b87e550415ec19f9.xml", "layerElevation" : { "type" : "CIMLayerElevationSurface", - "mapElevationID" : "{0C469D8A-700D-47D1-AA31-F12AC0528C73}" + "mapElevationID" : "53006ba2e94a468eb67bdaf44815bf87" }, + "expanded" : true, "layerType" : "Operational", "showLegends" : true, "visibility" : true, "displayCacheType" : "Permanent", "maxDisplayCacheAge" : 5, "showPopups" : true, + "serviceLayerID" : -1, "autoGenerateFeatureTemplates" : true, "featureTable" : { "type" : "CIMFeatureTable", @@ -41,7 +45,7 @@ }, "dataConnection" : { "type" : "CIMStandardDataConnection", - "workspaceConnectionString" : "DATABASE=..\\Results.gdb", + "workspaceConnectionString" : "DATABASE=D:\\GitHub\\solutions-geoprocessing-toolbox\\patterns\\toolboxes\\Results.gdb", "workspaceFactory" : "FileGDB", "dataset" : "D1_HotSpots", "datasetType" : "esriDTFeatureClass" @@ -66,7 +70,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_0", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -86,8 +89,8 @@ }, "symbolName" : "Symbol_148" }, - "exclusionSet" : { - }, + "featureCacheType" : "None", + "enableDisplayFilters" : true, "labelClasses" : [ { "type" : "CIMLabelClass", @@ -207,6 +210,45 @@ }, "name" : "Default", "priority" : 7, + "standardLabelPlacementProperties" : { + "type" : "CIMStandardLabelPlacementProperties", + "featureType" : "Line", + "featureWeight" : "Low", + "labelWeight" : "High", + "numLabelsOption" : "OneLabelPerName", + "lineLabelPosition" : { + "type" : "CIMStandardLineLabelPosition", + "above" : true, + "inLine" : true, + "parallel" : true + }, + "lineLabelPriorities" : { + "type" : "CIMStandardLineLabelPriorities", + "aboveStart" : 3, + "aboveAlong" : 3, + "aboveEnd" : 3, + "centerStart" : 3, + "centerAlong" : 3, + "centerEnd" : 3, + "belowStart" : 3, + "belowAlong" : 3, + "belowEnd" : 3 + }, + "pointPlacementMethod" : "AroundPoint", + "pointPlacementPriorities" : { + "type" : "CIMStandardPointPlacementPriorities", + "aboveLeft" : 2, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerLeft" : 3, + "centerRight" : 2, + "belowLeft" : 3, + "belowCenter" : 3, + "belowRight" : 2 + }, + "rotationType" : "Arithmetic", + "polygonPlacementMethod" : "AlwaysHorizontal" + }, "textSymbol" : { "type" : "CIMSymbolReference", "symbol" : { @@ -243,20 +285,16 @@ "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] } } ] @@ -271,7 +309,8 @@ "symbolName" : "Symbol_147" }, "useCodedValue" : true, - "visibility" : true + "visibility" : true, + "iD" : -1 } ], "renderer" : { @@ -291,7 +330,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -308,21 +346,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 214, - 62, - 71, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 214, + 62, + 71, + 100 + ] } } ] @@ -344,7 +378,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -361,21 +394,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 211, - 29, - 73, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 211, + 29, + 73, + 100 + ] } } ] @@ -397,7 +426,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -414,21 +442,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 109, - 7, - 80, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 109, + 7, + 80, + 100 + ] } } ] @@ -450,7 +474,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -469,8 +492,7 @@ ] }, "symbolName" : "Symbol_143" - }, - "upperBound" : 0 + } }, { "type" : "CIMClassBreak", @@ -485,7 +507,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -502,21 +523,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 27, - 47, - 98, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 27, + 47, + 98, + 100 + ] } } ] @@ -538,7 +555,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -555,21 +571,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 14, - 66, - 93, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 14, + 66, + 93, + 100 + ] } } ] @@ -591,7 +603,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -608,21 +619,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 3, - 82, - 84, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 3, + 82, + 84, + 100 + ] } } ] @@ -704,7 +711,7 @@ "zeroPad" : true }, "showInAscendingOrder" : true, - "heading" : "Gi_Bin", + "heading" : "Hot Spot Confidence", "sampleSize" : 10000, "useExclusionSymbol" : false, "normalizationTotal" : 1, @@ -755,13 +762,21 @@ } } ], + "binaryReferences" : [ + { + "type" : "CIMBinaryReference", + "uRI" : "CIMPATH=Metadata/32aadbc524fa3998b87e550415ec19f9.xml", + "data" : "\r\n20170508105304001.0TRUED1_HotSpots\r\n" + } + ], "elevationSurfaces" : [ { "type" : "CIMMapElevationSurface", "elevationMode" : "BaseGlobeSurface", "name" : "Ground", "verticalExaggeration" : 1, - "mapElevationID" : "{0C469D8A-700D-47D1-AA31-F12AC0528C73}" + "mapElevationID" : "53006ba2e94a468eb67bdaf44815bf87", + "surfaceTINShadingMode" : "Smooth" } ] } \ No newline at end of file diff --git a/patterns/toolboxes/layers/IncidentDensityFeatures.lyr b/patterns/toolboxes/layers/IncidentDensityFeatures.lyr new file mode 100644 index 00000000..ecbe25e7 Binary files /dev/null and b/patterns/toolboxes/layers/IncidentDensityFeatures.lyr differ diff --git a/patterns/toolboxes/layers/IncidentDensityFeatures.lyrx b/patterns/toolboxes/layers/IncidentDensityFeatures.lyrx new file mode 100644 index 00000000..325ccc98 --- /dev/null +++ b/patterns/toolboxes/layers/IncidentDensityFeatures.lyrx @@ -0,0 +1,1161 @@ +{ + "type" : "CIMLayerDocument", + "version" : "1.4.0", + "build" : 7198, + "layers" : [ + "CIMPATH=idfeatures0001.xml" + ], + "layerDefinitions" : [ + { + "type" : "CIMFeatureLayer", + "name" : "IDFeatures0001", + "uRI" : "CIMPATH=idfeatures0001.xml", + "layerType" : "Operational", + "showLegends" : true, + "visibility" : true, + "displayCacheType" : "Permanent", + "maxDisplayCacheAge" : 5, + "showPopups" : true, + "serviceLayerID" : -1, + "autoGenerateFeatureTemplates" : true, + "featureTable" : { + "type" : "CIMFeatureTable", + "displayField" : "SOURCE_ID", + "editable" : true, + "fieldDescriptions" : [ + { + "type" : "CIMFieldDescription", + "alias" : "OBJECTID", + "fieldName" : "OBJECTID", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "readOnly" : true, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Shape", + "fieldName" : "Shape", + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "SOURCE_ID", + "fieldName" : "SOURCE_ID", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "ICOUNT", + "fieldName" : "ICOUNT", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "GiZScore Fixed 287", + "fieldName" : "GiZScore", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "GiPValue Fixed 287", + "fieldName" : "GiPValue", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "Gi_Bin Fixed 287_FDR", + "fieldName" : "Gi_Bin", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "visible" : true, + "searchMode" : "Exact" + } + ], + "timeFields" : { + "type" : "CIMTimeTableDefinition" + }, + "timeDefinition" : { + "type" : "CIMTimeDataDefinition" + }, + "timeDisplayDefinition" : { + "type" : "CIMTimeDisplayDefinition", + "timeInterval" : 0, + "timeIntervalUnits" : "esriTimeUnitsHours", + "timeOffsetUnits" : "esriTimeUnitsYears" + }, + "dataConnection" : { + "type" : "CIMStandardDataConnection", + "workspaceConnectionString" : "DATABASE=..\\..\\..\\..\\..\\Workspace\\IncidentAnalysis\\ID0001.gdb", + "workspaceFactory" : "FileGDB", + "dataset" : "IDFeatures0001", + "datasetType" : "esriDTFeatureClass" + }, + "studyAreaSpatialRel" : "esriSpatialRelUndefined", + "searchOrder" : "esriSearchOrderSpatial" + }, + "htmlPopupEnabled" : true, + "htmlPopupFormat" : { + "type" : "CIMHtmlPopupFormat", + "htmlUseCodedDomainValues" : true, + "htmlPresentationStyle" : "TwoColumnTable" + }, + "isFlattened" : true, + "selectable" : true, + "selectionSymbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMVectorMarker", + "enable" : true, + "name" : "Level_0", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Z", + "size" : 8, + "billboardMode3D" : "FaceNearPlane", + "frame" : { + "xmin" : -2, + "ymin" : -2, + "xmax" : 2, + "ymax" : 2 + }, + "markerGraphics" : [ + { + "type" : "CIMMarkerGraphic", + "geometry" : { + "curveRings" : [ + [ + [ + 1.2246467991473532e-16, + 2 + ], + { + "a" : [ + [ + 1.2246467991473532e-16, + 2 + ], + [ + 0, + 0 + ], + 0, + 1 + ] + } + ] + ] + }, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_0", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 255, + 255, + 100 + ] + } + } + ] + } + } + ], + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_90" + }, + "featureCacheType" : "None", + "enableDisplayFilters" : true, + "labelClasses" : [ + { + "type" : "CIMLabelClass", + "expression" : "[MYID]", + "expressionEngine" : "VBScript", + "featuresToLabel" : "AllVisibleFeatures", + "maplexLabelPlacementProperties" : { + "type" : "CIMMaplexLabelPlacementProperties", + "featureType" : "Point", + "avoidPolygonHoles" : true, + "canOverrunFeature" : true, + "canPlaceLabelOutsidePolygon" : true, + "canRemoveOverlappingLabel" : true, + "canStackLabel" : true, + "connectionType" : "Unambiguous", + "constrainOffset" : "NoConstraint", + "contourAlignmentType" : "Page", + "contourLadderType" : "Straight", + "contourMaximumAngle" : 90, + "enableConnection" : true, + "enablePointPlacementPriorities" : true, + "featureWeight" : 0, + "fontHeightReductionLimit" : 4, + "fontHeightReductionStep" : 0.5, + "fontWidthReductionLimit" : 90, + "fontWidthReductionStep" : 5, + "graticuleAlignmentType" : "Straight", + "keyNumberGroupName" : "Default", + "labelBuffer" : 15, + "labelLargestPolygon" : true, + "labelPriority" : -1, + "labelStackingProperties" : { + "type" : "CIMMaplexLabelStackingProperties", + "stackAlignment" : "ChooseBest", + "maximumNumberOfLines" : 3, + "minimumNumberOfCharsPerLine" : 3, + "maximumNumberOfCharsPerLine" : 24, + "separators" : [ + { + "type" : "CIMMaplexStackingSeparator", + "separator" : " ", + "splitAfter" : true + }, + { + "type" : "CIMMaplexStackingSeparator", + "separator" : ",", + "visible" : true, + "splitAfter" : true + } + ] + }, + "lineFeatureType" : "General", + "linePlacementMethod" : "OffsetCurvedFromLine", + "maximumLabelOverrun" : 36, + "maximumLabelOverrunUnit" : "Point", + "minimumFeatureSizeUnit" : "Map", + "multiPartOption" : "OneLabelPerPart", + "offsetAlongLineProperties" : { + "type" : "CIMMaplexOffsetAlongLineProperties", + "placementMethod" : "BestPositionAlongLine", + "labelAnchorPoint" : "CenterOfLabel", + "distanceUnit" : "Percentage", + "useLineDirection" : true + }, + "pointExternalZonePriorities" : { + "type" : "CIMMaplexExternalZonePriorities", + "aboveLeft" : 4, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerRight" : 3, + "belowRight" : 5, + "belowCenter" : 7, + "belowLeft" : 8, + "centerLeft" : 6 + }, + "pointPlacementMethod" : "AroundPoint", + "polygonAnchorPointType" : "GeometricCenter", + "polygonBoundaryWeight" : 0, + "polygonExternalZones" : { + "type" : "CIMMaplexExternalZonePriorities", + "aboveLeft" : 4, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerRight" : 3, + "belowRight" : 5, + "belowCenter" : 7, + "belowLeft" : 8, + "centerLeft" : 6 + }, + "polygonFeatureType" : "General", + "polygonInternalZones" : { + "type" : "CIMMaplexInternalZonePriorities", + "center" : 1 + }, + "polygonPlacementMethod" : "CurvedInPolygon", + "primaryOffset" : 1, + "primaryOffsetUnit" : "Point", + "removeExtraWhiteSpace" : true, + "repetitionIntervalUnit" : "Map", + "rotationProperties" : { + "type" : "CIMMaplexRotationProperties", + "rotationType" : "Arithmetic", + "alignmentType" : "Straight" + }, + "secondaryOffset" : 100, + "strategyPriorities" : { + "type" : "CIMMaplexStrategyPriorities", + "stacking" : 1, + "overrun" : 2, + "fontCompression" : 3, + "fontReduction" : 4, + "abbreviation" : 5 + }, + "thinningDistanceUnit" : "Point", + "truncationMarkerCharacter" : ".", + "truncationMinimumLength" : 1, + "truncationPreferredCharacters" : "aeiou" + }, + "name" : "Default", + "priority" : 1, + "textSymbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMTextSymbol", + "blockProgression" : "TTB", + "compatibilityMode" : true, + "depth3D" : 1, + "drawSoftHyphen" : true, + "extrapolateBaselines" : true, + "flipAngle" : 90, + "fontEffects" : "Normal", + "fontEncoding" : "Unicode", + "fontFamilyName" : "Arial", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "haloSize" : 1, + "height" : 8, + "hinting" : "Default", + "horizontalAlignment" : "Center", + "kerning" : true, + "letterWidth" : 100, + "ligatures" : true, + "lineGapType" : "ExtraLeading", + "shadowColor" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + }, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "textCase" : "Normal", + "textDirection" : "LTR", + "verticalAlignment" : "Bottom", + "verticalGlyphOrientation" : "Right", + "wordSpacing" : 100, + "billboardMode3D" : "FaceNearPlane" + }, + "symbolName" : "Symbol_89" + }, + "useCodedValue" : true, + "visibility" : true, + "iD" : -1 + } + ], + "renderer" : { + "type" : "CIMClassBreaksRenderer", + "barrierWeight" : "None", + "breaks" : [ + { + "type" : "CIMClassBreak", + "label" : "Cold Spot - 99% Confidence", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_6", + "colorLocked" : true, + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 40, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_6", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_6", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 33, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_6", + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 214, + 62, + 71, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_82" + }, + "upperBound" : -3 + }, + { + "type" : "CIMClassBreak", + "label" : "Cold Spot - 95% Confidence", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_4", + "colorLocked" : true, + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 40, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_4", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_4", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 33, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_4", + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 211, + 29, + 73, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_83" + }, + "upperBound" : -2 + }, + { + "type" : "CIMClassBreak", + "label" : "Cold Spot - 90% Confidence", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_2", + "colorLocked" : true, + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 40, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_2", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_2", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 33, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_2", + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 109, + 7, + 80, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_84" + }, + "upperBound" : -1 + }, + { + "type" : "CIMClassBreak", + "label" : "Not Significant", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_1", + "colorLocked" : true, + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 40, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_1", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_1", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 33, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_1", + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 60, + 25, + 100, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_85" + } + }, + { + "type" : "CIMClassBreak", + "label" : "Hot Spot - 90% Confidence", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_3", + "colorLocked" : true, + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 40, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_3", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_3", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 33, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_3", + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 27, + 47, + 98, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_86" + }, + "upperBound" : 1 + }, + { + "type" : "CIMClassBreak", + "label" : "Hot Spot - 95% Confidence", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_5", + "colorLocked" : true, + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 40, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_5", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_5", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 33, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_5", + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 14, + 66, + 93, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_87" + }, + "upperBound" : 2 + }, + { + "type" : "CIMClassBreak", + "label" : "Hot Spot - 99% Confidence", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_7", + "colorLocked" : true, + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 40, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_7", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMCharacterMarker", + "enable" : true, + "name" : "Level_7", + "anchorPointUnits" : "Relative", + "dominantSizeAxis3D" : "Y", + "size" : 7, + "billboardMode3D" : "FaceNearPlane", + "characterIndex" : 33, + "fontFamilyName" : "ESRI Default Marker", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "scaleX" : 1, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "name" : "Level_7", + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 3, + 82, + 84, + 100 + ] + } + } + ] + }, + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Map" + }, + "symbolName" : "Symbol_88" + }, + "upperBound" : 3 + } + ], + "classBreakType" : "GraduatedColor", + "classificationMethod" : "Manual", + "colorRamp" : { + "type" : "CIMMultipartColorRamp", + "colorRamps" : [ + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 55.541695509605077, + -1.1449314297332647, + -34.505914120063544, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 98.682614916117672, + -7.7588099004781146, + 23.811935632576752, + 100 + ] + } + }, + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 98.682614916117672, + -7.7588099004781146, + 23.811935632576752, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 53.378070819921533, + 59.326736895621401, + 45.249483744013219, + 100 + ] + } + } + ], + "weights" : [ + 1, + 1 + ] + }, + "field" : "Gi_Bin", + "minimumBreak" : -3, + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignLeft", + "alignmentWidth" : 12, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0, + "zeroPad" : true + }, + "showInAscendingOrder" : true, + "heading" : "Hot Spot Confidence", + "sampleSize" : 10000, + "useExclusionSymbol" : false, + "normalizationTotal" : 1, + "normalizationType" : "Nothing" + }, + "scaleSymbols" : true, + "snappable" : true, + "symbolLayerDrawing" : { + "type" : "CIMSymbolLayerDrawing", + "symbolLayers" : [ + { + "type" : "CIMSymbolLayerIdentifier", + "symbolReferenceName" : "Symbol_88", + "symbolLayerName" : "Level_7" + }, + { + "type" : "CIMSymbolLayerIdentifier", + "symbolReferenceName" : "Symbol_82", + "symbolLayerName" : "Level_6" + }, + { + "type" : "CIMSymbolLayerIdentifier", + "symbolReferenceName" : "Symbol_87", + "symbolLayerName" : "Level_5" + }, + { + "type" : "CIMSymbolLayerIdentifier", + "symbolReferenceName" : "Symbol_83", + "symbolLayerName" : "Level_4" + }, + { + "type" : "CIMSymbolLayerIdentifier", + "symbolReferenceName" : "Symbol_86", + "symbolLayerName" : "Level_3" + }, + { + "type" : "CIMSymbolLayerIdentifier", + "symbolReferenceName" : "Symbol_84", + "symbolLayerName" : "Level_2" + }, + { + "type" : "CIMSymbolLayerIdentifier", + "symbolReferenceName" : "Symbol_85", + "symbolLayerName" : "Level_1" + } + ], + "useSymbolLayerDrawing" : true + } + } + ] +} \ No newline at end of file diff --git a/patterns/toolboxes/layers/IncidentDensity.lyr b/patterns/toolboxes/layers/IncidentDensitySurface.lyr similarity index 60% rename from patterns/toolboxes/layers/IncidentDensity.lyr rename to patterns/toolboxes/layers/IncidentDensitySurface.lyr index 972e9ec9..db024f2a 100644 Binary files a/patterns/toolboxes/layers/IncidentDensity.lyr and b/patterns/toolboxes/layers/IncidentDensitySurface.lyr differ diff --git a/patterns/toolboxes/layers/IncidentDensity.lyrx b/patterns/toolboxes/layers/IncidentDensitySurface.lyrx similarity index 61% rename from patterns/toolboxes/layers/IncidentDensity.lyrx rename to patterns/toolboxes/layers/IncidentDensitySurface.lyrx index 76b5f3b0..fccee392 100644 --- a/patterns/toolboxes/layers/IncidentDensity.lyrx +++ b/patterns/toolboxes/layers/IncidentDensitySurface.lyrx @@ -1,46 +1,27 @@ { "type" : "CIMLayerDocument", - "version" : "1.0.0", + "version" : "1.4.0", + "build" : 7198, "layers" : [ - "CIMPATH=gp_arcpy_map/incidentdensity.xml" + "CIMPATH=idsurface0001.xml" ], "layerDefinitions" : [ { "type" : "CIMRasterLayer", - "name" : "IncidentDensity", - "uRI" : "CIMPATH=gp_arcpy_map/incidentdensity.xml", - "sourceModifiedTime" : { - "type" : "TimeInstant" - }, - "layerElevation" : { - "type" : "CIMLayerElevationSurface", - "mapElevationID" : "{3203981A-4C0A-4860-8B5B-34D184C26CEC}" - }, - "layer3DProperties" : { - "type" : "CIM3DLayerProperties", - "castShadows" : true, - "isLayerLit" : true, - "layerFaceCulling" : "None", - "maxDistance" : -1, - "minDistance" : -1, - "preloadTextureCutoffHigh" : 0, - "preloadTextureCutoffLow" : 0.25, - "textureCutoffHigh" : 0.25, - "textureCutoffLow" : 1, - "useCompressedTextures" : true, - "verticalExaggeration" : 1 - }, + "name" : "IDSurface0001", + "uRI" : "CIMPATH=idsurface0001.xml", "layerType" : "Operational", "showLegends" : true, "visibility" : true, "displayCacheType" : "Permanent", "maxDisplayCacheAge" : 5, "showPopups" : true, + "serviceLayerID" : -1, "dataConnection" : { "type" : "CIMStandardDataConnection", - "workspaceConnectionString" : "DATABASE=..\\Results.gdb", + "workspaceConnectionString" : "DATABASE=..\\..\\..\\..\\..\\Workspace\\IncidentAnalysis\\incidentanalysis4.0.2_ELINZ_2MAY2017_1240\\data\\IncidentAnalysis.gdb", "workspaceFactory" : "FileGDB", - "dataset" : "IncidentDensity", + "dataset" : "IDSurface0001", "datasetType" : "esriDTRasterDataset" }, "colorizer" : { @@ -125,7 +106,7 @@ ] }, "colorScheme" : "Red to Green", - "customStretchMax" : 464.60855102539062, + "customStretchMax" : 464.60855102539063, "eSRIStretchContrast" : -1.7976931348623157e+308, "eSRIStretchMean" : -1.7976931348623157e+308, "gammaValue" : 1, @@ -410,6 +391,273 @@ } ], "stretchStats" : { + "type" : "StatsHistogram", + "min" : 0, + "max" : 797.84991455078125, + "mean" : 51.2942163930596, + "stddev" : 90.28131037799227, + "limitMin" : 0, + "limitMax" : 797.84991455078125, + "histogram" : [ + 0, + 1068, + 939, + 758, + 636, + 541, + 568, + 504, + 481, + 479, + 421, + 440, + 403, + 409, + 398, + 396, + 371, + 360, + 343, + 369, + 359, + 403, + 379, + 366, + 339, + 358, + 347, + 352, + 345, + 304, + 333, + 311, + 270, + 272, + 280, + 271, + 258, + 276, + 229, + 226, + 240, + 232, + 215, + 217, + 216, + 201, + 182, + 190, + 182, + 190, + 175, + 179, + 154, + 158, + 154, + 170, + 167, + 142, + 141, + 116, + 144, + 133, + 120, + 97, + 97, + 126, + 94, + 100, + 108, + 104, + 103, + 97, + 94, + 84, + 90, + 80, + 85, + 78, + 86, + 68, + 69, + 64, + 65, + 53, + 63, + 62, + 62, + 53, + 68, + 55, + 61, + 55, + 49, + 51, + 44, + 56, + 48, + 45, + 41, + 47, + 26, + 47, + 45, + 38, + 36, + 40, + 16, + 34, + 26, + 33, + 31, + 40, + 25, + 22, + 23, + 19, + 19, + 26, + 26, + 26, + 24, + 10, + 18, + 24, + 21, + 15, + 16, + 20, + 12, + 16, + 18, + 10, + 14, + 14, + 24, + 13, + 4, + 14, + 14, + 11, + 9, + 11, + 8, + 10, + 11, + 7, + 8, + 11, + 10, + 8, + 11, + 12, + 7, + 11, + 9, + 7, + 4, + 5, + 7, + 10, + 5, + 2, + 5, + 4, + 3, + 6, + 8, + 5, + 2, + 7, + 2, + 5, + 4, + 2, + 4, + 3, + 2, + 6, + 6, + 2, + 6, + 2, + 4, + 3, + 3, + 4, + 3, + 2, + 0, + 2, + 3, + 3, + 2, + 3, + 0, + 7, + 4, + 3, + 4, + 6, + 0, + 3, + 3, + 2, + 0, + 0, + 1, + 2, + 2, + 3, + 3, + 0, + 2, + 2, + 2, + 4, + 3, + 1, + 3, + 3, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 2, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1 + ], + "nsamples" : 24173, + "resolution" : 3.128823194316789 }, "stretchType" : "PercentMinimumMaximum" }, @@ -427,14 +675,5 @@ "type" : "CIMTimeDataDefinition" } } - ], - "elevationSurfaces" : [ - { - "type" : "CIMMapElevationSurface", - "elevationMode" : "BaseGlobeSurface", - "name" : "Ground", - "verticalExaggeration" : 1, - "mapElevationID" : "{3203981A-4C0A-4860-8B5B-34D184C26CEC}" - } ] } \ No newline at end of file diff --git a/patterns/toolboxes/layers/IncidentHotSpots.lyr b/patterns/toolboxes/layers/IncidentHotSpots.lyr index aed3205e..9afc5975 100644 Binary files a/patterns/toolboxes/layers/IncidentHotSpots.lyr and b/patterns/toolboxes/layers/IncidentHotSpots.lyr differ diff --git a/patterns/toolboxes/layers/IncidentHotSpots.lyrx b/patterns/toolboxes/layers/IncidentHotSpots.lyrx index a432381b..7472f58a 100644 --- a/patterns/toolboxes/layers/IncidentHotSpots.lyrx +++ b/patterns/toolboxes/layers/IncidentHotSpots.lyrx @@ -1,6 +1,7 @@ { "type" : "CIMLayerDocument", - "version" : "1.0.0", + "version" : "1.4.0", + "build" : 7198, "layers" : [ "CIMPATH=gp_arcpy_map/incident_hot_spots.xml" ], @@ -12,16 +13,19 @@ "sourceModifiedTime" : { "type" : "TimeInstant" }, + "metadataURI" : "CIMPATH=Metadata/81464428aed3a386c8cdae71a0d7773d.xml", "layerElevation" : { "type" : "CIMLayerElevationSurface", - "mapElevationID" : "{3C4091E4-DF30-416B-91CE-2109513A9D96}" + "mapElevationID" : "{C57EE817-32A4-4173-86FD-6157EBA40993}" }, + "expanded" : true, "layerType" : "Operational", "showLegends" : true, "visibility" : true, "displayCacheType" : "Permanent", "maxDisplayCacheAge" : 5, "showPopups" : true, + "serviceLayerID" : -1, "autoGenerateFeatureTemplates" : true, "featureTable" : { "type" : "CIMFeatureTable", @@ -41,7 +45,7 @@ }, "dataConnection" : { "type" : "CIMStandardDataConnection", - "workspaceConnectionString" : "DATABASE=..\\Results.gdb", + "workspaceConnectionString" : "DATABASE=D:\\GitHub\\solutions-geoprocessing-toolbox\\patterns\\toolboxes\\Results.gdb", "workspaceFactory" : "FileGDB", "dataset" : "IncidentHotSpots", "datasetType" : "esriDTFeatureClass" @@ -66,7 +70,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_0", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -86,8 +89,8 @@ }, "symbolName" : "Symbol_157" }, - "exclusionSet" : { - }, + "featureCacheType" : "None", + "enableDisplayFilters" : true, "labelClasses" : [ { "type" : "CIMLabelClass", @@ -207,6 +210,45 @@ }, "name" : "Default", "priority" : 1, + "standardLabelPlacementProperties" : { + "type" : "CIMStandardLabelPlacementProperties", + "featureType" : "Line", + "featureWeight" : "Low", + "labelWeight" : "High", + "numLabelsOption" : "OneLabelPerName", + "lineLabelPosition" : { + "type" : "CIMStandardLineLabelPosition", + "above" : true, + "inLine" : true, + "parallel" : true + }, + "lineLabelPriorities" : { + "type" : "CIMStandardLineLabelPriorities", + "aboveStart" : 3, + "aboveAlong" : 3, + "aboveEnd" : 3, + "centerStart" : 3, + "centerAlong" : 3, + "centerEnd" : 3, + "belowStart" : 3, + "belowAlong" : 3, + "belowEnd" : 3 + }, + "pointPlacementMethod" : "AroundPoint", + "pointPlacementPriorities" : { + "type" : "CIMStandardPointPlacementPriorities", + "aboveLeft" : 2, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerLeft" : 3, + "centerRight" : 2, + "belowLeft" : 3, + "belowCenter" : 3, + "belowRight" : 2 + }, + "rotationType" : "Arithmetic", + "polygonPlacementMethod" : "AlwaysHorizontal" + }, "textSymbol" : { "type" : "CIMSymbolReference", "symbol" : { @@ -243,20 +285,16 @@ "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] } } ] @@ -271,7 +309,8 @@ "symbolName" : "Symbol_156" }, "useCodedValue" : true, - "visibility" : true + "visibility" : true, + "iD" : -1 } ], "renderer" : { @@ -291,7 +330,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -308,21 +346,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 214, - 62, - 71, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 214, + 62, + 71, + 100 + ] } } ] @@ -344,7 +378,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -361,21 +394,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 211, - 29, - 73, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 211, + 29, + 73, + 100 + ] } } ] @@ -397,7 +426,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -414,21 +442,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 109, - 7, - 80, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 109, + 7, + 80, + 100 + ] } } ] @@ -450,7 +474,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -469,8 +492,7 @@ ] }, "symbolName" : "Symbol_152" - }, - "upperBound" : 0 + } }, { "type" : "CIMClassBreak", @@ -485,7 +507,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -502,21 +523,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 27, - 47, - 98, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 27, + 47, + 98, + 100 + ] } } ] @@ -538,7 +555,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -555,21 +571,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 14, - 66, - 93, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 14, + 66, + 93, + 100 + ] } } ] @@ -591,7 +603,6 @@ "type" : "CIMSolidStroke", "enable" : true, "name" : "Level_5", - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -608,21 +619,17 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, "name" : "Level_5", - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 3, - 82, - 84, - 100 - ] - } + "color" : { + "type" : "CIMHSVColor", + "values" : [ + 3, + 82, + 84, + 100 + ] } } ] @@ -704,7 +711,7 @@ "zeroPad" : true }, "showInAscendingOrder" : true, - "heading" : "Gi_Bin", + "heading" : "Hot Spot Confidence", "sampleSize" : 10000, "useExclusionSymbol" : false, "normalizationTotal" : 1, @@ -755,13 +762,30 @@ } } ], + "binaryReferences" : [ + { + "type" : "CIMBinaryReference", + "uRI" : "CIMPATH=Metadata/81464428aed3a386c8cdae71a0d7773d.xml", + "data" : "\r\n20170504100134001.0TRUEIncident Hot Spots\r\n" + } + ], "elevationSurfaces" : [ { "type" : "CIMMapElevationSurface", "elevationMode" : "BaseGlobeSurface", "name" : "Ground", "verticalExaggeration" : 1, - "mapElevationID" : "{3C4091E4-DF30-416B-91CE-2109513A9D96}" + "mapElevationID" : "{C57EE817-32A4-4173-86FD-6157EBA40993}", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 255, + 255, + 100 + ] + }, + "surfaceTINShadingMode" : "Smooth" } ] } \ No newline at end of file diff --git a/patterns/toolboxes/layers/PercentChange.lyrx b/patterns/toolboxes/layers/PercentChange.lyrx index 44040e98..377ca4f6 100644 --- a/patterns/toolboxes/layers/PercentChange.lyrx +++ b/patterns/toolboxes/layers/PercentChange.lyrx @@ -1,49 +1,42 @@ { "type" : "CIMLayerDocument", - "version" : "1.0.0", + "version" : "1.4.0", + "build" : 7198, "layers" : [ - "CIMPATH=gp_arcpy_map/percent_change.xml" + "CIMPATH=incident_analysis_template/percent_change2.xml" ], "layerDefinitions" : [ { "type" : "CIMFeatureLayer", - "name" : "Percent Change", - "uRI" : "CIMPATH=gp_arcpy_map/percent_change.xml", + "name" : "Percent_Change", + "uRI" : "CIMPATH=incident_analysis_template/percent_change2.xml", "sourceModifiedTime" : { "type" : "TimeInstant" }, + "description" : "Percent_Change", "layerElevation" : { "type" : "CIMLayerElevationSurface", - "mapElevationID" : "{38810DDC-F9AB-41DD-97A1-5D3379658BB2}" + "mapElevationID" : "53006ba2e94a468eb67bdaf44815bf87" }, + "expanded" : true, "layerType" : "Operational", "showLegends" : true, "visibility" : true, "displayCacheType" : "Permanent", "maxDisplayCacheAge" : 5, "showPopups" : true, + "serviceLayerID" : -1, "autoGenerateFeatureTemplates" : true, + "featureElevationExpression" : "0", "featureTable" : { "type" : "CIMFeatureTable", - "displayField" : "District_1", + "displayField" : "Join_Count", "editable" : true, - "timeFields" : { - "type" : "CIMTimeTableDefinition" - }, - "timeDefinition" : { - "type" : "CIMTimeDataDefinition" - }, - "timeDisplayDefinition" : { - "type" : "CIMTimeDisplayDefinition", - "timeInterval" : 0, - "timeIntervalUnits" : "esriTimeUnitsHours", - "timeOffsetUnits" : "esriTimeUnitsYears" - }, "dataConnection" : { "type" : "CIMStandardDataConnection", - "workspaceConnectionString" : "DATABASE=..\\scratch\\scratch.gdb", + "workspaceConnectionString" : "DATABASE=C:\\Users\\matt2542\\Documents\\ArcGIS\\Projects\\IncidentAnalysis_DBARNES_2MAY2017_1445\\ID0001.gdb", "workspaceFactory" : "FileGDB", - "dataset" : "Activity_with_JoinCounts", + "dataset" : "Percent_Change", "datasetType" : "esriDTFeatureClass" }, "studyAreaSpatialRel" : "esriSpatialRelUndefined", @@ -55,50 +48,21 @@ "htmlUseCodedDomainValues" : true, "htmlPresentationStyle" : "TwoColumnTable" }, - "isFlattened" : true, "selectable" : true, - "selectionSymbol" : { - "type" : "CIMSymbolReference", - "symbol" : { - "type" : "CIMPolygonSymbol", - "symbolLayers" : [ - { - "type" : "CIMSolidStroke", - "enable" : true, - "colorLocked" : false, - "capStyle" : "Round", - "joinStyle" : "Round", - "lineStyle3D" : "Strip", - "miterLimit" : 10, - "width" : 2, - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 255, - 255, - 100 - ] - } - } - ] - }, - "symbolName" : "Symbol_164" - }, - "exclusionSet" : { - }, + "featureCacheType" : "None", + "enableDisplayFilters" : true, "labelClasses" : [ { "type" : "CIMLabelClass", - "expression" : "[PercentChange]+\"%\"", - "expressionEngine" : "VBScript", + "expression" : "$feature.Join_Count", + "expressionEngine" : "Arcade", "featuresToLabel" : "AllVisibleFeatures", "maplexLabelPlacementProperties" : { "type" : "CIMMaplexLabelPlacementProperties", - "featureType" : "Point", + "featureType" : "Polygon", "avoidPolygonHoles" : true, "canOverrunFeature" : true, - "canPlaceLabelOutsidePolygon" : false, + "canPlaceLabelOutsidePolygon" : true, "canRemoveOverlappingLabel" : true, "canStackLabel" : true, "connectionType" : "Unambiguous", @@ -204,83 +168,105 @@ "truncationMinimumLength" : 1, "truncationPreferredCharacters" : "aeiou" }, - "name" : "Default", - "priority" : 1, + "name" : "Class 1", + "priority" : -1, + "standardLabelPlacementProperties" : { + "type" : "CIMStandardLabelPlacementProperties", + "featureType" : "Line", + "featureWeight" : "Low", + "labelWeight" : "High", + "numLabelsOption" : "OneLabelPerName", + "lineLabelPosition" : { + "type" : "CIMStandardLineLabelPosition", + "above" : true, + "inLine" : true, + "parallel" : true + }, + "lineLabelPriorities" : { + "type" : "CIMStandardLineLabelPriorities", + "aboveStart" : 3, + "aboveAlong" : 3, + "aboveEnd" : 3, + "centerStart" : 3, + "centerAlong" : 3, + "centerEnd" : 3, + "belowStart" : 3, + "belowAlong" : 3, + "belowEnd" : 3 + }, + "pointPlacementMethod" : "AroundPoint", + "pointPlacementPriorities" : { + "type" : "CIMStandardPointPlacementPriorities", + "aboveLeft" : 2, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerLeft" : 3, + "centerRight" : 2, + "belowLeft" : 3, + "belowCenter" : 3, + "belowRight" : 2 + }, + "rotationType" : "Arithmetic", + "polygonPlacementMethod" : "AlwaysHorizontal" + }, "textSymbol" : { "type" : "CIMSymbolReference", "symbol" : { "type" : "CIMTextSymbol", "blockProgression" : "TTB", - "compatibilityMode" : true, "depth3D" : 1, - "drawSoftHyphen" : true, "extrapolateBaselines" : true, - "flipAngle" : 90, "fontEffects" : "Normal", "fontEncoding" : "Unicode", - "fontFamilyName" : "Arial", - "fontStyleName" : "Bold", + "fontFamilyName" : "Tahoma", + "fontStyleName" : "Regular", "fontType" : "Unspecified", "haloSize" : 1, - "height" : 14, + "height" : 10, "hinting" : "Default", "horizontalAlignment" : "Left", "kerning" : true, "letterWidth" : 100, - "ligatures" : false, + "ligatures" : true, "lineGapType" : "ExtraLeading", - "shadowColor" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - }, "symbol" : { "type" : "CIMPolygonSymbol", "symbolLayers" : [ { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] } } ] }, "textCase" : "Normal", "textDirection" : "LTR", - "verticalAlignment" : "Baseline", + "verticalAlignment" : "Bottom", "verticalGlyphOrientation" : "Right", "wordSpacing" : 100, "billboardMode3D" : "FaceNearPlane" - }, - "symbolName" : "Symbol_163" + } }, "useCodedValue" : true, - "visibility" : true + "visibility" : true, + "iD" : -1 } ], - "labelVisibility" : true, "renderer" : { "type" : "CIMClassBreaksRenderer", "barrierWeight" : "None", "breaks" : [ { "type" : "CIMClassBreak", - "label" : "\u003e 9", + "label" : "\u2264-31.7%", "patch" : "Default", "symbol" : { "type" : "CIMSymbolReference", @@ -290,7 +276,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -307,31 +292,27 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 214, - 62, - 71, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 89, + 133, + 192, + 100 + ] } } ] }, "symbolName" : "Symbol_158" }, - "upperBound" : 8.5922139766756906 + "upperBound" : -31.704826782833365 }, { "type" : "CIMClassBreak", - "label" : "10 - 39", + "label" : "\u2264-2.7%", "patch" : "Default", "symbol" : { "type" : "CIMSymbolReference", @@ -341,7 +322,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -358,82 +338,27 @@ } }, { - "type" : "CIMFill", - "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 199, - 14, - 74, - 100 - ] - } - } - } - ] - }, - "symbolName" : "Symbol_159" - }, - "upperBound" : 39.086293547780784 - }, - { - "type" : "CIMClassBreak", - "label" : "40 - 70", - "patch" : "Default", - "symbol" : { - "type" : "CIMSymbolReference", - "symbol" : { - "type" : "CIMPolygonSymbol", - "symbolLayers" : [ - { - "type" : "CIMSolidStroke", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "capStyle" : "Round", - "joinStyle" : "Round", - "lineStyle3D" : "Strip", - "miterLimit" : 10, - "width" : 0.40000000000000002, "color" : { "type" : "CIMRGBColor", "values" : [ - 110, - 110, - 110, + 201, + 214, + 202, 100 ] } - }, - { - "type" : "CIMFill", - "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 60, - 25, - 100, - 100 - ] - } - } } ] }, - "symbolName" : "Symbol_160" + "symbolName" : "Symbol_158" }, - "upperBound" : 69.580373118885873 + "upperBound" : -2.6951732171666407 }, { "type" : "CIMClassBreak", - "label" : "71 -100", + "label" : "\u2264+26.3%", "patch" : "Default", "symbol" : { "type" : "CIMSymbolReference", @@ -443,7 +368,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -460,31 +384,27 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 20, - 57, - 96, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 249, + 197, + 148, + 100 + ] } } ] }, - "symbolName" : "Symbol_161" + "symbolName" : "Symbol_158" }, - "upperBound" : 100.07445268999096 + "upperBound" : 26.314480348500084 }, { "type" : "CIMClassBreak", - "label" : "\u003e 101", + "label" : "\u2264+53%", "patch" : "Default", "symbol" : { "type" : "CIMSymbolReference", @@ -494,7 +414,6 @@ { "type" : "CIMSolidStroke", "enable" : true, - "colorLocked" : false, "capStyle" : "Round", "joinStyle" : "Round", "lineStyle3D" : "Strip", @@ -511,27 +430,23 @@ } }, { - "type" : "CIMFill", + "type" : "CIMSolidFill", "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMHSVColor", - "values" : [ - 3, - 82, - 84, - 100 - ] - } + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 225, + 61, + 40, + 100 + ] } } ] }, - "symbolName" : "Symbol_162" + "symbolName" : "Symbol_158" }, - "upperBound" : 104 + "upperBound" : 53 } ], "classBreakType" : "GraduatedColor", @@ -596,19 +511,59 @@ ] }, "field" : "PercentChange", - "minimumBreak" : 4, + "minimumBreak" : -41, "numberFormat" : { - "type" : "CIMNumericFormat", + "type" : "CIMPercentageFormat", "alignmentOption" : "esriAlignLeft", "alignmentWidth" : 12, - "roundingOption" : "esriRoundNumberOfSignificantDigits", - "roundingValue" : 2, - "zeroPad" : true + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 1, + "showPlusSign" : true }, "showInAscendingOrder" : true, + "heading" : "Percent Change", "sampleSize" : 10000, + "defaultSymbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidStroke", + "enable" : true, + "capStyle" : "Round", + "joinStyle" : "Round", + "lineStyle3D" : "Strip", + "miterLimit" : 10, + "width" : 0.69999999999999996, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 110, + 110, + 110, + 100 + ] + } + }, + { + "type" : "CIMSolidFill", + "enable" : true, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 130, + 130, + 130, + 100 + ] + } + } + ] + } + }, + "defaultLabel" : "", "useExclusionSymbol" : false, - "normalizationTotal" : 1, "normalizationType" : "Nothing" }, "scaleSymbols" : true, @@ -621,7 +576,8 @@ "elevationMode" : "BaseGlobeSurface", "name" : "Ground", "verticalExaggeration" : 1, - "mapElevationID" : "{38810DDC-F9AB-41DD-97A1-5D3379658BB2}" + "mapElevationID" : "53006ba2e94a468eb67bdaf44815bf87", + "surfaceTINShadingMode" : "Smooth" } ] } \ No newline at end of file diff --git a/patterns/toolboxes/layers/TableToPoint.lyr b/patterns/toolboxes/layers/TableToPoint.lyr deleted file mode 100644 index ae52db53..00000000 Binary files a/patterns/toolboxes/layers/TableToPoint.lyr and /dev/null differ diff --git a/patterns/toolboxes/layers/TableToPoint.lyrx b/patterns/toolboxes/layers/TableToPoint.lyrx deleted file mode 100644 index 18d7bae4..00000000 --- a/patterns/toolboxes/layers/TableToPoint.lyrx +++ /dev/null @@ -1,427 +0,0 @@ -{ - "type" : "CIMLayerDocument", - "version" : "1.0.0", - "layers" : [ - "CIMPATH=gp_arcpy_map/tabletopoint.xml" - ], - "layerDefinitions" : [ - { - "type" : "CIMFeatureLayer", - "name" : "TableToPoint", - "uRI" : "CIMPATH=gp_arcpy_map/tabletopoint.xml", - "sourceModifiedTime" : { - "type" : "TimeInstant" - }, - "description" : "Point location features generated from tabular data.", - "layerElevation" : { - "type" : "CIMLayerElevationSurface", - "mapElevationID" : "{AA5336C3-5A42-4D5F-A3DF-0976C0AE3E0C}" - }, - "layerType" : "Operational", - "showLegends" : true, - "visibility" : true, - "displayCacheType" : "Permanent", - "maxDisplayCacheAge" : 5, - "showPopups" : true, - "autoGenerateFeatureTemplates" : true, - "featureTable" : { - "type" : "CIMFeatureTable", - "displayField" : "DDLat", - "editable" : true, - "timeFields" : { - "type" : "CIMTimeTableDefinition" - }, - "timeDefinition" : { - "type" : "CIMTimeDataDefinition" - }, - "timeDisplayDefinition" : { - "type" : "CIMTimeDisplayDefinition", - "timeInterval" : 0, - "timeIntervalUnits" : "esriTimeUnitsHours", - "timeOffsetUnits" : "esriTimeUnitsYears" - }, - "dataConnection" : { - "type" : "CIMStandardDataConnection", - "workspaceConnectionString" : "DATABASE=.\\PosA_output.gdb", - "workspaceFactory" : "FileGDB", - "dataset" : "TableToPoint", - "datasetType" : "esriDTFeatureClass" - }, - "studyAreaSpatialRel" : "esriSpatialRelUndefined", - "searchOrder" : "esriSearchOrderSpatial" - }, - "htmlPopupEnabled" : true, - "htmlPopupFormat" : { - "type" : "CIMHtmlPopupFormat", - "htmlXSLStyleSheet" : "\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\"\u003e\n \u003cxsl:output method=\"html\" version=\"1.0\" encoding=\"UTF-8\" indent=\"yes\" /\u003e\n \u003cxsl:variable name=\"ignoreFieldNames\" select=\"'|OBJECTID|Shape|Shape_Length|Shape_Area|ATTACHMENTID|REL_OBJECTID|CONTENT_TYPE|ATT_NAME|DATA_SIZE|DATA|'\" /\u003e\n \u003cxsl:variable name=\"headerRowColor\" select=\"'#EAEFEB'\" /\u003e\n \u003cxsl:variable name=\"alternateRowColor\" select=\"'#EEEEEE'\" /\u003e\n \u003cxsl:variable name=\"AlertRowColor\" select=\"'#FFFF66'\" /\u003e\n \u003cxsl:template match=\"/\"\u003e\n \u003chtml\u003e\n \u003cbody style=\"margin:0px 0px 0px 0px;overflow:auto;background:#CCCCCC;\"\u003e\n \u003ctable style=\"font-family:Arial,Verdana,Times;font-size:10px;text-align:left;width:100%;border-collapse:collapse;padding:3px 3px 3px 3px\"\u003e\n \u003c!--\u003ctr style=\"text-align:center;font-weight:bold;background:{$headerRowColor}\"\u003e--\u003e\n \u003c!-- \u003ctd\u003e--\u003e\n \u003c!-- \u003cxsl:value-of select=\"FieldsDoc/Title\" /\u003e--\u003e\n \u003c!-- \u003c/td\u003e--\u003e\n \u003c!--\u003c/tr\u003e--\u003e\n \u003cxsl:apply-templates select=\"FieldsDoc/Attachments\" /\u003e\n \u003ctr\u003e\n \u003ctd\u003e\n \u003ctable style=\"font-family:Arial,Verdana,Times;font-size:10px;text-align:left;width:100%;border-spacing:0px; padding:3px 3px 3px 3px\"\u003e\n \u003cxsl:apply-templates select=\"FieldsDoc/Fields/Field[not(contains($ignoreFieldNames, concat(concat('|', FieldName), '|'))) and not(FieldValue = '<Null>')]\" /\u003e\n \u003c/table\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/table\u003e\n \u003c/body\u003e\n \u003c/html\u003e\n \u003c/xsl:template\u003e\n \u003cxsl:template match=\"Attachments\"\u003e\n \u003cxsl:variable name=\"imageCount\" select=\"count(Attachment/ContentType[contains(., 'image')])\" /\u003e\n \u003cxsl:variable name=\"attachmentCount\" select=\"count(Attachment)\" /\u003e\n \u003ctr bgcolor=\"{$headerRowColor}\"\u003e\n \u003ctd\u003e\n \u003ctable style=\"font-family:Arial,Verdana,Times;font-size:10px;text-align:left;width:100%;border-spacing:0px; padding:3px 3px 3px 3px\"\u003e\n \u003cxsl:variable name=\"imageSrc\" select=\"Attachment/ContentType[contains(., 'image')]/../FilePath\" /\u003e\n \u003cxsl:if test=\"$imageSrc\"\u003e\n \u003ctr align=\"center\"\u003e\n \u003ctd\u003e\n \u003ca target=\"_blank\" href=\"{$imageSrc}\"\u003e\n \u003cimg src=\"{$imageSrc}\" width=\"275px\" border=\"0\" /\u003e\n \u003c/a\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr align=\"center\"\u003e\n \u003ctd\u003e\n \u003cxsl:value-of select=\"Attachment/ContentType[contains(., 'image')]/../Name\" /\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/xsl:if\u003e\n \u003cxsl:if test=\"($attachmentCount > $imageCount) or not($imageCount = 1)\"\u003e\n \u003ctr align=\"center\"\u003e\n \u003ctd\u003e\n \u003ctable style=\"font-family:Arial,Verdana,Times;font-size:10px;text-align:left;width:100%;border-spacing:0px; padding:3px 3px 3px 3px\"\u003e\n \u003cxsl:for-each select=\"Attachment[position() mod 2 = 1]\"\u003e\n \u003ctr align=\"left\" bgcolor=\"white\"\u003e\n \u003cxsl:if test=\"(position() +1) mod 2\"\u003e\n \u003cxsl:attribute name=\"bgcolor\"\u003e\n \u003cxsl:value-of select=\"$alternateRowColor\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003c/xsl:if\u003e\n \u003ctd\u003e\n \u003ca target=\"_blank\"\u003e\n \u003cxsl:attribute name=\"href\"\u003e\n \u003cxsl:value-of select=\"FilePath\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003cxsl:value-of select=\"Name\" /\u003e\n \u003c/a\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n \u003ca target=\"_blank\"\u003e\n \u003cxsl:attribute name=\"href\"\u003e\n \u003cxsl:value-of select=\"following-sibling::Attachment/FilePath\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003cxsl:value-of select=\"following-sibling::Attachment/Name\" /\u003e\n \u003c/a\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/xsl:for-each\u003e\n \u003c/table\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/xsl:if\u003e\n \u003c/table\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/xsl:template\u003e\n \u003cxsl:template match=\"Field\"\u003e\n \u003ctr\u003e\n \u003cxsl:if test=\"(position() +1) mod 2\"\u003e\n \u003cxsl:attribute name=\"bgcolor\"\u003e\n \u003cxsl:value-of select=\"$alternateRowColor\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003c/xsl:if\u003e\n \u003cxsl:if test=\"FieldValue[contains(.,'Immediate') or contains(.,'gasoline')]\"\u003e\n \u003cxsl:attribute name=\"bgcolor\"\u003e\n \u003cxsl:value-of select=\"$AlertRowColor\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003c/xsl:if\u003e\n \u003ctd\u003e\n \u003cxsl:value-of select=\"FieldName\" /\u003e\n \u003c/td\u003e\n \u003ctd\u003e\n \u003cxsl:choose\u003e\n \u003cxsl:when test=\"FieldValue[starts-with(., 'www.')]\"\u003e\n \u003ca target=\"_blank\"\u003e\n \u003cxsl:attribute name=\"href\"\u003ehttp://\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\u003c/xsl:attribute\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/a\u003e\n \u003c/xsl:when\u003e\n \u003cxsl:when test=\"FieldValue[starts-with(., 'http:')]\"\u003e\n \u003ca target=\"_blank\"\u003e\n \u003cxsl:attribute name=\"href\"\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/a\u003e\n \u003c/xsl:when\u003e\n \u003cxsl:when test=\"FieldValue[starts-with(., 'https:')]\"\u003e\n \u003ca target=\"_blank\"\u003e\n \u003cxsl:attribute name=\"href\"\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/a\u003e\n \u003c/xsl:when\u003e\n \u003cxsl:when test=\"FieldValue[starts-with(., '\\\\')]\"\u003e\n \u003ca target=\"_blank\"\u003e\n \u003cxsl:attribute name=\"href\"\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/xsl:attribute\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/a\u003e\n \u003c/xsl:when\u003e\n \u003cxsl:when test=\"FieldValue[starts-with(., '<img ')]\"\u003e\n \u003cxsl:value-of select=\"FieldValue\" disable-output-escaping=\"yes\" /\u003e\n \u003c/xsl:when\u003e\n \u003cxsl:otherwise\u003e\n \u003cxsl:value-of select=\"FieldValue\" /\u003e\n \u003c/xsl:otherwise\u003e\n \u003c/xsl:choose\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/xsl:template\u003e\n\u003c/xsl:stylesheet\u003e\n", - "htmlUseCodedDomainValues" : true, - "htmlPresentationStyle" : "XSLStyleSheet" - }, - "isFlattened" : true, - "selectable" : true, - "selectionSymbol" : { - "type" : "CIMSymbolReference", - "symbol" : { - "type" : "CIMPointSymbol", - "symbolLayers" : [ - { - "type" : "CIMVectorMarker", - "enable" : true, - "colorLocked" : false, - "anchorPointUnits" : "Relative", - "dominantSizeAxis3D" : "Z", - "size" : 8, - "billboardMode3D" : "FaceNearPlane", - "frame" : { - "xmin" : -2, - "ymin" : -2, - "xmax" : 2, - "ymax" : 2 - }, - "markerGraphics" : [ - { - "type" : "CIMMarkerGraphic", - "geometry" : { - "curveRings" : [ - [ - [ - 1.2246467991473532e-016, - 2 - ], - { - "a" : [ - [ - 1.2246467991473532e-016, - 2 - ], - [ - 0, - 0 - ], - 0, - 1 - ] - } - ] - ] - }, - "symbol" : { - "type" : "CIMPolygonSymbol", - "symbolLayers" : [ - { - "type" : "CIMFill", - "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 255, - 255, - 100 - ] - } - } - } - ] - } - } - ] - } - ], - "haloSize" : 1, - "scaleX" : 1 - }, - "symbolName" : "Symbol_167" - }, - "exclusionSet" : { - }, - "labelClasses" : [ - { - "type" : "CIMLabelClass", - "expression" : "[Id]", - "expressionEngine" : "VBScript", - "featuresToLabel" : "AllVisibleFeatures", - "maplexLabelPlacementProperties" : { - "type" : "CIMMaplexLabelPlacementProperties", - "featureType" : "Point", - "avoidPolygonHoles" : true, - "canOverrunFeature" : true, - "canPlaceLabelOutsidePolygon" : true, - "canRemoveOverlappingLabel" : true, - "canStackLabel" : true, - "connectionType" : "Unambiguous", - "constrainOffset" : "NoConstraint", - "contourAlignmentType" : "Page", - "contourLadderType" : "Straight", - "contourMaximumAngle" : 90, - "enableConnection" : true, - "enablePointPlacementPriorities" : true, - "featureWeight" : 0, - "fontHeightReductionLimit" : 4, - "fontHeightReductionStep" : 0.5, - "fontWidthReductionLimit" : 90, - "fontWidthReductionStep" : 5, - "graticuleAlignmentType" : "Straight", - "keyNumberGroupName" : "Default", - "labelBuffer" : 15, - "labelLargestPolygon" : true, - "labelPriority" : -1, - "labelStackingProperties" : { - "type" : "CIMMaplexLabelStackingProperties", - "stackAlignment" : "ChooseBest", - "maximumNumberOfLines" : 3, - "minimumNumberOfCharsPerLine" : 3, - "maximumNumberOfCharsPerLine" : 24, - "separators" : [ - { - "type" : "CIMMaplexStackingSeparator", - "separator" : " ", - "splitAfter" : true - }, - { - "type" : "CIMMaplexStackingSeparator", - "separator" : ",", - "visible" : true, - "splitAfter" : true - } - ] - }, - "lineFeatureType" : "General", - "linePlacementMethod" : "OffsetCurvedFromLine", - "maximumLabelOverrun" : 36, - "maximumLabelOverrunUnit" : "Point", - "minimumFeatureSizeUnit" : "Map", - "multiPartOption" : "OneLabelPerPart", - "offsetAlongLineProperties" : { - "type" : "CIMMaplexOffsetAlongLineProperties", - "placementMethod" : "BestPositionAlongLine", - "labelAnchorPoint" : "CenterOfLabel", - "distanceUnit" : "Percentage", - "useLineDirection" : true - }, - "pointExternalZonePriorities" : { - "type" : "CIMMaplexExternalZonePriorities", - "aboveLeft" : 4, - "aboveCenter" : 2, - "aboveRight" : 1, - "centerRight" : 3, - "belowRight" : 5, - "belowCenter" : 7, - "belowLeft" : 8, - "centerLeft" : 6 - }, - "pointPlacementMethod" : "AroundPoint", - "polygonAnchorPointType" : "GeometricCenter", - "polygonBoundaryWeight" : 0, - "polygonExternalZones" : { - "type" : "CIMMaplexExternalZonePriorities", - "aboveLeft" : 4, - "aboveCenter" : 2, - "aboveRight" : 1, - "centerRight" : 3, - "belowRight" : 5, - "belowCenter" : 7, - "belowLeft" : 8, - "centerLeft" : 6 - }, - "polygonFeatureType" : "General", - "polygonInternalZones" : { - "type" : "CIMMaplexInternalZonePriorities", - "center" : 1 - }, - "polygonPlacementMethod" : "CurvedInPolygon", - "primaryOffset" : 1, - "primaryOffsetUnit" : "Point", - "removeExtraWhiteSpace" : true, - "repetitionIntervalUnit" : "Map", - "rotationProperties" : { - "type" : "CIMMaplexRotationProperties", - "rotationType" : "Arithmetic", - "alignmentType" : "Straight" - }, - "secondaryOffset" : 100, - "strategyPriorities" : { - "type" : "CIMMaplexStrategyPriorities", - "stacking" : 1, - "overrun" : 2, - "fontCompression" : 3, - "fontReduction" : 4, - "abbreviation" : 5 - }, - "thinDuplicateLabels" : true, - "thinningDistanceUnit" : "Map", - "truncationMarkerCharacter" : ".", - "truncationMinimumLength" : 1, - "truncationPreferredCharacters" : "aeiou" - }, - "name" : "Default", - "priority" : 2, - "textSymbol" : { - "type" : "CIMSymbolReference", - "symbol" : { - "type" : "CIMTextSymbol", - "blockProgression" : "TTB", - "compatibilityMode" : true, - "depth3D" : 1, - "drawSoftHyphen" : true, - "extrapolateBaselines" : true, - "flipAngle" : 90, - "fontEffects" : "Normal", - "fontEncoding" : "Unicode", - "fontFamilyName" : "Garamond", - "fontStyleName" : "Italic", - "fontType" : "Unspecified", - "haloSize" : 1, - "height" : 11, - "hinting" : "Default", - "horizontalAlignment" : "Left", - "kerning" : true, - "letterWidth" : 100, - "ligatures" : false, - "lineGapType" : "ExtraLeading", - "shadowColor" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - }, - "symbol" : { - "type" : "CIMPolygonSymbol", - "symbolLayers" : [ - { - "type" : "CIMFill", - "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 0, - 0, - 100 - ] - } - } - } - ] - }, - "textCase" : "Normal", - "textDirection" : "LTR", - "verticalAlignment" : "Baseline", - "verticalGlyphOrientation" : "Right", - "wordSpacing" : 100, - "billboardMode3D" : "FaceNearPlane" - }, - "symbolName" : "Symbol_166" - }, - "useCodedValue" : true, - "visibility" : true - } - ], - "renderer" : { - "type" : "CIMSimpleRenderer", - "patch" : "Default", - "symbol" : { - "type" : "CIMSymbolReference", - "symbol" : { - "type" : "CIMPointSymbol", - "symbolLayers" : [ - { - "type" : "CIMCharacterMarker", - "enable" : true, - "colorLocked" : false, - "anchorPointUnits" : "Relative", - "dominantSizeAxis3D" : "Y", - "size" : 12, - "billboardMode3D" : "FaceNearPlane", - "characterIndex" : 33, - "fontFamilyName" : "ESRI Default Marker", - "fontStyleName" : "Regular", - "scaleX" : 1, - "symbol" : { - "type" : "CIMPolygonSymbol", - "symbolLayers" : [ - { - "type" : "CIMFill", - "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 0, - 168, - 132, - 100 - ] - } - } - } - ] - } - }, - { - "type" : "CIMCharacterMarker", - "enable" : true, - "colorLocked" : true, - "anchorPointUnits" : "Relative", - "dominantSizeAxis3D" : "Y", - "size" : 14, - "billboardMode3D" : "FaceNearPlane", - "characterIndex" : 33, - "fontFamilyName" : "ESRI Default Marker", - "fontStyleName" : "Regular", - "scaleX" : 1, - "symbol" : { - "type" : "CIMPolygonSymbol", - "symbolLayers" : [ - { - "type" : "CIMFill", - "enable" : true, - "colorLocked" : false, - "pattern" : { - "type" : "CIMSolidPattern", - "color" : { - "type" : "CIMRGBColor", - "values" : [ - 255, - 255, - 255, - 100 - ] - } - } - } - ] - } - } - ], - "haloSize" : 1, - "scaleX" : 1 - }, - "symbolName" : "Symbol_165" - } - }, - "scaleSymbols" : true, - "snappable" : true - } - ], - "elevationSurfaces" : [ - { - "type" : "CIMMapElevationSurface", - "elevationMode" : "BaseGlobeSurface", - "name" : "Ground", - "verticalExaggeration" : 1, - "mapElevationID" : "{AA5336C3-5A42-4D5F-A3DF-0976C0AE3E0C}" - } - ] -} \ No newline at end of file diff --git a/patterns/toolboxes/scripts/AddUniqueRowID.py b/patterns/toolboxes/scripts/AddUniqueRowID.py deleted file mode 100644 index 0175bd5a..00000000 --- a/patterns/toolboxes/scripts/AddUniqueRowID.py +++ /dev/null @@ -1,69 +0,0 @@ - -# ================================================== -# AddUniqueRowID.py -# -------------------------------------------------- -# Built for ArcGIS 10.1 -# -------------------------------------------------- -# Adds a new field of unique row numbers to a table -# ================================================== - -# IMPORTS ========================================== -import os, sys, traceback -import arcpy -from arcpy import da - -# ARGUMENTS ======================================== -dataset = arcpy.GetParameterAsText(0) -fieldName = arcpy.GetParameterAsText(1) - -# LOCALS =========================================== -counter = 1 - -# ================================================== -try: - - # add unique ID field - arcpy.AddMessage("Adding field " + str(fieldName)) - arcpy.AddField_management(dataset,fieldName,"LONG") - - # add unique numbers to each row - fields = [str(fieldName)] - arcpy.AddMessage("Adding unique row IDs") - rows = arcpy.da.UpdateCursor(dataset,fields) - for row in rows: - row[0] = counter - rows.updateRow(row) - counter += 1 - del rows - - # set output - arcpy.SetParameter(0,dataset) - - -except arcpy.ExecuteError: - error = True - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - #print msgs #UPDATE - print(msgs) - -except: - # Get the traceback object - error = True - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - #print pymsg + "\n" #UPDATE - print((pymsg + "\n")) - #print msgs #UPDATE - print(msgs) \ No newline at end of file diff --git a/patterns/toolboxes/scripts/ConvertCoordinates.py b/patterns/toolboxes/scripts/ConvertCoordinates.py deleted file mode 100644 index 52b27db9..00000000 --- a/patterns/toolboxes/scripts/ConvertCoordinates.py +++ /dev/null @@ -1,123 +0,0 @@ - -# ================================================== -# ConvertCoordinates.py -# -------------------------------------------------- -# Built for ArcGIS 10.1 -# -------------------------------------------------- -# Converts input coordinates to DD, DMS, DDM, UTM, MGRS, USNG, GARS, GeoRef -# ================================================== - -# IMPORTS ========================================== -import sys, os, traceback -import arcpy -from arcpy import env - -# ARGUMENTS ======================================== -scriptpath = sys.path[0] -Input_Table = arcpy.GetParameterAsText(0) -Input_Coordinate_Format = arcpy.GetParameterAsText(1) -X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_ = arcpy.GetParameterAsText(2) -Y_Field__Latitude_ = arcpy.GetParameterAsText(3) -Output_Table = arcpy.GetParameterAsText(4) -Spatial_Reference = arcpy.GetParameterAsText(5) - -# LOCALS =========================================== -delete_me = [] - -# ================================================== -try: - # Load required toolboxes - toolboxpath = os.path.join(scriptpath,"..\\Position Analysis Tools.tbx") - arcpy.ImportToolbox(toolboxpath) #("C:\\Work\\TOS\\Intel\\Toolbox.tbx") - - # set environment - currentOverwriteOutput = env.overwriteOutput - env.overwriteOutput = True - scratchWS = env.scratchWorkspace - scratchTable = os.path.join(scratchWS,"cc_temp") - delete_me.append(scratchTable) - - # Process: Copy Rows - arcpy.CopyRows_management(Input_Table, Output_Table, "") - - # Process: Add Unique Row ID - arcpy.gp.AddUniqueRowID(Output_Table, "JoinID") - - # Process: Convert Coordinate Notation (GARS) - arcpy.AddMessage("Converting & appending GARS ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "GARS", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "GARS") - - # Process: Convert Coordinate Notation (DD) - arcpy.AddMessage("Converting & appending Decimal Degrees ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "DD_2", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "DDLat;DDLon") - - # Process: Convert Coordinate Notation (DDM) - arcpy.AddMessage("Converting & appending Degrees Decimal Minutes ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "DDM_2", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "DDMLat;DDMLon") - - # Process: Convert Coordinate Notation (DMS) - arcpy.AddMessage("Converting & appending Degrees Minutes Seconds ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "DMS_2", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "DMSLat;DMSLon") - - # Process: Convert Coordinate Notation (UTM) - arcpy.AddMessage("Converting & appending UTM ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "UTM", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "UTM") - - # Process: Convert Coordinate Notation (MGRS) - arcpy.AddMessage("Converting & appending MGRS ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "MGRS", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "MGRS") - - # Process: Convert Coordinate Notation (USNG) - arcpy.AddMessage("Converting & appending USNG ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "USNG", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "USNG") - - # Process: Convert Coordinate Notation (GeoRef) - arcpy.AddMessage("Converting & appending GeoRef ...") - arcpy.ConvertCoordinateNotation_management(Output_Table, scratchTable, X_Field__Longitude__UTM__MGRS__USNG__GARS__GeoRef_, Y_Field__Latitude_, Input_Coordinate_Format, "GEOREF", "JoinID", Spatial_Reference) - arcpy.JoinField_management(Output_Table, "JoinID", scratchTable, "JoinID", "GEOREF") - - # cleanup - arcpy.AddMessage("Removing scratch datasets:") - for ds in delete_me: - arcpy.AddMessage(str(ds)) - if arcpy.Exists(ds): - arcpy.Delete_management(ds) - - arcpy.SetParameter(0,Output_Table) - - - -except arcpy.ExecuteError: - error = True - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - #print msgs #UPDATE - print(msgs) - -except: - # Get the traceback object - error = True - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - #print pymsg + "\n" #UPDATE - print((pymsg + "\n")) - #print msgs #UPDATE - print(msgs) diff --git a/run_all_tests.xml b/run_all_tests.xml deleted file mode 100644 index 7f1ff030..00000000 --- a/run_all_tests.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/solutions-geoprocessing-toolbox-thumbnail007.png b/solutions-geoprocessing-toolbox-thumbnail007.png deleted file mode 100644 index 0603b057..00000000 Binary files a/solutions-geoprocessing-toolbox-thumbnail007.png and /dev/null differ diff --git a/suitability/README.md b/suitability/README.md index 56bf4fa7..bb85b1ce 100644 --- a/suitability/README.md +++ b/suitability/README.md @@ -18,6 +18,7 @@ Determine areas most suitable for both friendly and adversarial operations. Tools included in this toolbox help analysts understand threats against operations in the maritime domain. Some of these geoprocessing tools help analysts understand the capabilities of submarines, such as where submarines can physically operate and areas where they have an advantage (such as in canyons). Other tools are more general in nature and can be used for understanding where a vessel can travel in an amount of time, as well as how far a vessel can see based off of height of the viewer. * Farthest On Circle +* Farthest On Circle with Depth Limits * Find Submarine Canyons * Sub Depth Restriction Analysis * Sub Specifications Tool @@ -26,6 +27,7 @@ Tools included in this toolbox help analysts understand threats against operatio ## Military Aspects Of Terrain Tools Contains tools used in the Military Aspects Of Terrain (MAoT) template. They are tools for doing terrain analysis as part of the Intelligence Preparation of the Battlefield process. +Supports the [Military Aspects of Terrain](http://solutions.arcgis.com/defense/templates/maot/) template. * Cover and Concealment * Concealment from Aerial Detection @@ -50,7 +52,8 @@ These tools are part of the [Military Aspects of Terrain template](http://www.ar ## Military Aspects of Weather Tools -Tools for describing and importing weather data in GRIB and NetCDF format. +Tools for describing and importing weather data in CRU CL2.0 and NetCDF format. +Supports the [Miltiary Aspects of Weather](http://solutions.arcgis.com/defense/templates/maow/) template. * Import CRU Data * Import CRU CL2.0 To Raster diff --git a/suitability/test/build.xml b/suitability/test/build.xml deleted file mode 100644 index c1a429db..00000000 --- a/suitability/test/build.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/suitability/test/test_maot/.project b/suitability/test/test_maot/.project deleted file mode 100644 index 9ebadc0e..00000000 --- a/suitability/test/test_maot/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - TestMAoT - - - - - - org.python.pydev.PyDevBuilder - - - - - - org.python.pydev.pythonNature - - diff --git a/suitability/test/test_maot/.pydevproject b/suitability/test/test_maot/.pydevproject deleted file mode 100644 index 0ead444e..00000000 --- a/suitability/test/test_maot/.pydevproject +++ /dev/null @@ -1,8 +0,0 @@ - - - -/TestMAoT - -python 2.7 -Default - diff --git a/suitability/test/test_maot/TestModelLocalPeaks.py b/suitability/test/test_maot/TestModelLocalPeaks.py deleted file mode 100644 index 3cf2c31a..00000000 --- a/suitability/test/test_maot/TestModelLocalPeaks.py +++ /dev/null @@ -1,194 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelLocalPeaks.py -# Description: Automatic Test of Local Peaks Model -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback -import TestUtilities - -def CellSize(fc): - ''' get 2000th of the larger of height or width of extent''' - cs = None - mx = max(arcpy.Describe(fc).extent.height,arcpy.Describe(fc).extent.width) - cs = mx/2000.0 - return cs - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: TestLocalPeaks") - - #TEST_IMPLEMENTED = False - # - #if not TEST_IMPLEMENTED : - # arcpy.AddWarning("***Test Not Yet Implemented***") - # return - - # TODO: once model has a version that works with local surface data - # (rather than image service), then finish this test/implementation below - # - # alternately you can add an image service connection in Catalog and - # fill in the parameter below - - if arcpy.CheckExtension("Spatial") == "Available": - print("Checking out Spatial Analyst license...") - arcpy.CheckOutExtension("Spatial") - else: - # Raise a custom exception - raise Exception("LicenseError") - - if arcpy.CheckExtension("3D") == "Available": - print("Checking out 3D Analyst license...") - arcpy.CheckOutExtension("3D") - else: - raise Exception("LicenseError") - - try: - print("Getting Advanced license...") - import arcinfo - except ImportError: - print("Could not use ArcGIS Advanced license...") - raise Exception - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - # Getting inputs - print("Getting inputs...") - print("inputPolygonFC...") - inputPolygonFC = os.path.join(TestUtilities.inputGDB, "samplePolygonArea") - print("inputSurface...") - inputSurface = TestUtilities.inputElevationURL - print("outputPointsFC") - outputPointsFC = os.path.join(TestUtilities.outputGDB, "LocalPeaks") - print("ImportToolbox--MAoT...") - arcpy.ImportToolbox(TestUtilities.toolbox, "MAoT") - - # mf - these have been tested - # # Check For Valid Input - # print("Checking valid inputs...") - # objects2Check = [] - # #objects2Check.extend([inputPolygonFC, inputSurface, toolbox]) - # objects2Check.extend([inputPolygonFC, toolbox]) - # for object2Check in objects2Check : - # desc = arcpy.Describe(object2Check) - # if desc == None : - # raise Exception("Bad Input") - # else : - # print("Valid Object: " + desc.Name) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - inputFeatureCount = int(arcpy.GetCount_management(inputPolygonFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPolygonFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - # if (inputFeatureCount < 1): - # print("Invalid Input Polygon Feature Count: " + str(inputFeatureCount)) - - # Convert input elevation service to local dataset surface - print("Converting input image service into a local raster surface") - polygonExtent = arcpy.Describe(inputPolygonFC).extent - print("Using extent: " + str(polygonExtent)) - cellSize = CellSize(inputPolygonFC) - print("Using cell size: " + str(cellSize)) - localSurf = None - srWGS84 = arcpy.SpatialReference(4326) # GCS_WGS_1984 - srWebMerc = arcpy.SpatialReference(3857) #Web_Mercator_Auxiliary_Sphere - print("Reworking inputs from image service...") - try: - tempClipExtent = os.path.join(TestUtilities.scratchGDB,"tempClipExtent") - localSurf = os.path.join(TestUtilities.scratchGDB,"localSurf") - print(" projecting input clip to WGS 1984 to match service...") - arcpy.Project_management(inputPolygonFC,tempClipExtent,srWGS84) - tempCellSize = CellSize(tempClipExtent) - #MakeImageServerLayer_management (in_image_service, out_imageserver_layer, {template}, - #{band_index}, {mosaic_method}, {order_field}, - #{order_base_value}, {lock_rasterid}, {cell_size}, - #{where_clause}, {processing_template}) - print(" getting image service layer with cell size " + str(tempCellSize) + "...") - arcpy.MakeImageServerLayer_management(inputSurface, "inputSurface", tempClipExtent, - "#", "#", "#", - "#", "#", tempCellSize) - print(" projecting image service layer to match target data...") - arcpy.ProjectRaster_management("inputSurface",localSurf,srWebMerc) - #arcpy.CopyRaster_management("inputSurface", localSurf) - except arcpy.ExecuteError: - print("Error converting image service...") - msgs = arcpy.GetMessages() - print(msgs) - sys.exit(-1) - - numberOfPeaks = 3 - - ######################################################## - # Execute the Model under test: - arcpy.FindLocalPeaks_MAoT(inputPolygonFC, numberOfPeaks, localSurf, outputPointsFC) - ######################################################## - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputPointsFC < 3): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - finally: - # Check in the 3D Analyst extension - arcpy.CheckInExtension("Spatial") - arcpy.CheckInExtension("3D") - # if arcpy.Exists(localSurf): - # arcpy.Delete_management(localSurf) - - -RunTest() diff --git a/suitability/test/test_maot/TestRangeFan.py b/suitability/test/test_maot/TestRangeFan.py deleted file mode 100644 index 9ce12316..00000000 --- a/suitability/test/test_maot/TestRangeFan.py +++ /dev/null @@ -1,125 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelLocalPeaks.py -# Description: Automatic Test of Local Peaks Model -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: RangeFan") - - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - # Raise a custom exception - raise Exception("LicenseError") - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - # Verify the expected configuration exists - inputPointsFC = os.path.join(TestUtilities.inputGDB, "sampleRangePoints") - outputRangeFansFC = os.path.join(TestUtilities.outputGDB, "RangeFans") - toolbox = TestUtilities.toolbox - - arcpy.ImportToolbox(toolbox, "MAoT") - - # Check For Valid Input - objects2Check = [] - objects2Check.extend([inputPointsFC, toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - raise Exception("Bad Input") - else : - print("Valid Object: " + desc.Name) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - inputFeatureCount = int(arcpy.GetCount_management(inputPointsFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPointsFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - maximumRange = 1000.0 - bearing = 150.0 - traversal = 22.0 - projection = arcpy.SpatialReference(32642) # WGS_1984_UTM_Zone_42N - - ########################################################3 - # Execute the Model under test: - arcpy.sourceRangeFan_MAoT(inputPointsFC, maximumRange, bearing, traversal, outputRangeFansFC, projection) - ########################################################3 - - outputFeatureCountFans = int(arcpy.GetCount_management(outputRangeFansFC).getOutput(0)) - print("Output FeatureClass: " + str(outputRangeFansFC)) - print("Output Feature Count: " + str(outputFeatureCountFans)) - - if (outputFeatureCountFans < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCountFans)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - finally: - # Check in the 3D Analyst extension - arcpy.CheckInExtension("Spatial") - - -RunTest() \ No newline at end of file diff --git a/suitability/test/test_maot/TestTemplateConfig.py b/suitability/test/test_maot/TestTemplateConfig.py deleted file mode 100644 index 69440cdb..00000000 --- a/suitability/test/test_maot/TestTemplateConfig.py +++ /dev/null @@ -1,98 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestTemplateConfig.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ----------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - print "Deleting Scratch Workspace (Workaround)" - TestUtilities.deleteScratch() - TestUtilities.createScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, \ - TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB, \ - TestUtilities.defaultGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/suitability/test/test_maot/TestUtilities.py b/suitability/test/test_maot/TestUtilities.py deleted file mode 100644 index 75b4699f..00000000 --- a/suitability/test/test_maot/TestUtilities.py +++ /dev/null @@ -1,55 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestTemplateConfig.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import arcpy -import os - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../suitability/data/geodatabases/")) - -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../suitability/toolboxes/")) - -inputGDB = os.path.join(geodatabasePath, "test_maot_input.gdb") -inputElevationURL = r"http://afmcloud.esri.com/arcgis/services/Environment/D_DigitalTerrainModel/ImageServer" -#inputElevationURL = r"http://afmcloud.esri.com/arcgis/rest/services/Environment/DigitalTerrainModel/ImageServer" - -#outputGDB = os.path.join(geodatabasePath, "test_outputs.gdb") -#defaultGDB = os.path.join(geodatabasePath, "default.gdb") -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -outputGDB = scratchGDB -defaultGDB = scratchGDB - -toolbox = os.path.join(toolboxesPath, "Military Aspects of Terrain Tools_10.3.tbx") - -def createScratch() : - try : - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - - return - -def deleteScratch() : - try : - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - - return diff --git a/suitability/test/test_maot/build.xml b/suitability/test/test_maot/build.xml deleted file mode 100644 index a9512d94..00000000 --- a/suitability/test/test_maot/build.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/suitability/test/test_path_slope/TemplateConfigTest.py b/suitability/test/test_path_slope/TemplateConfigTest.py deleted file mode 100644 index 4ae3cded..00000000 --- a/suitability/test/test_path_slope/TemplateConfigTest.py +++ /dev/null @@ -1,98 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - if not arcpy.Exists(TestUtilities.scratchGDB): - TestUtilities.createScratch() - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB, TestUtilities.defaultGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check)) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/suitability/test/test_path_slope/TestPathSlope.py b/suitability/test/test_path_slope/TestPathSlope.py deleted file mode 100644 index 8725275e..00000000 --- a/suitability/test/test_path_slope/TestPathSlope.py +++ /dev/null @@ -1,93 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestPathSlope.py -# Description: Test Path Slope Toolbox -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputPolyArea = os.path.join(TestUtilities.inputGDB, "samplePolygonArea") - inputRoads = os.path.join(TestUtilities.inputGDB, "roads") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - psOutput = os.path.join(TestUtilities.outputGDB, "PathSlopeOutput") - - #Testing Path Slope - arcpy.AddMessage("Starting Test: Path Slope Tools") - arcpy.PathSlope_path(inputPolyArea,inputRoads, inputSurface, psOutput) - - #Verify Results - outputFeatureCount = int(arcpy.GetCount_management(psOutput).getOutput(0)) - print("Output FeatureClass: " + str(psOutput)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/suitability/test/test_path_slope/TestPathSlopeCustomTable.py b/suitability/test/test_path_slope/TestPathSlopeCustomTable.py deleted file mode 100644 index 4d31e081..00000000 --- a/suitability/test/test_path_slope/TestPathSlopeCustomTable.py +++ /dev/null @@ -1,95 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestPathSlopeCustomTable.py -# Description: Test Path Slope Toolbox -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - - inputPolyArea = os.path.join(TestUtilities.inputGDB, "samplePolygonArea") - inputSRT = os.path.join(TestUtilities.inputGDB, "SlopeRangeTableExample") - inputRoads = os.path.join(TestUtilities.inputGDB, "roads") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - psOutputCT = os.path.join(TestUtilities.outputGDB, "PathSlopeOutputCT") - - #Testing Path Slope by Custom Table - arcpy.AddMessage("Starting Test: Path Slope by Custom Table") - arcpy.PathSlopeByCustomTable_path(inputPolyArea, inputRoads, inputSurface, inputSRT, 'FromVal', 'ToVal', 'SlopeCat', psOutputCT, 'PERCENT_RISE') - -# Verify Results - - outputFeatureCount = int(arcpy.GetCount_management(psOutputCT).getOutput(0)) - print("Output FeatureClass: " + str(psOutputCT)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/suitability/test/test_path_slope/TestPathSlopeReclassValues.py b/suitability/test/test_path_slope/TestPathSlopeReclassValues.py deleted file mode 100644 index a67e8094..00000000 --- a/suitability/test/test_path_slope/TestPathSlopeReclassValues.py +++ /dev/null @@ -1,97 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestPathSlopeReclassValues.py -# Description: Test Path Slope Toolbox -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -# ---------------------------------------------------------------------------- - -import arcpy -import sys -import traceback -import TestUtilities -import os - -class LicenseError(Exception): - pass - -try: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - - else: - raise LicenseError - - arcpy.ImportToolbox(TestUtilities.toolbox) - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - - inputPolyArea = os.path.join(TestUtilities.inputGDB, "samplePolygonArea") - inputRoads = os.path.join(TestUtilities.inputGDB, "roads") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - psOutputRV = os.path.join(TestUtilities.outputGDB, "PathSlopeOutputRV") - classValue = '0 3 1;3 10 2;10 15 3;15 20 4;20 30 5;30 45 6;45 60 7;60 85 8;85 10000000000000 9;NODATA 0' - - #Testing Path Slope by Reclass Values - arcpy.AddMessage("Starting Test: Path Slope by Reclass Values") - TestUtilities.createScratch() - arcpy.PathSlopeByRanges_path(inputPolyArea, inputRoads, inputSurface, 'DEGREE', classValue, psOutputRV) - - - #Test for Feature Outpu - outputFeatureCount = int(arcpy.GetCount_management(psOutputRV).getOutput(0)) - print("Output FeatureClass: " + str(psOutputRV)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputFeatureCount < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - print("Test Passed") - -except LicenseError: - print("Spatial Analyst license is unavailable") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) - -finally: - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckInExtension("Spatial") \ No newline at end of file diff --git a/suitability/test/test_path_slope/TestUtilities.py b/suitability/test/test_path_slope/TestUtilities.py deleted file mode 100644 index ad01f8d9..00000000 --- a/suitability/test/test_path_slope/TestUtilities.py +++ /dev/null @@ -1,53 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys - -currentPath = os.path.dirname(__file__) -geodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../../suitability/data/geodatabases/")) -scratchPath = geodatabasePath -toolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../../suitability/toolboxes/")) - -inputGDB = os.path.join(geodatabasePath, "test_path_slope_inputs.gdb") -#outputGDB = os.path.join(geodatabasePath, "test_outputs.gdb") -#if not arcpy.Exists(outputGDB): arcpy.CreateFileGDB_management(os.path.dirname(outputGDB),os.path.basename(outputGDB)[:-4]) -#defaultGDB = os.path.join(geodatabasePath, "default.gdb") -scratchGDB = os.path.join(scratchPath, "scratch.gdb") -outputGDB = scratchGDB -defaultGDB = scratchGDB - -toolbox = os.path.join(toolboxesPath, "Path Slope Tools_10.3.tbx") - -def createScratch() : - try : - arcpy.CreateFileGDB_management(scratchPath, "scratch") - except: - print("scratch.gdb already exists") - - return - -def deleteScratch() : - try : - arcpy.Delete_management(scratchGDB) - except: - print("scratch.gdb delete failed") - - return diff --git a/suitability/test/test_path_slope/build.xml b/suitability/test/test_path_slope/build.xml deleted file mode 100644 index eb041b18..00000000 --- a/suitability/test/test_path_slope/build.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/suitability/test/versions.xml b/suitability/test/versions.xml deleted file mode 100644 index 5098ed3e..00000000 --- a/suitability/test/versions.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - OUTPUTS: ${dir.arcgisdesktop}, ${dir.arcpy} - Checks system environment variable and sets the above values depending on version detected. - Sets the correct ArcPy and ArcGIS Folder location depending on version detected. - IMPORTANT: If Python is not installed at the default location, - you will need to edit the task "SET_CUSTOM_PYTHON_LOCATION" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/suitability/toolboxes/Maritime Decision Aid Tools.tbx b/suitability/toolboxes/Maritime Decision Aid Tools.tbx index 578724f7..22dc53ac 100644 Binary files a/suitability/toolboxes/Maritime Decision Aid Tools.tbx and b/suitability/toolboxes/Maritime Decision Aid Tools.tbx differ diff --git a/suitability/toolboxes/Maritime Decision Aid Tools_10.4.tbx b/suitability/toolboxes/Maritime Decision Aid Tools_10.4.tbx index a1826286..2edbaa5f 100644 Binary files a/suitability/toolboxes/Maritime Decision Aid Tools_10.4.tbx and b/suitability/toolboxes/Maritime Decision Aid Tools_10.4.tbx differ diff --git a/suitability/toolboxes/Military Aspects of Weather Tools_10.4.tbx b/suitability/toolboxes/Military Aspects of Weather Tools_10.4.tbx index d360acb8..d30c6db1 100644 Binary files a/suitability/toolboxes/Military Aspects of Weather Tools_10.4.tbx and b/suitability/toolboxes/Military Aspects of Weather Tools_10.4.tbx differ diff --git a/suitability/toolboxes/layers/Hours Of Transit.lyr b/suitability/toolboxes/layers/Hours Of Transit.lyr new file mode 100644 index 00000000..b632dab8 Binary files /dev/null and b/suitability/toolboxes/layers/Hours Of Transit.lyr differ diff --git a/suitability/toolboxes/layers/HoursofTransit.lyrx b/suitability/toolboxes/layers/HoursofTransit.lyrx new file mode 100644 index 00000000..7d7c8c17 --- /dev/null +++ b/suitability/toolboxes/layers/HoursofTransit.lyrx @@ -0,0 +1,667 @@ +{ + "type" : "CIMLayerDocument", + "version" : "1.3.0", + "build" : 5861, + "layers" : [ + "CIMPATH=map1/farthestoncdh.xml" + ], + "layerDefinitions" : [ + { + "type" : "CIMRasterLayer", + "name" : "Hours of Transit", + "uRI" : "CIMPATH=map1/farthestoncdh.xml", + "sourceModifiedTime" : { + "type" : "TimeInstant", + "start" : 978307200000 + }, + "metadataURI" : "CIMPATH=Metadata/363296b7406af14f5c49c0046d96b93f.xml", + "description" : "FarthestOnCDh", + "expanded" : true, + "layerType" : "Operational", + "showLegends" : true, + "transparency" : 25, + "visibility" : true, + "displayCacheType" : "Permanent", + "maxDisplayCacheAge" : 5, + "showPopups" : true, + "serviceLayerID" : -1, + "dataConnection" : { + "type" : "CIMStandardDataConnection", + "workspaceConnectionString" : "DATABASE=..\\tooldata\\Maritime Decision Aid Tools.gdb", + "workspaceFactory" : "FileGDB", + "dataset" : "HoursOfTransit", + "datasetType" : "esriDTRasterDataset" + }, + "colorizer" : { + "type" : "CIMRasterClassifyColorizer", + "resamplingType" : "NearestNeighbor", + "classBreaks" : [ + { + "type" : "CIMRasterClassBreak", + "upperBound" : 1, + "label" : "<= 1", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 146, + 0, + 0, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 2, + "label" : "<= 2", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 177, + 52, + 0, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 3, + "label" : "<= 3", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 209, + 93, + 0, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 4, + "label" : "<= 4", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 241, + 131, + 0, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 5, + "label" : "<= 5", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 254, + 167, + 0, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 6, + "label" : "<= 6", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 251, + 199, + 15, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 7, + "label" : "<= 7", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 246, + 230, + 8, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 8, + "label" : "<= 8", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 235, + 254, + 23, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 9, + "label" : "<= 9", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 181, + 255, + 8, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 10, + "label" : "<= 10", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 108, + 255, + 22, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 11, + "label" : "<= 11", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 254, + 6, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 12, + "label" : "<= 12", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 254, + 94, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 13, + "label" : "<= 13", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 2, + 252, + 158, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 14, + "label" : "<= 14", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 18, + 253, + 216, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 15, + "label" : "<= 15", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 35, + 235, + 253, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 16, + "label" : "<= 16", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 91, + 173, + 254, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 17, + "label" : "<= 17", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 103, + 107, + 254, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 18, + "label" : "<= 18", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 90, + 3, + 252, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 19, + "label" : "<= 19", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 146, + 0, + 251, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 20, + "label" : "<= 20", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 198, + 5, + 251, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 21, + "label" : "<= 21", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 245, + 11, + 251, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 22, + "label" : "<= 22", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 81, + 252, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 23, + "label" : "<= 23", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 151, + 253, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 24, + "label" : "<= 24", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 205, + 254, + 100 + ] + } + }, + { + "type" : "CIMRasterClassBreak", + "upperBound" : 1000, + "label" : "Greater than 1 day", + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 253, + 253, + 255, + 100 + ] + } + } + ], + "classificationMethod" : "Manual", + "colorRamp" : { + "type" : "CIMMultipartColorRamp", + "colorRamps" : [ + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 31.863181823211498, + 50.734705399697603, + 44.931516733483981, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 72.06845683600443, + 34.635676622700174, + 73.392315229931029, + 100 + ] + } + }, + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 72.06845683600443, + 34.635676622700174, + 73.392315229931029, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 96.683616491167115, + -20.419171018551619, + 87.367929001284963, + 100 + ] + } + }, + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 96.683616491167115, + -20.419171018551619, + 87.367929001284963, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 85.607074229000403, + -91.486192975967157, + 73.962202685380788, + 100 + ] + } + }, + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 85.607074229000403, + -91.486192975967157, + 73.962202685380788, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 89.644590646826003, + -51.521697716782114, + -16.300660645455501, + 100 + ] + } + }, + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 89.644590646826003, + -51.521697716782114, + -16.300660645455501, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 34.668982832368499, + 71.125560221348664, + -101.88789308244294, + 100 + ] + } + }, + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 34.668982832368499, + 71.125560221348664, + -101.88789308244294, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 63.995042207660305, + 92.113234125181236, + -53.03187738755495, + 100 + ] + } + }, + { + "type" : "CIMLinearContinuousColorRamp", + "colorSpace" : { + "type" : "CIMICCColorSpace", + "url" : "CIELAB" + }, + "fromColor" : { + "type" : "CIMLABColor", + "values" : [ + 63.995042207660305, + 92.113234125181236, + -53.03187738755495, + 100 + ] + }, + "toColor" : { + "type" : "CIMLABColor", + "values" : [ + 99.532245803496281, + 1.0199694287250094, + -0.65140689316849354, + 100 + ] + } + } + ], + "weights" : [ + 0.14285714285714285, + 0.16035714285714281, + 0.11285714285714286, + 0.14535714285714285, + 0.13035714285714287, + 0.16535714285714281, + 0.14285714285714285 + ] + }, + "field" : "VALUE", + "hillshadeZFactor" : 1, + "showInAscendingOrder" : true, + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 0, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "normalizationType" : "Nothing" + }, + "attributeTable" : { + "type" : "CIMRasterTable", + "displayField" : "Value", + "editable" : true, + "fieldDescriptions" : [ + { + "type" : "CIMFieldDescription", + "alias" : "OID", + "fieldName" : "OID", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 0, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 0 + }, + "readOnly" : true, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "RASTER", + "fieldName" : "RASTER", + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "FOOTPRINT", + "fieldName" : "FOOTPRINT", + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "FOOTPRINT_Length", + "fieldName" : "FOOTPRINT_Length", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 0, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "readOnly" : true, + "visible" : true, + "searchMode" : "Exact" + }, + { + "type" : "CIMFieldDescription", + "alias" : "FOOTPRINT_Area", + "fieldName" : "FOOTPRINT_Area", + "numberFormat" : { + "type" : "CIMNumericFormat", + "alignmentOption" : "esriAlignRight", + "alignmentWidth" : 0, + "roundingOption" : "esriRoundNumberOfDecimals", + "roundingValue" : 6 + }, + "readOnly" : true, + "visible" : true, + "searchMode" : "Exact" + } + ] + } + } + ], + "binaryReferences" : [ + { + "type" : "CIMBinaryReference", + "uRI" : "CIMPATH=Metadata/363296b7406af14f5c49c0046d96b93f.xml", + "data" : "\r\n20160929130915001.0TRUEHours of TransitFarthestOnCDh\r\n" + } + ] +} \ No newline at end of file diff --git a/suitability/toolboxes/layers/Vessel.lyr b/suitability/toolboxes/layers/Vessel.lyr new file mode 100644 index 00000000..d4de8a0e Binary files /dev/null and b/suitability/toolboxes/layers/Vessel.lyr differ diff --git a/suitability/toolboxes/layers/Vessel.lyrx b/suitability/toolboxes/layers/Vessel.lyrx new file mode 100644 index 00000000..a390eb96 --- /dev/null +++ b/suitability/toolboxes/layers/Vessel.lyrx @@ -0,0 +1,1266 @@ +{ + "type" : "CIMLayerDocument", + "version" : "1.2.0", + "build" : 5023, + "layers" : [ + "CIMPATH=map/vessel.xml" + ], + "layerDefinitions" : [ + { + "type" : "CIMFeatureLayer", + "name" : "Vessel", + "uRI" : "CIMPATH=map/vessel.xml", + "sourceModifiedTime" : { + "type" : "TimeInstant" + }, + "metadataURI" : "CIMPATH=Metadata/d3c35a411261ef6ca275401b3ab8070f.xml", + "description" : "Vessel", + "expanded" : true, + "layerType" : "Operational", + "showLegends" : true, + "visibility" : true, + "displayCacheType" : "Permanent", + "maxDisplayCacheAge" : 5, + "showPopups" : true, + "serviceLayerID" : -1, + "autoGenerateFeatureTemplates" : true, + "featureTable" : { + "type" : "CIMFeatureTable", + "displayField" : "name", + "editable" : true, + "dataConnection" : { + "type" : "CIMStandardDataConnection", + "workspaceConnectionString" : "DATABASE=..\\tooldata\\Maritime Decision Aid Tools.gdb", + "workspaceFactory" : "FileGDB", + "dataset" : "Vessel", + "datasetType" : "esriDTFeatureClass" + }, + "studyAreaSpatialRel" : "esriSpatialRelUndefined", + "searchOrder" : "esriSearchOrderSpatial" + }, + "htmlPopupEnabled" : true, + "selectable" : true, + "labelClasses" : [ + { + "type" : "CIMLabelClass", + "expression" : "[name]", + "expressionEngine" : "VBScript", + "featuresToLabel" : "AllVisibleFeatures", + "maplexLabelPlacementProperties" : { + "type" : "CIMMaplexLabelPlacementProperties", + "featureType" : "Point", + "avoidPolygonHoles" : true, + "canOverrunFeature" : true, + "canPlaceLabelOutsidePolygon" : true, + "canRemoveOverlappingLabel" : true, + "canStackLabel" : true, + "connectionType" : "Unambiguous", + "constrainOffset" : "NoConstraint", + "contourAlignmentType" : "Page", + "contourLadderType" : "Straight", + "contourMaximumAngle" : 90, + "enableConnection" : true, + "enablePointPlacementPriorities" : true, + "featureWeight" : 0, + "fontHeightReductionLimit" : 4, + "fontHeightReductionStep" : 0.5, + "fontWidthReductionLimit" : 90, + "fontWidthReductionStep" : 5, + "graticuleAlignmentType" : "Straight", + "keyNumberGroupName" : "Default", + "labelBuffer" : 15, + "labelLargestPolygon" : true, + "labelPriority" : -1, + "labelStackingProperties" : { + "type" : "CIMMaplexLabelStackingProperties", + "stackAlignment" : "ChooseBest", + "maximumNumberOfLines" : 3, + "minimumNumberOfCharsPerLine" : 3, + "maximumNumberOfCharsPerLine" : 24, + "separators" : [ + { + "type" : "CIMMaplexStackingSeparator", + "separator" : " ", + "splitAfter" : true + }, + { + "type" : "CIMMaplexStackingSeparator", + "separator" : ",", + "visible" : true, + "splitAfter" : true + } + ] + }, + "lineFeatureType" : "General", + "linePlacementMethod" : "OffsetCurvedFromLine", + "maximumLabelOverrun" : 36, + "maximumLabelOverrunUnit" : "Point", + "minimumFeatureSizeUnit" : "Map", + "multiPartOption" : "OneLabelPerPart", + "offsetAlongLineProperties" : { + "type" : "CIMMaplexOffsetAlongLineProperties", + "placementMethod" : "BestPositionAlongLine", + "labelAnchorPoint" : "CenterOfLabel", + "distanceUnit" : "Percentage", + "useLineDirection" : true + }, + "pointExternalZonePriorities" : { + "type" : "CIMMaplexExternalZonePriorities", + "aboveLeft" : 4, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerRight" : 3, + "belowRight" : 5, + "belowCenter" : 7, + "belowLeft" : 8, + "centerLeft" : 6 + }, + "pointPlacementMethod" : "AroundPoint", + "polygonAnchorPointType" : "GeometricCenter", + "polygonBoundaryWeight" : 0, + "polygonExternalZones" : { + "type" : "CIMMaplexExternalZonePriorities", + "aboveLeft" : 4, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerRight" : 3, + "belowRight" : 5, + "belowCenter" : 7, + "belowLeft" : 8, + "centerLeft" : 6 + }, + "polygonFeatureType" : "General", + "polygonInternalZones" : { + "type" : "CIMMaplexInternalZonePriorities", + "center" : 1 + }, + "polygonPlacementMethod" : "CurvedInPolygon", + "primaryOffset" : 1, + "primaryOffsetUnit" : "Point", + "removeExtraWhiteSpace" : true, + "repetitionIntervalUnit" : "Map", + "rotationProperties" : { + "type" : "CIMMaplexRotationProperties", + "rotationType" : "Arithmetic", + "alignmentType" : "Straight" + }, + "secondaryOffset" : 100, + "strategyPriorities" : { + "type" : "CIMMaplexStrategyPriorities", + "stacking" : 1, + "overrun" : 2, + "fontCompression" : 3, + "fontReduction" : 4, + "abbreviation" : 5 + }, + "thinningDistanceUnit" : "Point", + "truncationMarkerCharacter" : ".", + "truncationMinimumLength" : 1, + "truncationPreferredCharacters" : "aeiou" + }, + "name" : "Class 1", + "priority" : -1, + "standardLabelPlacementProperties" : { + "type" : "CIMStandardLabelPlacementProperties", + "featureType" : "Line", + "featureWeight" : "Low", + "labelWeight" : "High", + "numLabelsOption" : "OneLabelPerName", + "lineLabelPosition" : { + "type" : "CIMStandardLineLabelPosition", + "above" : true, + "inLine" : true, + "parallel" : true + }, + "lineLabelPriorities" : { + "type" : "CIMStandardLineLabelPriorities", + "aboveStart" : 3, + "aboveAlong" : 3, + "aboveEnd" : 3, + "centerStart" : 3, + "centerAlong" : 3, + "centerEnd" : 3, + "belowStart" : 3, + "belowAlong" : 3, + "belowEnd" : 3 + }, + "pointPlacementMethod" : "AroundPoint", + "pointPlacementPriorities" : { + "type" : "CIMStandardPointPlacementPriorities", + "aboveLeft" : 2, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerLeft" : 3, + "centerRight" : 2, + "belowLeft" : 3, + "belowCenter" : 3, + "belowRight" : 2 + }, + "rotationType" : "Arithmetic", + "polygonPlacementMethod" : "AlwaysHorizontal" + }, + "textSymbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMTextSymbol", + "blockProgression" : "TTB", + "depth3D" : 1, + "extrapolateBaselines" : true, + "fontEffects" : "Normal", + "fontEncoding" : "Unicode", + "fontFamilyName" : "Tahoma", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "haloSize" : 1, + "height" : 10, + "hinting" : "Default", + "horizontalAlignment" : "Left", + "kerning" : true, + "letterWidth" : 100, + "ligatures" : true, + "lineGapType" : "ExtraLeading", + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "textCase" : "Normal", + "textDirection" : "LTR", + "verticalAlignment" : "Bottom", + "verticalGlyphOrientation" : "Right", + "wordSpacing" : 100, + "billboardMode3D" : "FaceNearPlane" + } + }, + "useCodedValue" : true, + "visibility" : true, + "iD" : -1 + } + ], + "renderer" : { + "type" : "CIMSimpleRenderer", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPointSymbol", + "symbolLayers" : [ + { + "type" : "CIMVectorMarker", + "enable" : true, + "colorLocked" : true, + "anchorPoint" : { + "x" : 0, + "y" : 0 + }, + "anchorPointUnits" : "Absolute", + "dominantSizeAxis3D" : "Y", + "size" : 10, + "billboardMode3D" : "FaceNearPlane", + "frame" : { + "xmin" : 0, + "ymin" : 0, + "xmax" : 17, + "ymax" : 17 + }, + "markerGraphics" : [ + { + "type" : "CIMMarkerGraphic", + "geometry" : { + "curveRings" : [ + [ + [ + 11.41, + 8.5 + ], + { + "b" : [ + [ + 11.18, + 7.3700000000000001 + ], + [ + 11.41, + 8.0899999999999999 + ], + [ + 11.34, + 7.7199999999999998 + ] + ] + }, + { + "b" : [ + [ + 10.550000000000001, + 6.4500000000000002 + ], + [ + 11.029999999999999, + 7.0199999999999996 + ], + [ + 10.82, + 6.71 + ] + ] + }, + { + "b" : [ + [ + 9.6300000000000008, + 5.8200000000000003 + ], + [ + 10.279999999999999, + 6.1799999999999997 + ], + [ + 9.9800000000000004, + 5.9699999999999998 + ] + ] + }, + { + "b" : [ + [ + 8.5, + 5.5800000000000001 + ], + [ + 9.2799999999999994, + 5.6600000000000001 + ], + [ + 8.9000000000000004, + 5.5800000000000001 + ] + ] + }, + { + "b" : [ + [ + 7.3700000000000001, + 5.8200000000000003 + ], + [ + 8.0899999999999999, + 5.5800000000000001 + ], + [ + 7.7199999999999998, + 5.6600000000000001 + ] + ] + }, + { + "b" : [ + [ + 6.4500000000000002, + 6.4500000000000002 + ], + [ + 7.0199999999999996, + 5.9699999999999998 + ], + [ + 6.7199999999999998, + 6.1799999999999997 + ] + ] + }, + { + "b" : [ + [ + 5.8200000000000003, + 7.3700000000000001 + ], + [ + 6.1799999999999997, + 6.71 + ], + [ + 5.9699999999999998, + 7.0199999999999996 + ] + ] + }, + { + "b" : [ + [ + 5.5800000000000001, + 8.5 + ], + [ + 5.6600000000000001, + 7.7199999999999998 + ], + [ + 5.5800000000000001, + 8.0899999999999999 + ] + ] + }, + { + "b" : [ + [ + 5.8200000000000003, + 9.6300000000000008 + ], + [ + 5.5800000000000001, + 8.9000000000000004 + ], + [ + 5.6600000000000001, + 9.2799999999999994 + ] + ] + }, + { + "b" : [ + [ + 6.4500000000000002, + 10.550000000000001 + ], + [ + 5.9699999999999998, + 9.9800000000000004 + ], + [ + 6.1799999999999997, + 10.279999999999999 + ] + ] + }, + { + "b" : [ + [ + 7.3700000000000001, + 11.18 + ], + [ + 6.7199999999999998, + 10.82 + ], + [ + 7.0199999999999996, + 11.029999999999999 + ] + ] + }, + { + "b" : [ + [ + 8.5, + 11.41 + ], + [ + 7.7199999999999998, + 11.34 + ], + [ + 8.0899999999999999, + 11.41 + ] + ] + }, + { + "b" : [ + [ + 9.6300000000000008, + 11.18 + ], + [ + 8.9000000000000004, + 11.41 + ], + [ + 9.2799999999999994, + 11.34 + ] + ] + }, + { + "b" : [ + [ + 10.550000000000001, + 10.550000000000001 + ], + [ + 9.9800000000000004, + 11.029999999999999 + ], + [ + 10.279999999999999, + 10.82 + ] + ] + }, + { + "b" : [ + [ + 11.18, + 9.6300000000000008 + ], + [ + 10.82, + 10.279999999999999 + ], + [ + 11.029999999999999, + 9.9800000000000004 + ] + ] + }, + { + "b" : [ + [ + 11.41, + 8.5 + ], + [ + 11.34, + 9.2799999999999994 + ], + [ + 11.41, + 8.9000000000000004 + ] + ] + } + ], + [ + [ + 15.539999999999999, + 8.5 + ], + { + "b" : [ + [ + 14.99, + 11.24 + ], + [ + 15.539999999999999, + 9.4700000000000006 + ], + [ + 15.359999999999999, + 10.380000000000001 + ] + ] + }, + { + "b" : [ + [ + 13.48, + 13.48 + ], + [ + 14.609999999999999, + 12.1 + ], + [ + 14.109999999999999, + 12.85 + ] + ] + }, + { + "b" : [ + [ + 11.24, + 14.98 + ], + [ + 12.85, + 14.109999999999999 + ], + [ + 12.1, + 14.609999999999999 + ] + ] + }, + { + "b" : [ + [ + 8.5, + 15.539999999999999 + ], + [ + 10.390000000000001, + 15.359999999999999 + ], + [ + 9.4700000000000006, + 15.539999999999999 + ] + ] + }, + { + "b" : [ + [ + 5.75, + 14.98 + ], + [ + 7.5300000000000002, + 15.539999999999999 + ], + [ + 6.6100000000000003, + 15.359999999999999 + ] + ] + }, + { + "b" : [ + [ + 3.52, + 13.48 + ], + [ + 4.9000000000000004, + 14.609999999999999 + ], + [ + 4.1500000000000004, + 14.109999999999999 + ] + ] + }, + { + "b" : [ + [ + 2.0099999999999998, + 11.24 + ], + [ + 2.8900000000000001, + 12.85 + ], + [ + 2.3900000000000001, + 12.1 + ] + ] + }, + { + "b" : [ + [ + 1.46, + 8.5 + ], + [ + 1.6399999999999999, + 10.380000000000001 + ], + [ + 1.46, + 9.4700000000000006 + ] + ] + }, + { + "b" : [ + [ + 2.0099999999999998, + 5.7599999999999998 + ], + [ + 1.46, + 7.5300000000000002 + ], + [ + 1.6399999999999999, + 6.6100000000000003 + ] + ] + }, + { + "b" : [ + [ + 3.52, + 3.52 + ], + [ + 2.3900000000000001, + 4.9000000000000004 + ], + [ + 2.8900000000000001, + 4.1500000000000004 + ] + ] + }, + { + "b" : [ + [ + 5.75, + 2.02 + ], + [ + 4.1500000000000004, + 2.8900000000000001 + ], + [ + 4.9000000000000004, + 2.3900000000000001 + ] + ] + }, + { + "b" : [ + [ + 8.5, + 1.46 + ], + [ + 6.6100000000000003, + 1.6399999999999999 + ], + [ + 7.5300000000000002, + 1.46 + ] + ] + }, + { + "b" : [ + [ + 11.24, + 2.02 + ], + [ + 9.4700000000000006, + 1.46 + ], + [ + 10.390000000000001, + 1.6399999999999999 + ] + ] + }, + { + "b" : [ + [ + 13.48, + 3.52 + ], + [ + 12.1, + 2.3900000000000001 + ], + [ + 12.85, + 2.8900000000000001 + ] + ] + }, + { + "b" : [ + [ + 14.99, + 5.7599999999999998 + ], + [ + 14.109999999999999, + 4.1500000000000004 + ], + [ + 14.609999999999999, + 4.9000000000000004 + ] + ] + }, + { + "b" : [ + [ + 15.539999999999999, + 8.5 + ], + [ + 15.359999999999999, + 6.6100000000000003 + ], + [ + 15.539999999999999, + 7.5300000000000002 + ] + ] + } + ], + [ + [ + 17, + 8.5 + ], + { + "b" : [ + [ + 16.329999999999998, + 5.2000000000000002 + ], + [ + 17, + 7.3300000000000001 + ], + [ + 16.780000000000001, + 6.2300000000000004 + ] + ] + }, + { + "b" : [ + [ + 14.51, + 2.4900000000000002 + ], + [ + 15.890000000000001, + 4.1600000000000001 + ], + [ + 15.279999999999999, + 3.2599999999999998 + ] + ] + }, + { + "b" : [ + [ + 11.800000000000001, + 0.67000000000000004 + ], + [ + 13.74, + 1.72 + ], + [ + 12.84, + 1.1100000000000001 + ] + ] + }, + { + "b" : [ + [ + 8.5, + 0 + ], + [ + 10.77, + 0.22 + ], + [ + 9.6699999999999999, + 0 + ] + ] + }, + { + "b" : [ + [ + 5.2000000000000002, + 0.67000000000000004 + ], + [ + 7.3300000000000001, + 0 + ], + [ + 6.2300000000000004, + 0.22 + ] + ] + }, + { + "b" : [ + [ + 2.4900000000000002, + 2.4900000000000002 + ], + [ + 4.1600000000000001, + 1.1100000000000001 + ], + [ + 3.2599999999999998, + 1.72 + ] + ] + }, + { + "b" : [ + [ + 0.67000000000000004, + 5.2000000000000002 + ], + [ + 1.72, + 3.2599999999999998 + ], + [ + 1.1100000000000001, + 4.1600000000000001 + ] + ] + }, + { + "b" : [ + [ + 0, + 8.5 + ], + [ + 0.22, + 6.2300000000000004 + ], + [ + 0, + 7.3300000000000001 + ] + ] + }, + { + "b" : [ + [ + 0.67000000000000004, + 11.800000000000001 + ], + [ + 0, + 9.6699999999999999 + ], + [ + 0.22, + 10.77 + ] + ] + }, + { + "b" : [ + [ + 2.4900000000000002, + 14.51 + ], + [ + 1.1100000000000001, + 12.84 + ], + [ + 1.72, + 13.74 + ] + ] + }, + { + "b" : [ + [ + 5.2000000000000002, + 16.329999999999998 + ], + [ + 3.2599999999999998, + 15.279999999999999 + ], + [ + 4.1600000000000001, + 15.890000000000001 + ] + ] + }, + { + "b" : [ + [ + 8.5, + 17 + ], + [ + 6.2300000000000004, + 16.780000000000001 + ], + [ + 7.3300000000000001, + 17 + ] + ] + }, + { + "b" : [ + [ + 11.800000000000001, + 16.329999999999998 + ], + [ + 9.6699999999999999, + 17 + ], + [ + 10.77, + 16.780000000000001 + ] + ] + }, + { + "b" : [ + [ + 14.51, + 14.51 + ], + [ + 12.84, + 15.890000000000001 + ], + [ + 13.74, + 15.279999999999999 + ] + ] + }, + { + "b" : [ + [ + 16.329999999999998, + 11.800000000000001 + ], + [ + 15.279999999999999, + 13.74 + ], + [ + 15.890000000000001, + 12.84 + ] + ] + }, + { + "b" : [ + [ + 17, + 8.5 + ], + [ + 16.780000000000001, + 10.77 + ], + [ + 17, + 9.6699999999999999 + ] + ] + } + ] + ] + }, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidStroke", + "enable" : true, + "capStyle" : "Round", + "joinStyle" : "Round", + "lineStyle3D" : "Strip", + "miterLimit" : 10, + "width" : 0, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + }, + { + "type" : "CIMSolidFill", + "enable" : true, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + } + } + ], + "scaleSymbolsProportionally" : true, + "respectFrame" : true + }, + { + "type" : "CIMVectorMarker", + "enable" : true, + "anchorPoint" : { + "x" : 0, + "y" : 0 + }, + "anchorPointUnits" : "Absolute", + "dominantSizeAxis3D" : "Y", + "size" : 10, + "billboardMode3D" : "FaceNearPlane", + "frame" : { + "xmin" : 0, + "ymin" : 0, + "xmax" : 17, + "ymax" : 17 + }, + "markerGraphics" : [ + { + "type" : "CIMMarkerGraphic", + "geometry" : { + "curveRings" : [ + [ + [ + 17, + 8.5 + ], + { + "b" : [ + [ + 8.5, + 0 + ], + [ + 17, + 3.8100000000000001 + ], + [ + 13.19, + 0 + ] + ] + }, + { + "b" : [ + [ + 0, + 8.5 + ], + [ + 3.8100000000000001, + 0 + ], + [ + 0, + 3.8100000000000001 + ] + ] + }, + { + "b" : [ + [ + 8.5, + 17 + ], + [ + 0, + 13.19 + ], + [ + 3.8100000000000001, + 17 + ] + ] + }, + { + "b" : [ + [ + 17, + 8.5 + ], + [ + 13.19, + 17 + ], + [ + 17, + 13.19 + ] + ] + } + ] + ] + }, + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidStroke", + "enable" : true, + "capStyle" : "Round", + "joinStyle" : "Round", + "lineStyle3D" : "Strip", + "miterLimit" : 10, + "width" : 0, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + }, + { + "type" : "CIMSolidFill", + "enable" : true, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 255, + 0, + 0, + 100 + ] + } + } + ] + } + } + ], + "scaleSymbolsProportionally" : true, + "respectFrame" : true + } + ], + "haloSize" : 1, + "scaleX" : 1, + "angleAlignment" : "Display" + } + } + }, + "scaleSymbols" : true, + "snappable" : true + } + ], + "binaryReferences" : [ + { + "type" : "CIMBinaryReference", + "uRI" : "CIMPATH=Metadata/d3c35a411261ef6ca275401b3ab8070f.xml", + "data" : "20160323171334001.0FALSEVessel002file://\\\\JFRY2\\C$\\Users\\john6807\\Documents\\GitHub\\solutions-geoprocessing-toolbox\\suitability\\toolboxes\\tooldata\\Maritime Decision Aid Tools.gdbLocal Area NetworkProjectedGCS_WGS_1984Linear Unit: Meter (1.000000)WGS_1984_Web_Mercator_Auxiliary_Sphere<ProjectedCoordinateSystem xsi:type='typens:ProjectedCoordinateSystem' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.3'><WKT>PROJCS[&quot;WGS_1984_Web_Mercator_Auxiliary_Sphere&quot;,GEOGCS[&quot;GCS_WGS_1984&quot;,DATUM[&quot;D_WGS_1984&quot;,SPHEROID[&quot;WGS_1984&quot;,6378137.0,298.257223563]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]],PROJECTION[&quot;Mercator_Auxiliary_Sphere&quot;],PARAMETER[&quot;False_Easting&quot;,0.0],PARAMETER[&quot;False_Northing&quot;,0.0],PARAMETER[&quot;Central_Meridian&quot;,0.0],PARAMETER[&quot;Standard_Parallel_1&quot;,0.0],PARAMETER[&quot;Auxiliary_Sphere_Type&quot;,0.0],UNIT[&quot;Meter&quot;,1.0],AUTHORITY[&quot;EPSG&quot;,3857]]</WKT><XOrigin>-20037700</XOrigin><YOrigin>-30241100</YOrigin><XYScale>10000</XYScale><ZOrigin>-100000</ZOrigin><ZScale>10000</ZScale><MOrigin>-100000</MOrigin><MScale>10000</MScale><XYTolerance>0.001</XYTolerance><ZTolerance>0.001</ZTolerance><MTolerance>0.001</MTolerance><HighPrecision>true</HighPrecision><WKID>102100</WKID><LatestWKID>3857</LatestWKID></ProjectedCoordinateSystem>CopyFeatures \"Feature Set\" E:\\Demos\\AFMMO\\2014\\UC2014\\2_ArcGISDesktop_MaritimeDecisionAidTemplate\\Data\\MaritimeDecisionAidTemplate\\scratch.gdb\\Vessel # 0 0 0CalculateField E:\\Demos\\AFMMO\\2014\\UC2014\\2_ArcGISDesktop_MaritimeDecisionAidTemplate\\Data\\MaritimeDecisionAidTemplate\\scratch.gdb\\Vessel rangem \"(1.169* math.sqrt(35))*1.852 *1000\" PYTHON_9.3 #20140715205819002014071520581900 Version 6.2 (Build 9200) ; Esri ArcGIS 10.3.0.4217VesselFile Geodatabase Feature ClassdatasetEPSG8.2.60SimpleFALSE0TRUEFALSEVesselFeature Class0OBJECTIDIDOID400Internal feature number.EsriSequential unique whole numbers that are automatically generated.ShapeShapeGeometry000Feature geometry.EsriCoordinates defining the features.namenameString5000typetypeString5000bridgeheightbridgeheightSmallInteger200rangemrangemDouble80020140715\r\n" + } + ] +} \ No newline at end of file diff --git a/suitability/toolboxes/layers/Visible Range.lyrx b/suitability/toolboxes/layers/Visible Range.lyrx new file mode 100644 index 00000000..cdf5a376 --- /dev/null +++ b/suitability/toolboxes/layers/Visible Range.lyrx @@ -0,0 +1,281 @@ +{ + "type" : "CIMLayerDocument", + "version" : "1.2.0", + "build" : 5023, + "layers" : [ + "CIMPATH=map/vessel_buffer.xml" + ], + "layerDefinitions" : [ + { + "type" : "CIMFeatureLayer", + "name" : "Visible Range", + "uRI" : "CIMPATH=map/vessel_buffer.xml", + "sourceModifiedTime" : { + "type" : "TimeInstant" + }, + "description" : "Vessel_Buffer", + "expanded" : true, + "layerType" : "Operational", + "showLegends" : true, + "transparency" : 19, + "visibility" : true, + "displayCacheType" : "Permanent", + "maxDisplayCacheAge" : 5, + "showPopups" : true, + "serviceLayerID" : -1, + "autoGenerateFeatureTemplates" : true, + "featureTable" : { + "type" : "CIMFeatureTable", + "displayField" : "name", + "editable" : true, + "dataConnection" : { + "type" : "CIMStandardDataConnection", + "workspaceConnectionString" : "DATABASE=E:\\Dev\\Defense\\Maritime Decision Aid Template\\Pro Version SoCal\\Maritime Decision Aid Template\\Maritime Decision Aid Template.gdb", + "workspaceFactory" : "FileGDB", + "dataset" : "Vessel_Buffer", + "datasetType" : "esriDTFeatureClass" + }, + "studyAreaSpatialRel" : "esriSpatialRelUndefined", + "searchOrder" : "esriSearchOrderSpatial" + }, + "htmlPopupEnabled" : true, + "selectable" : true, + "labelClasses" : [ + { + "type" : "CIMLabelClass", + "expression" : "[name]", + "expressionEngine" : "VBScript", + "featuresToLabel" : "AllVisibleFeatures", + "maplexLabelPlacementProperties" : { + "type" : "CIMMaplexLabelPlacementProperties", + "featureType" : "Polygon", + "avoidPolygonHoles" : true, + "canOverrunFeature" : true, + "canPlaceLabelOutsidePolygon" : true, + "canRemoveOverlappingLabel" : true, + "canStackLabel" : true, + "connectionType" : "Unambiguous", + "constrainOffset" : "NoConstraint", + "contourAlignmentType" : "Page", + "contourLadderType" : "Straight", + "contourMaximumAngle" : 90, + "enableConnection" : true, + "featureWeight" : 0, + "fontHeightReductionLimit" : 4, + "fontHeightReductionStep" : 0.5, + "fontWidthReductionLimit" : 90, + "fontWidthReductionStep" : 5, + "graticuleAlignmentType" : "Straight", + "keyNumberGroupName" : "Default", + "labelBuffer" : 15, + "labelLargestPolygon" : false, + "labelPriority" : -1, + "labelStackingProperties" : { + "type" : "CIMMaplexLabelStackingProperties", + "stackAlignment" : "ChooseBest", + "maximumNumberOfLines" : 3, + "minimumNumberOfCharsPerLine" : 3, + "maximumNumberOfCharsPerLine" : 24, + "separators" : [ + { + "type" : "CIMMaplexStackingSeparator", + "separator" : " ", + "splitAfter" : true + }, + { + "type" : "CIMMaplexStackingSeparator", + "separator" : ",", + "visible" : true, + "splitAfter" : true + } + ] + }, + "lineFeatureType" : "General", + "linePlacementMethod" : "OffsetCurvedFromLine", + "maximumLabelOverrun" : 80, + "maximumLabelOverrunUnit" : "Point", + "minimumFeatureSizeUnit" : "Map", + "multiPartOption" : "OneLabelPerPart", + "offsetAlongLineProperties" : { + "type" : "CIMMaplexOffsetAlongLineProperties", + "placementMethod" : "BestPositionAlongLine", + "labelAnchorPoint" : "CenterOfLabel", + "distanceUnit" : "Percentage", + "useLineDirection" : true + }, + "pointExternalZonePriorities" : { + "type" : "CIMMaplexExternalZonePriorities", + "aboveLeft" : 4, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerRight" : 3, + "belowRight" : 5, + "belowCenter" : 7, + "belowLeft" : 8, + "centerLeft" : 6 + }, + "pointPlacementMethod" : "AroundPoint", + "polygonAnchorPointType" : "GeometricCenter", + "polygonBoundaryWeight" : 0, + "polygonExternalZones" : { + "type" : "CIMMaplexExternalZonePriorities", + "aboveLeft" : 4, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerRight" : 3, + "belowRight" : 5, + "belowCenter" : 7, + "belowLeft" : 8, + "centerLeft" : 6 + }, + "polygonFeatureType" : "General", + "polygonInternalZones" : { + "type" : "CIMMaplexInternalZonePriorities", + "center" : 1 + }, + "polygonPlacementMethod" : "HorizontalInPolygon", + "primaryOffset" : 1, + "primaryOffsetUnit" : "Point", + "removeExtraWhiteSpace" : true, + "repetitionIntervalUnit" : "Map", + "rotationProperties" : { + "type" : "CIMMaplexRotationProperties", + "rotationType" : "Arithmetic", + "alignmentType" : "Straight" + }, + "secondaryOffset" : 100, + "strategyPriorities" : { + "type" : "CIMMaplexStrategyPriorities", + "stacking" : 1, + "overrun" : 2, + "fontCompression" : 3, + "fontReduction" : 4, + "abbreviation" : 5 + }, + "thinningDistanceUnit" : "Point", + "truncationMarkerCharacter" : ".", + "truncationMinimumLength" : 1, + "truncationPreferredCharacters" : "aeiou" + }, + "name" : "Class 1", + "priority" : -1, + "standardLabelPlacementProperties" : { + "type" : "CIMStandardLabelPlacementProperties", + "featureType" : "Line", + "featureWeight" : "Low", + "labelWeight" : "High", + "numLabelsOption" : "OneLabelPerName", + "lineLabelPosition" : { + "type" : "CIMStandardLineLabelPosition", + "above" : true, + "inLine" : true, + "parallel" : true + }, + "lineLabelPriorities" : { + "type" : "CIMStandardLineLabelPriorities", + "aboveStart" : 3, + "aboveAlong" : 3, + "aboveEnd" : 3, + "centerStart" : 3, + "centerAlong" : 3, + "centerEnd" : 3, + "belowStart" : 3, + "belowAlong" : 3, + "belowEnd" : 3 + }, + "pointPlacementMethod" : "AroundPoint", + "pointPlacementPriorities" : { + "type" : "CIMStandardPointPlacementPriorities", + "aboveLeft" : 2, + "aboveCenter" : 2, + "aboveRight" : 1, + "centerLeft" : 3, + "centerRight" : 2, + "belowLeft" : 3, + "belowCenter" : 3, + "belowRight" : 2 + }, + "rotationType" : "Arithmetic", + "polygonPlacementMethod" : "AlwaysHorizontal" + }, + "textSymbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMTextSymbol", + "blockProgression" : "TTB", + "depth3D" : 1, + "extrapolateBaselines" : true, + "fontEffects" : "Normal", + "fontEncoding" : "Unicode", + "fontFamilyName" : "Tahoma", + "fontStyleName" : "Regular", + "fontType" : "Unspecified", + "haloSize" : 1, + "height" : 10, + "hinting" : "Default", + "horizontalAlignment" : "Left", + "kerning" : true, + "letterWidth" : 100, + "ligatures" : true, + "lineGapType" : "ExtraLeading", + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 0, + 0, + 0, + 100 + ] + } + } + ] + }, + "textCase" : "Normal", + "textDirection" : "LTR", + "verticalAlignment" : "Bottom", + "verticalGlyphOrientation" : "Right", + "wordSpacing" : 100, + "billboardMode3D" : "FaceNearPlane" + } + }, + "useCodedValue" : true, + "visibility" : true, + "iD" : -1 + } + ], + "renderer" : { + "type" : "CIMSimpleRenderer", + "patch" : "Default", + "symbol" : { + "type" : "CIMSymbolReference", + "symbol" : { + "type" : "CIMPolygonSymbol", + "symbolLayers" : [ + { + "type" : "CIMSolidFill", + "enable" : true, + "color" : { + "type" : "CIMRGBColor", + "values" : [ + 254, + 255, + 220, + 100 + ] + } + } + ] + } + } + }, + "scaleSymbols" : true, + "snappable" : true + } + ] +} \ No newline at end of file diff --git a/suitability/toolboxes/scripts/ImportCRU_CL2ToRaster.py b/suitability/toolboxes/scripts/ImportCRU_CL2ToRaster.py index 386baa8d..a02672d2 100644 --- a/suitability/toolboxes/scripts/ImportCRU_CL2ToRaster.py +++ b/suitability/toolboxes/scripts/ImportCRU_CL2ToRaster.py @@ -181,14 +181,14 @@ def main(): print(pymsg + "\n") print(msgs) -finally: - if debug == False and len(deleteme) > 0: - # cleanup intermediate datasets - if debug == True: arcpy.AddMessage("Removing intermediate datasets...") - for i in deleteme: - if debug == True: arcpy.AddMessage("Removing: " + str(i)) - arcpy.Delete_management(i) - if debug == True: arcpy.AddMessage("Done") + finally: + if debug == False and len(deleteme) > 0: + # cleanup intermediate datasets + if debug == True: arcpy.AddMessage("Removing intermediate datasets...") + for i in deleteme: + if debug == True: arcpy.AddMessage("Removing: " + str(i)) + arcpy.Delete_management(i) + if debug == True: arcpy.AddMessage("Done") # MAIN ============================================= if __name__ == "__main__": diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByName.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByName.atx index 0ce725b0..88585639 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByName.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByName.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx index 18928907..5c96717b 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByUUID.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByUUID.atx index 1b3c51b9..3e039fea 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByUUID.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.CatItemTypesByUUID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtable b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtable index 7ca890ff..e522680a 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtable and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtable differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtablx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtablx index f0f21f00..3de930c4 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtablx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000005.gdbtablx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx index d950b54e..1e7a1d66 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx index 5ab196dc..89622f9e 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx index 7331add5..f2de7daf 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByName.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByName.atx index 424cd602..d736d85b 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByName.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByName.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx index 2ccfbe08..122cfb78 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByUUID.atx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByUUID.atx index b804a4d2..ddef65ab 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByUUID.atx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.CatRelTypesByUUID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtable b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtable index 12d836f1..ec119fa1 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtable and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtable differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtablx b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtablx index f530534d..fb92dbc0 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtablx and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/a00000007.gdbtablx differ diff --git a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/timestamps b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/timestamps index a1696042..bdc315d5 100644 Binary files a/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/timestamps and b/suitability/toolboxes/scripts/METAR/LiveData/Metar.gdb/timestamps differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByName.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByName.atx index 0ce725b0..88585639 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByName.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByName.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx index 18928907..5c96717b 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByParentTypeID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByUUID.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByUUID.atx index 1b3c51b9..3e039fea 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByUUID.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.CatItemTypesByUUID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtable b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtable index 7ca890ff..e522680a 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtable and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtable differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtablx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtablx index f0f21f00..3de930c4 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtablx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000005.gdbtablx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx index d950b54e..1e7a1d66 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByBackwardLabel.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx index 5ab196dc..89622f9e 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByDestItemTypeID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx index 7331add5..f2de7daf 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByForwardLabel.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByName.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByName.atx index 424cd602..d736d85b 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByName.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByName.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx index 2ccfbe08..122cfb78 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByUUID.atx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByUUID.atx index b804a4d2..ddef65ab 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByUUID.atx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.CatRelTypesByUUID.atx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtable b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtable index 12d836f1..ec119fa1 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtable and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtable differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtablx b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtablx index f530534d..fb92dbc0 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtablx and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/a00000007.gdbtablx differ diff --git a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/timestamps b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/timestamps index a1696042..bdc315d5 100644 Binary files a/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/timestamps and b/suitability/toolboxes/scripts/METAR/Work/Metar.gdb/timestamps differ diff --git a/suitability/toolboxes/scripts/NAMDownload.py b/suitability/toolboxes/scripts/NAMDownload.py index ba0e211c..d8fed40c 100644 --- a/suitability/toolboxes/scripts/NAMDownload.py +++ b/suitability/toolboxes/scripts/NAMDownload.py @@ -1,228 +1,185 @@ # coding: utf-8 ''' ------------------------------------------------------------------------------ -Copyright 2015 Esri +------------------------------------------------------------------------------ +Copyright 2016 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ------------------------------------------------------------------------------ - -================================================== -NAMDownload.py --------------------------------------------------- -requirements: -* ArcGIS 10.3+ -* Python 2.7 -* Multidimension Supplemental Tools - download and install from: - http://www.arcgis.com/home/item.html?id=9f963f362fe5417f87d44618796db938 -author: ArcGIS Solutions -company: Esri -================================================== -description: -Downloads the most up to date data from the NOAA site by getting the present date. +-------------------------------------------------------------------------- + +Name: NAMDownload.py + +Description: Downloads the most up to date data from the NOAA site by getting the present date. + Script works as follow; -1. Gets the present time date in UTC -2. Uses the OPeNDAP to NetCDF tool from Multidimension Supplemental Tool -3. Downloads the specified variables into NetCDF format files and saves - them in the relative location, based on where the script file is located. -4. The present data is removed from the Mosaic Dataset -5. The new data is then loaded into the Mosaic Dataset - -================================================== -history: -9/21/2015 - AB - Original development -12/2/2015 - MF - Updates optimization and path changes -================================================== + Gets the present time date in UTC + Uses the OPeNDAP to NetCDF tool from Multidimension Supplimental Tool + Downloads the specified variables into NetCDF format files and saves them in the relative location, based on where the script file is located. + The present data is removed from the Mosaic Dataset + The new data is then loaded into the Mosiac Dataset + + +History: +9/21/2015 - ab - original coding +6/10/2016 - mf - Updates for dimension and formatting +9/12/2016 - mf - fix for Python3 not liking leading zeros ''' #Import modules -import arceditor +#import arceditor import arcpy import os import sys +import traceback import datetime from arcpy import env from datetime import datetime from datetime import time -import traceback - -# Required folder paths: -scriptsFolder = os.path.dirname(__file__) #.\solutions-geoprocessing-toolbox\suitability\toolboxes\scripts -toolboxFolder = os.path.dirname(scriptsFolder) #.\solutions-geoprocessing-toolbox\suitability\toolboxes -tooldataFolder = os.path.join(toolboxFolder, "tooldata") #.\solutions-geoprocessing-toolbox\suitability\toolboxes\tooldata -maowOperationalWeatherGeodatabase = os.path.join(tooldataFolder, "OperationalWeather.gdb") -maowDefaultGeodatabase = os.path.join(tooldataFolder, "MAOWdata.gdb") -netcdfFolder = os.path.join(tooldataFolder, "NetCDFData") -mstToolboxPath = os.path.join(scriptsFolder, - "MultidimensionSupplementalTools", - "MultidimensionSupplementalTools", - "Multidimension Supplemental Tools.pyt") - -#TODO: I'm thinking we need to redo this to let user decide where to clip the weather, and not hardcode it -extent = "-126 32 -114 43" -dimension = "time '2015-01-01 00:00:00' '2015-12-31 00:00:00'" -Raster_Type = "NetCDF" -stringDateNow = None -env.workspace = maowDefaultGeodatabase - -class NAMDownloadException(Exception): - ''' custom exception ''' - def __init__(self, msg): - ''' override init''' - if sys.exc_info()[2] != None: - msg += traceback.format_tb(sys.exc_info()[2])[0] - self.tb = msg - def __str__(self): - ''' override str ''' - return repr(self.tb) - -def checkArcPyExists(f): - ''' use ArcPy to check if geo-objects exist or not''' - return arcpy.Exists(f) - -def checkOSExists(f): - ''' use Python's os.exists to check if something exists or not''' - return os.path.exists(f) - -def removeFile(f): - ''' os.remove ''' - print("Removing " + str(f)) - if os.path.exists(f): - os.remove(f) +from datetime import timedelta + +#Gets the current directory where the script is sitting so that everything else can work off relative paths. +currentFolder = os.path.dirname(__file__) +topFolder = os.path.dirname(currentFolder) + +#Names of folders to be added to topFolder generated above +gdb = "Geodatabase" +NetCDFData = "NetCDFdata" +tls = "Tools" + +env.workspace = os.path.join(topFolder, gdb, r"MAOWdata.gdb") +env.scratchWorkspace = env.workspace + +#Declaration of variables used later +opVariables = "rh2m;tcdcclm;tmpsfc;hgtclb;vissfc;ugrd10m;vgrd10m;ugrdmwl;vgrdmwl;snodsfc;gustsfc;apcpsfc" +windVariables = "ugrd10m;vgrd10m" +geoExtent = "-126 32 -114 43" +timeDimension = "time '2016-01-01 00:00:00' '2016-12-31 00:00:00'" + +# Processing flags +REMOVE_EXISTING_RASTERS = True +DEBUG = True # Extra messaging while debugging + +def makeOutputFilePath(topFolder, NetCDFData, stringDateNow, paramFN): + '''Set output file paths for op weather and wind''' + opDataFileName = "nam%s%s.nc" % (stringDateNow, paramFN) + outputOpDataFile = os.path.join(topFolder, NetCDFData, opDataFileName) + + windDataFileName = "nam%s%sWind.nc" % (stringDateNow, paramFN) + outputWindDataFile = os.path.join(topFolder, NetCDFData, windDataFileName) + return [outputOpDataFile, outputWindDataFile] + +def makeSourceURLPath(stringDateNow, paramDL): + '''make the URL to the source forecast data''' + return r"http://nomads.ncep.noaa.gov/dods/nam/nam%s/nam%s" % (stringDateNow, paramDL) + +def download(stringDateNow, stringTimeNow, paramFN, paramDL): + '''Download NetCDF data and add to mosaic dataset''' + + if DEBUG: print ("datetime to use: %s, %s" % (stringDateNow, stringTimeNow)) + + #Import required Multidimensional tools + tbxMST = os.path.join(topFolder, tls, r"MultidimensionSupplementalTools\Multidimension Supplemental Tools.pyt") + if DEBUG: print ("Importing %s" % tbxMST) + arcpy.ImportToolbox(tbxMST) + + # Get target NetCDF data file names + outputOpDataFile, outputWindDataFile = makeOutputFilePath(topFolder, NetCDFData, stringDateNow, paramFN) + + if os.path.exists(outputOpDataFile): + print("removing existing %s" % outputOpDataFile) + os.remove(outputOpDataFile) + + if os.path.exists(outputWindDataFile): + print("removing existing %s" % outputWindDataFile) + os.remove(outputWindDataFile) + + # Get source URL path + in_url = makeSourceURLPath(stringDateNow, paramDL) + + #Run OPeNDAP to NetCDF tool + if DEBUG: + print("in_url: %s" % in_url) + print("variable: %s" % opVariables) + print("dimension: %s" % timeDimension ) + print ("OPeNDAP Tool run for Operational Weather variables...") + arcpy.OPeNDAPtoNetCDF_mds(in_url, opVariables, outputOpDataFile, geoExtent, timeDimension, "BY_VALUE") + + #Run OPeNDAP to NetCDF tool + print ("OPeNDAP Tool run for Wind variables...") + arcpy.OPeNDAPtoNetCDF_mds(in_url, windVariables, outputWindDataFile, geoExtent, timeDimension, "BY_VALUE") + + targetOpDataMosaic = os.path.join(topFolder, gdb, r"OperationalWeather.gdb\OperationalData") + targetWindDataMosaic = os.path.join(topFolder, gdb, r"OperationalWeather.gdb\OperationalWind") + + # Remove Rasters From Mosaic Dataset + if REMOVE_EXISTING_RASTERS: + print ("Removing existing rasters from Operational Weather...") + arcpy.RemoveRastersFromMosaicDataset_management(targetOpDataMosaic, "OBJECTID >=0", "NO_BOUNDARY", "NO_MARK_OVERVIEW_ITEMS", + "NO_DELETE_OVERVIEW_IMAGES", "NO_DELETE_ITEM_CACHE", "REMOVE_MOSAICDATASET_ITEMS", + "NO_CELL_SIZES") + print ("Removing existing rasters from Wind...") + arcpy.RemoveRastersFromMosaicDataset_management(targetWindDataMosaic, "OBJECTID >= 0", "UPDATE_BOUNDARY", "MARK_OVERVIEW_ITEMS", + "DELETE_OVERVIEW_IMAGES", "DELETE_ITEM_CACHE", "REMOVE_MOSAICDATASET_ITEMS", + "UPDATE_CELL_SIZES") + + # Add Rasters To Mosaic Dataset + print ("Adding new rasters from Operational Weather...") + arcpy.AddRastersToMosaicDataset_management(targetOpDataMosaic, "NetCDF", outputOpDataFile, "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", + "NO_OVERVIEWS", "", "0", "1500", "", "*.nc", "SUBFOLDERS", "ALLOW_DUPLICATES", + "NO_PYRAMIDS", "NO_STATISTICS", "NO_THUMBNAILS", "", "NO_FORCE_SPATIAL_REFERENCE") + print ("Adding new rasters from Wind...") + arcpy.AddRastersToMosaicDataset_management(targetWindDataMosaic, "NetCDF", outputWindDataFile, "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", + "NO_OVERVIEWS", "", "0", "1500", "", "*.nc", "SUBFOLDERS", "ALLOW_DUPLICATES", + "NO_PYRAMIDS", "NO_STATISTICS", "NO_THUMBNAILS", "", "NO_FORCE_SPATIAL_REFERENCE") return -def urlToFile(url, variable, dfile): - ''' Get netcdf data from OPeNDAP URL ''' - try: - print("Getting data from: " + str(url)) - arcpy.OPeNDAPtoNetCDF_mds(url, variable, dfile, extent, dimension, "BY_VALUE") - return True - except NAMDownloadException as e: - print("Error in urlToFile: \n" + str(e.tb)) - -def removeFromMosaics(data): - ''' remove rasters from mosaic dataset ''' - base = os.path.basename(data) - print("Removing existing mosaics from: " + str(base)) - try: - if base == "OperationalData": - arcpy.RemoveRastersFromMosaicDataset_management(data, - "OBJECTID >=0", - "NO_BOUNDARY", - "NO_MARK_OVERVIEW_ITEMS", - "NO_DELETE_OVERVIEW_IMAGES", - "NO_DELETE_ITEM_CACHE", - "REMOVE_MOSAICDATASET_ITEMS", - "NO_CELL_SIZES") - return True - elif base == "OperationalWind": - arcpy.RemoveRastersFromMosaicDataset_management(data, - "OBJECTID >= 0", - "UPDATE_BOUNDARY", - "MARK_OVERVIEW_ITEMS", - "DELETE_OVERVIEW_IMAGES", - "DELETE_ITEM_CACHE", - "REMOVE_MOSAICDATASET_ITEMS", - "UPDATE_CELL_SIZES") - return True - else: - return False - except NAMDownloadException as e: - print("Error in removeFromMosaics: \n" + str(e.tb)) - -def addMosaics(data, dfile): - ''' Add data to mosaic dataset ''' - print("Adding new data to mosaic") +def main(): + '''Decide which time period to download''' try: - arcpy.AddRastersToMosaicDataset_management(data, Raster_Type, dfile, - "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", - "NO_OVERVIEWS", "", - "0", "1500", - "", "*.nc", - "SUBFOLDERS", "ALLOW_DUPLICATES", - "NO_PYRAMIDS", "NO_STATISTICS", - "NO_THUMBNAILS", "", - "NO_FORCE_SPATIAL_REFERENCE") - return True - except NAMDownloadException as e: - print("Error in addMosaics: \n" + str(e.tb)) - -def process(url, variable, dfile, data): - ''' Combine processes for base and wind data ''' - try: - if not urlToFile(url, variable, dfile): - raise - if not removeFromMosaics(data): - raise - if not addMosaics(data, dfile): - raise - return True - except NAMDownloadException as e: - print("Error in process: \n" + str(e.tb)) - -def download(paramFN, paramDL): - ''' main work method ''' - try: - print("Working on time index: " + str(paramFN)) - #Multidimension Supplemental Tools are required! - arcpy.ImportToolbox(mstToolboxPath, "mds") - - #Get present date + now_time = time(int(datetime.utcnow().strftime("%H")), int(datetime.utcnow().strftime("%M")), int(datetime.utcnow().strftime("%S"))) + print("UTC time is (now_time): %s" % now_time) + patternDate = '%Y%m%d' - global stringDateNow - if stringDateNow == None: - stringDateNow = datetime.utcnow().strftime(patternDate) - print("Target date: " + str(stringDateNow)) - - noaaURLBase = r"http://nomads.ncep.noaa.gov/dods/nam/nam%s/nam" + paramDL - noaaURL = noaaURLBase % stringDateNow - #filename = "nam%s1hr00z.nc" % stringDateNow - - print("Building forecast data...") - netcdfDataFileBase = os.path.join(netcdfFolder, r"nam%s" + paramFN + ".nc") % stringDateNow - if checkOSExists(netcdfDataFileBase): - print("deleting existing " + str(netcdfDataFileBase)) - removeFile(netcdfDataFileBase) - forecastVariable = r"rh2m;tcdcclm;tmpsfc;hgtclb;vissfc;ugrd10m;vgrd10m;ugrdmwl;vgrdmwl;snodsfc;gustsfc;apcpsfc" - operationalData = os.path.join(maowOperationalWeatherGeodatabase, "OperationalData") - result = process(noaaURL, forecastVariable, netcdfDataFileBase, operationalData) - - print("Building wind data...") - netcdfWindFileBase = os.path.join(netcdfFolder, r"nam%s" + paramFN + "Wind.nc") % stringDateNow - if checkOSExists(netcdfWindFileBase): - print("deleting existing " + str(netcdfWindFileBase)) - removeFile(netcdfWindFileBase) - windVariable = r"ugrd10m;vgrd10m" - operationalWind = os.path.join(maowOperationalWeatherGeodatabase, "OperationalWind") - result = process(noaaURL, windVariable, netcdfWindFileBase, operationalWind) - - print("Done.") - - except NAMDownloadException as e: - print("Error in main: \n" + str(e.tb)) - -# get the present time in utc. -# set times are set around the times that the data is released by NOAA -now_time = time(int(datetime.utcnow().strftime("%H")), - int(datetime.utcnow().strftime("%M")), - int(datetime.utcnow().strftime("%S"))) -print("Now time: " + str(now_time)) -if now_time >= time(2, 50, 00) and now_time < time(8, 50, 00): - download("1hr00z", "1hr_00z") - -elif now_time >= time(8, 50, 00) and now_time < time(14, 50, 00): - download("1hr06z", "1hr_06z") - -elif now_time >= time(14, 50, 00) and now_time < time(21, 00, 00): - download("1hr12z", "1hr_12z") - -elif ((now_time >= time(21, 00, 00) and now_time <= time(23, 59, 59)) or (now_time >= time(00, 00, 00) and now_time <= time(2, 49, 59))): - download("1hr18z", "1hr_18z") + patternTime = '%H:%M:%S' + stringDateNow = datetime.utcnow().strftime(patternDate) + stringTimeNow = datetime.utcnow().strftime(patternTime) + + if now_time >= time(2,50,00) and now_time < time(8,50,00): + print("Going to download 1hr_00z...") + download(stringDateNow, stringTimeNow,"1hr00z", "1hr_00z") + + elif now_time >= time(8,50,00) and now_time < time(14,50,00): + print("Going to download 1hr_06z...") + download(stringDateNow, stringTimeNow,"1hr06z", "1hr_06z") + + elif now_time >= time(14,50,00) and now_time < time(21,00,00): + print("Going to download 1hr_12z...") + download(stringDateNow, stringTimeNow,"1hr12z", "1hr_12z") + + elif (now_time >= time(21,00,00) and now_time <= time(23,59,59)): + print("Going to download 1hr_18z...") + download(stringDateNow, stringTimeNow,"1hr18z", "1hr_18z") + + elif (now_time >= time(00,00,00) and now_time <= time(2,49,59)): + # Get yesterday's forecast, because today's isn't + # published yet: + stringDateNow = (datetime.utcnow() - timedelta(days=1)).strftime(patternDate) + print("Going to download 1hr_18z for %s..." % stringDateNow) + download(stringDateNow, stringTimeNow,"1hr18z", "1hr_18z") + print("Done.") + except: + tb = sys.exc_info()[2] + tbinfo = traceback.format_tb(tb)[0] + pymsg = "ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) + print(pymsg + "\n") + sys.exit(1) + +# MAIN ============================================= +if __name__ == "__main__": + main() diff --git a/suitability/toolboxes/scripts/NAMDownloadBatch.bat b/suitability/toolboxes/scripts/NAMDownloadBatch.bat index 9e185158..0602cef6 100644 --- a/suitability/toolboxes/scripts/NAMDownloadBatch.bat +++ b/suitability/toolboxes/scripts/NAMDownloadBatch.bat @@ -1,53 +1,30 @@ ECHO off -rem ----------------------------------------------------------------------------- -rem Copyright 2015 Esri + +rem Copyright 2016 Esri rem Licensed under the Apache License, Version 2.0 (the "License"); rem you may not use this file except in compliance with the License. rem You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem +rem http://www.apache.org/licenses/LICENSE-2.0 rem Unless required by applicable law or agreed to in writing, software rem distributed under the License is distributed on an "AS IS" BASIS, rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem See the License for the specific language governing permissions and rem limitations under the License. -rem ----------------------------------------------------------------------------- -rem -rem ================================================== -rem NAMDownloadBatch.bat -rem -------------------------------------------------- -rem requirements: -rem * ArcGIS 10.3+ -rem * Python 2.7 -rem * Multidimension Supplemental Tools - download and install from: -rem http://www.arcgis.com/home/item.html?id=9f963f362fe5417f87d44618796db938 -rem author: ArcGIS Solutions -rem company: Esri -rem ================================================== -rem description: -rem Runs the NAMDownload.py -rem -rem ================================================== -rem history: -rem 9/21/2015 - AB - Original development -rem 12/3/2015 - MF - Updates for standards -rem ================================================== - -ECHO on REM Runs the Python update scripts needed - -ECHO(>> %~dp0\DataDownload.txt -ECHO -------------------------------------------------------------------------------------------------------------------------------->> %~dp0\DataDownload.txt ECHO(>> %~dp0\DataDownload.txt ECHO Started NAM data Transfer %Time% %Date%>> %~dp0\DataDownload.txt -python.exe .\NAMDownload.py -timeout /t 60 +CALL python C:\MAOW\Scripts\NAMDownload.py +IF %ERRORLEVEL% NEQ 0 ( + ECHO 'NAMDownload script had errors' +) + +timeout /t 60 ECHO(>> %~dp0\DataDownload.txt ECHO Finished NAM Data Transfer %Time% %Date% >> %~dp0\DataDownload.txt REM PAUSE + diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.TablesByName.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.TablesByName.atx index 4d75a079..930d6371 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.TablesByName.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.TablesByName.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.freelist b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.freelist new file mode 100644 index 00000000..25a72e27 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.freelist differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtable index 0edcc8bd..e2118879 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtable and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtablx index 463aae1c..eaf1e1a7 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtablx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000001.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByPhysicalName.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByPhysicalName.atx index 234ce603..19e99cfe 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByPhysicalName.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByPhysicalName.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByType.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByType.atx index ebe492fe..641f1d22 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByType.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.CatItemsByType.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.FDO_UUID.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.FDO_UUID.atx index c0314f85..3162fe8b 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.FDO_UUID.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.FDO_UUID.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.freelist b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.freelist index 93edf4fa..a8c95ce7 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.freelist and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.freelist differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtable index 57d07e5c..c6053877 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtable and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtablx index 0c7dfa35..8565650f 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtablx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.spx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.spx index 5d24c295..cbccbd06 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.spx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000004.spx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByDestinationID.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByDestinationID.atx index 63d46847..944f890e 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByDestinationID.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByDestinationID.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByOriginID.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByOriginID.atx index a0f07375..acfb03e0 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByOriginID.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByOriginID.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByType.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByType.atx index cb915183..bae453e6 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByType.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.CatRelsByType.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.FDO_UUID.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.FDO_UUID.atx index 5e4a7256..3fb586c4 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.FDO_UUID.atx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.FDO_UUID.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.freelist b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.freelist new file mode 100644 index 00000000..816c632e Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.freelist differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtable index 4926a29a..b7bdd83b 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtable and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtablx index e28936d3..aae18aa1 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtablx and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000006.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbindexes new file mode 100644 index 00000000..c9d0caa2 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbtable new file mode 100644 index 00000000..16381711 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbtablx new file mode 100644 index 00000000..10250146 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.spx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.spx new file mode 100644 index 00000000..d90b1624 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000001c.spx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbindexes new file mode 100644 index 00000000..8211a233 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbtable new file mode 100644 index 00000000..2899f1fa Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbtablx new file mode 100644 index 00000000..26795447 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.spx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.spx new file mode 100644 index 00000000..c3725b56 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000061.spx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbindexes new file mode 100644 index 00000000..240144ef Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbtable new file mode 100644 index 00000000..edec7315 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbtablx new file mode 100644 index 00000000..b48fa99a Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000062.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.freelist b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.freelist new file mode 100644 index 00000000..e5d57de5 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.freelist differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbindexes new file mode 100644 index 00000000..0449ced6 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbtable new file mode 100644 index 00000000..f16b5278 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbtablx new file mode 100644 index 00000000..0fc6e307 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000063.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.band_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.band_index.atx new file mode 100644 index 00000000..1b984b82 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.band_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.blk_key_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.blk_key_index.atx new file mode 100644 index 00000000..68e374a6 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.blk_key_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.col_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.col_index.atx new file mode 100644 index 00000000..7e901ec7 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.col_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbindexes new file mode 100644 index 00000000..03156009 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbtable new file mode 100644 index 00000000..bc9945ab Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbtablx new file mode 100644 index 00000000..bab8d352 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.row_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.row_index.atx new file mode 100644 index 00000000..12322ffa Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000064.row_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbindexes new file mode 100644 index 00000000..142048fb Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbtable new file mode 100644 index 00000000..bb111c1c Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbtablx new file mode 100644 index 00000000..b9e69956 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000065.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbindexes new file mode 100644 index 00000000..0449ced6 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbtable new file mode 100644 index 00000000..b42bd63a Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbtablx new file mode 100644 index 00000000..da6702e0 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000066.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbindexes new file mode 100644 index 00000000..8211a233 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbtable new file mode 100644 index 00000000..200a9013 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbtablx new file mode 100644 index 00000000..26795447 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.spx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.spx new file mode 100644 index 00000000..c3725b56 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000078.spx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbindexes new file mode 100644 index 00000000..240144ef Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbtable new file mode 100644 index 00000000..7b591cd6 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbtablx new file mode 100644 index 00000000..b48fa99a Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000079.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.freelist b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.freelist new file mode 100644 index 00000000..e5d57de5 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.freelist differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbindexes new file mode 100644 index 00000000..0449ced6 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbtable new file mode 100644 index 00000000..81336c99 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbtablx new file mode 100644 index 00000000..0fc6e307 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007a.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.band_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.band_index.atx new file mode 100644 index 00000000..5a3a7f7e Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.band_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.blk_key_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.blk_key_index.atx new file mode 100644 index 00000000..299523fd Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.blk_key_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.col_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.col_index.atx new file mode 100644 index 00000000..d99228c7 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.col_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbindexes new file mode 100644 index 00000000..03156009 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbtable new file mode 100644 index 00000000..575308ef Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbtablx new file mode 100644 index 00000000..58289ebf Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.row_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.row_index.atx new file mode 100644 index 00000000..f2e5ca2b Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007b.row_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbindexes new file mode 100644 index 00000000..142048fb Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbtable new file mode 100644 index 00000000..7d0b6432 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbtablx new file mode 100644 index 00000000..b9e69956 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007c.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbindexes new file mode 100644 index 00000000..c9d0caa2 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbtable new file mode 100644 index 00000000..34e5fedb Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbtablx new file mode 100644 index 00000000..10b7abda Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.spx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.spx new file mode 100644 index 00000000..7c407bc1 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007d.spx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbindexes new file mode 100644 index 00000000..8211a233 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbtable new file mode 100644 index 00000000..fa6402d3 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbtablx new file mode 100644 index 00000000..26795447 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.spx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.spx new file mode 100644 index 00000000..6d236bde Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007e.spx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbindexes new file mode 100644 index 00000000..240144ef Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbtable new file mode 100644 index 00000000..ddbf6585 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbtablx new file mode 100644 index 00000000..b48fa99a Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000007f.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.freelist b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.freelist new file mode 100644 index 00000000..7027e467 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.freelist differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbindexes new file mode 100644 index 00000000..0449ced6 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbtable new file mode 100644 index 00000000..aba65262 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbtablx new file mode 100644 index 00000000..26829d46 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000080.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.band_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.band_index.atx new file mode 100644 index 00000000..a7b9dc3e Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.band_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.blk_key_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.blk_key_index.atx new file mode 100644 index 00000000..07d4f734 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.blk_key_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.col_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.col_index.atx new file mode 100644 index 00000000..19a0c4ee Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.col_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbindexes new file mode 100644 index 00000000..03156009 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbtable new file mode 100644 index 00000000..cdfc5c75 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbtablx new file mode 100644 index 00000000..07c9f6ae Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.row_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.row_index.atx new file mode 100644 index 00000000..96509589 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000081.row_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbindexes new file mode 100644 index 00000000..142048fb Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbtable new file mode 100644 index 00000000..dd04bb57 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbtablx new file mode 100644 index 00000000..b9e69956 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000082.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbindexes new file mode 100644 index 00000000..240144ef Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbtable new file mode 100644 index 00000000..e180f45d Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbtablx new file mode 100644 index 00000000..b48fa99a Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000085.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.freelist b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.freelist new file mode 100644 index 00000000..e8d16899 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.freelist differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbindexes new file mode 100644 index 00000000..0449ced6 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbtable new file mode 100644 index 00000000..aaeaaf8d Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbtablx new file mode 100644 index 00000000..1ae017fb Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000086.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.band_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.band_index.atx new file mode 100644 index 00000000..a7b9dc3e Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.band_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.blk_key_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.blk_key_index.atx new file mode 100644 index 00000000..07d4f734 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.blk_key_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.col_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.col_index.atx new file mode 100644 index 00000000..19a0c4ee Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.col_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbindexes new file mode 100644 index 00000000..03156009 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbtable new file mode 100644 index 00000000..b9d897c8 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbtablx new file mode 100644 index 00000000..673e387b Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.row_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.row_index.atx new file mode 100644 index 00000000..96509589 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000087.row_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbindexes new file mode 100644 index 00000000..142048fb Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbtable new file mode 100644 index 00000000..d1f0f83f Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbtablx new file mode 100644 index 00000000..b9e69956 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a00000088.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.band_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.band_index.atx new file mode 100644 index 00000000..1a2ed7f2 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.band_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.blk_key_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.blk_key_index.atx new file mode 100644 index 00000000..431bd37e Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.blk_key_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.col_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.col_index.atx new file mode 100644 index 00000000..7eabf7bc Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.col_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbindexes new file mode 100644 index 00000000..03156009 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbtable new file mode 100644 index 00000000..ed9c9027 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbtablx new file mode 100644 index 00000000..b57701e7 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.row_index.atx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.row_index.atx new file mode 100644 index 00000000..f4330f50 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008c.row_index.atx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbindexes b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbindexes new file mode 100644 index 00000000..142048fb Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbindexes differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbtable b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbtable new file mode 100644 index 00000000..214ca033 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbtable differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbtablx b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbtablx new file mode 100644 index 00000000..b9e69956 Binary files /dev/null and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/a0000008d.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/timestamps b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/timestamps index 531f5f69..d4aafe9d 100644 Binary files a/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/timestamps and b/suitability/toolboxes/tooldata/Maritime Decision Aid Tools.gdb/timestamps differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByName.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByName.atx index c13f7c0d..12de721b 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByName.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByName.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByParentTypeID.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByParentTypeID.atx index bd53e3b9..b81135ad 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByParentTypeID.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByParentTypeID.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByUUID.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByUUID.atx index 81e7607c..53ea701f 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByUUID.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.CatItemTypesByUUID.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtable b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtable index 47d52342..2a8ffe5e 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtable and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtable differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtablx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtablx index 28b6b96e..f2f9a6c8 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtablx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000005.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByBackwardLabel.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByBackwardLabel.atx index 64857741..f20ced57 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByBackwardLabel.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByBackwardLabel.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByDestItemTypeID.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByDestItemTypeID.atx index d738558b..568e4005 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByDestItemTypeID.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByDestItemTypeID.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByForwardLabel.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByForwardLabel.atx index 28f19455..6f0c6131 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByForwardLabel.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByForwardLabel.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByName.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByName.atx index 52a86a44..f0e49df1 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByName.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByName.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx index 0ba4ed3d..4f1e32ab 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByOriginItemTypeID.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByUUID.atx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByUUID.atx index 37e3c309..dd4b5313 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByUUID.atx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.CatRelTypesByUUID.atx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtable b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtable index 21ed2a55..0595143f 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtable and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtable differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtablx b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtablx index 201fb22d..7a12f98a 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtablx and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/a00000007.gdbtablx differ diff --git a/suitability/toolboxes/tooldata/OperationalWeather.gdb/timestamps b/suitability/toolboxes/tooldata/OperationalWeather.gdb/timestamps index 6b13c74f..c960a99c 100644 Binary files a/suitability/toolboxes/tooldata/OperationalWeather.gdb/timestamps and b/suitability/toolboxes/tooldata/OperationalWeather.gdb/timestamps differ diff --git a/utils/test/Configuration.py b/utils/test/Configuration.py new file mode 100644 index 00000000..0c9374d7 --- /dev/null +++ b/utils/test/Configuration.py @@ -0,0 +1,92 @@ +''' +------------------------------------------------------------------------------ +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- +Configuration.py +Description: Common objects/methods used by test scripts +Requirements: ArcGIS Desktop Standard + +data URL pattern: r"http://www.arcgis.com/sharing/content/items/XXX/data", where XXX is the item GUID + ---------------------------------------------------------------------------- +''' + +import os + +DEBUG = True # this guy is a flag for extra messaging while debugging tests + +#NOTE: Logger and Platform are initialized in TestRunner's main() +Logger = None +Platform = None + +''' Testing paths ''' +currentPath = os.path.dirname(__file__) # should go to .\solutions-geoprocessing-toolbox\utils\test +repoPath = os.path.dirname(os.path.dirname(currentPath)) + +''' Log Path: the folder where the log files go wild and multiply ''' +logPath = os.path.normpath(os.path.join(currentPath, r"log")) # should go to .\solutions-geoprocessing-toolbox\utils\test\log + +''' Capability Paths''' +capabilityPath = os.path.normpath(os.path.join(currentPath, r"capability_tests")) + +pooURL = r"http://www.arcgis.com/sharing/content/items/9d8a534a70d54a74911d9ddb60b5a1d9/data" + +''' Data Management Paths ''' +dataManagementPaths = os.path.normpath(os.path.join(currentPath, r"data_management_tests")) +geonamesURL = r"http://www.arcgis.com/sharing/content/items/afc766d5276648ab80aa85b819af1ffc/data" +networkPrepURL = r"http://www.arcgis.com/sharing/content/items/cf09da3684214d2b9b18c22149130fc4/data" +patrolDataCaptureURL = r"http://www.arcgis.com/sharing/content/items/853736d171e44a40a55e4c312bf43b66/data" +importAndConversionURL = r"http://www.arcgis.com/sharing/content/items/130f52ac95a040cb80717d99db100409/data" +publishableTasksURL = r"http://www.arcgis.com/sharing/content/items/921fc6d5f5e2444dab14831edc01ef9d/data" + +''' Operational Graphics Paths ''' +operationalGraphicsPaths = os.path.normpath(os.path.join(currentPath, r"operational_graphics_tests")) +clearingOperationsURL = r"http://www.arcgis.com/sharing/content/items/198f01e263474c209198c9c3c3586287/data" +sunPositionAnalysisURL = r"http://www.arcgis.com/sharing/content/items/bf6a04b4c9a3447b91e9c0b4074ca1e4/data" +rangeCardURL = r"http://www.arcgis.com/sharing/content/items/f5414250daf14dd389cc50199efeef8d/data" + + +''' Patterns Paths ''' +patternsPaths = os.path.normpath(os.path.join(currentPath, r"patterns_tests")) +incidentDataPath = None +incidentInputGDB = None +incidentResultGDB = None +incidentScratchGDB = None +patterns_ToolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../patterns/toolboxes/")) +patterns_ProToolboxPath = os.path.normpath(os.path.join(patterns_ToolboxesPath, "Incident Analysis Tools.tbx")) +patterns_DesktopToolboxPath = os.path.normpath(os.path.join(patterns_ToolboxesPath, "Incident Analysis Tools_10.4.tbx")) +incidentURL = "http://www.arcgis.com/sharing/content/items/528faf6b23154b04a8268b33196fa9ad/data" +incidentGDBName = "test_incident_analysis_tools.gdb" +incidentResultGDBName = "test_incident_analysis_results.gdb" + +''' Suitability Paths ''' +suitabilityPaths = os.path.normpath(os.path.join(currentPath, r"suitability_tests")) +suitabilityDataPath = None +suitability_ToolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../suitability/toolboxes/")) +maritimeDataPath = None +maritimeScratchGDB = None +maow_ToolboxPath = os.path.join(suitability_ToolboxesPath, "Military Aspects of Weather Tools_10.4.tbx") +maotURL = r"http://www.arcgis.com/sharing/content/items/127bff2341694342a6df884aaa51237e/data" +maowURL = "http://www.arcgis.com/sharing/content/items/74eeb356c7dd4422bf52f36f38bb8a9b/data" +maritime_DesktopToolboxPath = os.path.join(suitability_ToolboxesPath, "Maritime Decision Aid Tools_10.4.tbx") +maritime_ProToolboxPath = os.path.join(suitability_ToolboxesPath, "Maritime Decision Aid Tools.tbx") +maritimeURL = "http://www.arcgis.com/sharing/content/items/43fbe3e823614783a391676d47dd3c5f/data" +maritimeGDBName = "MaritimeDecisionAidToolsTestData" +pathSlopeURL = r"http://www.arcgis.com/sharing/content/items/cbb812326b6f4fb2b77cac4a85e734a9/data" + +''' Visibility Paths ''' +visibilityPaths = os.path.normpath(os.path.join(currentPath, r"visibility_tests")) +vis_ToolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../visibility/toolboxes/")) + + + diff --git a/utils/test/DataDownload.py b/utils/test/DataDownload.py new file mode 100644 index 00000000..a470a65a --- /dev/null +++ b/utils/test/DataDownload.py @@ -0,0 +1,94 @@ +#------------------------------------------------------------------------------ +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#----------------------------------------------------------------------------- +# DataDownload.py +# Description: This script downloads sample data from ArcGIS Online, temporarily +# saves the zip file, extracts the zip to the target location, then deletes the +# temporary zip file. +# Requirements: ArcGIS Desktop Standard +# ---------------------------------------------------------------------------- +# +# ================================================== +# history: +# 12/01/2015 - JH - creation +# ================================================== + +import arcpy +import os +import sys +import logging +import zipfile +import UnitTestUtilities +import Configuration + +def createDataFolder(path): + ''' If it doesn't already exist, create a 'data' sub-directory in the path ''' + dataPath = os.path.normpath(os.path.join(path, r"data")) + if not os.path.exists(dataPath): + os.makedirs(dataPath) + return dataPath + +def createFGDB(gPath): + ''' Create a file geodatabase from the input path. Path should include the file geodatabase name like: + \...\\.gdb''' + result = arcpy.CreateFileGDB_management(os.path.dirname(gPath), os.path.basename(gPath),"CURRENT") + if result.maxSeverity > 1: + arcpy.AddError("ERROR (DataDownload.createFileGDB): " + str(result.getMessages())) + return None + else: + return path + +def saveOnlineDataAsZip(url, zipName): + ''' Save the zip file from the specified url to the current directory, passing in ''' + ''' the name to use for the saved zip file ''' + try: + # Python 2 + import urllib + (zipFile, headers) = urllib.urlretrieve(url, zipName) + return zipFile + except: + # Python 3 + import urllib.request + (zipFile, headers) = urllib.request.urlretrieve(url, zipName) + return zipFile + +def extractDataZip(zip, path): + ''' Extract zip file data into the given path ''' + with zipfile.ZipFile(zip) as f: + f.extractall(path) + +def deleteZip(tempFile): + ''' Delete the data zip file ''' + os.remove(tempFile) + +def runDataDownload(basePath, gdbName, url): + ''' Download and extract the geodatabase with specified gdbName from the given url to the basePath's data folder ''' + dataPath = createDataFolder(basePath) + gdbPath = os.path.normpath(os.path.join(dataPath, gdbName)) + exists = UnitTestUtilities.folderPathsExist([gdbPath]) + + if not exists: + zipName = gdbName + ".zip" + print("Zip Name: " + zipName) + zipFile = saveOnlineDataAsZip(url, zipName) + print("Extracting zip...") + extractDataZip(zipFile, dataPath) + print("Deleting zip...") + deleteZip(zipFile) + message = "Downloaded {0} to {1}".format(gdbName, dataPath) + print(message) + Configuration.Logger.info(message) + + return dataPath + \ No newline at end of file diff --git a/utils/test/Readme.md b/utils/test/Readme.md new file mode 100644 index 00000000..2b87f868 --- /dev/null +++ b/utils/test/Readme.md @@ -0,0 +1,67 @@ +# Running tests for solutions-geoprocessing-toolbox + +## Sections +* [Introduction](#introduction) +* [Requirements](#requirements) + * [For ArcGIS Pro](#for-arcgis-pro) + * [For ArcGIS Desktop](#for-arcgis-desktop) +* [Running the tests](#running-the-tests) +* [Log files](#log-files) +* [Reporting errors as Issues](#reporting-errors-as-issues) + +## Introduction +The unittests in this section of the repository are designed to test the geoprocessing tools contained within to make sure they are running consistently under different conditions. Automated testing, unittests are one type, help reduce the amount of time necessary to find defects or confirm their success. An automated test can run all of the tools in a significantly shorter amount of time than several people testing the tools manually. This should not be taken as an opportunity to skip other types of testing (ad-hoc, defect verification, template testing, system testing, etc.). + +## Requirements +### For ArcGIS Pro +* ArcGIS Pro 1.1+ +* Python 3.4.1 for ArcGIS Pro + +### For ArcGIS Desktkop +* ArcGIS for Desktop 10.3.1+ +* Python 2.7+ + +## Running the tests +The goal is to run the test suites for all of the tools against different versions of operating systems and versions of Python/ArcGIS. + +1. Check your Python versions. You need to have at least ONE of two required versions listed above. +2. Modify [**TestKickStart.bat** ](./TestKickStart.bat)to run tests for the versions you have installed. This will mean you must modify the path to the python.exe in *TestKickStart.bat*. +3. Open a command prompt in *.\solutions-geoprocessing-toolbox\utils\test*. +4. Run **TestKickStart.bat** +5. Check the dialog for results and check the log file created by the tests. + +## Log files +The output from running the tests are stored in the *.\solutions-geoprocessing-toolbox\utils\test\log* folder. The files are named: + + SGT_YYYY-Month-DD_HH-MM-SS_seqX.log + +where: + +* YYYY - Four digit year +* Month - American English name of month +* DD - Two digit day of the month (01 - 31) +* HH - Two digit hour of the day in 24-hour format (00 - 23) +* MM - Two digit minute of the hour (00 - 59) +* SS - Two digit second of the minute (00 - 59) +* X - sequence number, if for reason two log files are created in the same exact second. Unlikely, but just in case. + +For example: + + SGT_2015-November-05_08-31-22_seq0.log + +This log file was created November 5th, 2015 at 8:31:22 AM and was the first log file created at that time. + +## Reporting errors as Issues +Any errors or problems need to be reported. If they go unmentioned, then they go unfixed. All issues should be logged in the solutions-geoprocessing-repository [Issues](https://github.com/Esri/solutions-geoprocessing-toolbox/issues). + +1. First you should check the existing Issues to see if there is one already logged for the issue you found. If you find one that is the same or similar, please add a comment to it with the information in step 4 below. +2. Check the information you've collected. Make sure you've got a clear idea of what is happening, what you expected, and how the tool is expected to work. +3. Start a new issue and include the following information. + 1. Add a good description of the problem. It should answer: + 1. What tool were you using, what inputs did you use (be specific)? + 2. What happened? + 3. What did you expect to happen? + 2. Numbered steps to reproduce the problem + 3. Add a copy of the full error message + 4. Include a copy of the log file +5. Assign to the repository owner. diff --git a/utils/test/TestKickStart.bat b/utils/test/TestKickStart.bat index fc65a4c3..ae9a40d1 100644 --- a/utils/test/TestKickStart.bat +++ b/utils/test/TestKickStart.bat @@ -1,11 +1,86 @@ +@ECHO OFF +rem ------------------------------------------------------------------------------ +rem Copyright 2015 Esri +rem Licensed under the Apache License, Version 2.0 (the "License"); +rem you may not use this file except in compliance with the License. +rem You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. +rem ------------------------------------------------------------------------------ +rem TestKickStart.bat +rem ------------------------------------------------------------------------------ +rem requirements: +rem * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +rem * Python 2.7 or Python 3.4 +rem author: ArcGIS Solutions +rem company: Esri +rem ================================================== +rem description: +rem This file starts the test running for Desktop (Python 2.7+) and +rem ArcGIS Pro (Python 3.4+). +rem +rem ================================================== +rem history: +rem 10/06/2015 - MF - placeholder +rem 10/30/2015 - MF - tests running +rem 12/01/2015 - JH - added parameter for default log file name +rem 07/05/2016 - MF - updates to changes for Pro 1.3+ +rem 02/24/2017 - MF - more updates for Pro 1.4.1/ArcMap 10.5 +rem ================================================== -@ECHO ON +REM === TEST SETUP =================================== +REM === TEST SETUP =================================== -REM ECHO Python 2.7 Tests =============================== -REM py -2.7 TestRunner.py -REM ECHO Python 3.4 Tests =============================== -REM py -3.4 TestRunner.py +REM === LOG SETUP ==================================== +REM usage: set LOG= +REM name is optional; if not specified, name will be specified for you +set LOG= +REM === LOG SETUP ==================================== + +REM === SINGLE VERSION ================================== +REM If you only have ONE version of Python installed +REM uncomment the following lines of code +REM ===================================================== +REM python TestRunner.py +REM IF %ERRORLEVEL% NEQ 0 ( +REM ECHO 'One or more tests failed' +REM ) +REM === SINGLE VERSION ================================== + + + +REM === MULTIPLE VERSIONS =============================== +REM If you have BOTH versions of Python installed use +REM these lines +REM ===================================================== +ECHO Python 3.4 Tests =============================== +REM py -3.4 TestRunner.py %LOG% +REM The location of python.exe will depend upon your installation +REM of ArcGIS Pro. Modify the following line as necessary: +"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" TestRunner.py %LOG% +REM check if ArcGIS Pro/Python 3.4 tests failed +IF %ERRORLEVEL% NEQ 0 ( + ECHO 'One or more tests failed' +) +ECHO Python 2.7 Tests =============================== +REM The location of python.exe will depend upon your installation +REM of Python 2.x. Modify the following line as necessary: +"C:\Python27\ArcGIS10.5\python.exe" TestRunner.py %LOG% +REM check if Desktop for ArcGIS/Python 2.7 tests failed +IF %ERRORLEVEL% NEQ 0 ( + ECHO 'One or more tests failed' +) +REM === MULTIPLE VERSIONS =============================== + + +REM === CLEANUP ========================================= +REM === CLEANUP ========================================= -python TestRunner.py pause diff --git a/utils/test/TestRunner.py b/utils/test/TestRunner.py index a011e497..2fdd2f05 100644 --- a/utils/test/TestRunner.py +++ b/utils/test/TestRunner.py @@ -1,56 +1,183 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TestRunner.py -#------------------------------------------------------------------------------ +# coding: utf-8 +''' +------------------------------------------------------------------------------ + Copyright 2015 Esri + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------------------------------------------------------------------------------ + TestRunner.py +------------------------------------------------------------------------------ + requirements: + * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ + * Python 2.7 or Python 3.4 + author: ArcGIS Solutions + company: Esri +================================================== + description: + This test suite collects all of the capability toolbox test suites: + * HelicopterLandingZoneToolsTestSuite.py + * ERGToolsTestSuite.py + * PointOfOriginToolsTestSuite.py + +================================================== + history: + 10/06/2015 - MF - placeholder + 10/30/2015 - MF - tests running +================================================== +''' import os import sys import datetime import logging import unittest -import TestUtilities +import arcpy +import Configuration import UnitTestUtilities +import DataDownload -def main(): - logger = UnitTestUtilities.initializeLogger("Base") - UnitTestUtilities.setUpLogFileHeader(logger) - runTestSuite() +logFileFromBAT = None +if len(sys.argv) > 1: + logFileFromBAT = sys.argv[1] #if we have an explicit log file name passed in + +def main(): + ''' main test logic ''' + if Configuration.DEBUG == True: + print("TestRunner.py - main") + else: + print("Debug messaging is OFF") -# def addPatternsTests(suite): - # #suite.addTest(PatternToolOneTestCase('test_name')) - # return suite + # setup logger + logName = None + if not logFileFromBAT == None: + logName = logFileFromBAT + Configuration.Logger = UnitTestUtilities.initializeLogger(logFileFromBAT) + else: + logName = UnitTestUtilities.getLoggerName() + Configuration.Logger = UnitTestUtilities.initializeLogger(logName) + print("Logging results to: " + str(logName)) + UnitTestUtilities.setUpLogFileHeader() -def addVisibilityTests(suite): - suite.addTest(SunPositionAndHillshadeTestCase('test_sun_position_analysis')) - suite.addTest(FindLocalPeaksTestCase('test_local_peaks')) - return suite + result = runTestSuite() + logTestResults(result) + print("END OF TEST =========================================\n") + return + +def logTestResults(result): + ''' Write the log file ''' + resultHead = resultsHeader(result) + print(resultHead) + Configuration.Logger.info(resultHead) + if len(result.errors) > 0: + rError = resultsErrors(result) + print(rError) + Configuration.Logger.error(rError) + if len(result.failures) > 0: + rFail = resultsFailures(result) + print(rFail) + Configuration.Logger.error(rFail) + Configuration.Logger.info("END OF TEST =========================================\n") + + return + +def resultsHeader(result): + ''' Generic header for the results in the log file ''' + msg = "RESULTS =================================================\n\n" + msg += "Number of tests run: " + str(result.testsRun) + "\n" + msg += "Number of errors: " + str(len(result.errors)) + "\n" + msg += "Number of failures: " + str(len(result.failures)) + "\n" + return msg + +def resultsErrors(result): + ''' Error results formatting ''' + msg = "ERRORS =================================================\n\n" + for i in result.errors: + for j in i: + msg += str(j) + msg += "\n" + return msg + +def resultsFailures(result): + ''' Assert failures formatting ''' + msg = "FAILURES ===============================================\n\n" + for i in result.failures: + for j in i: + msg += str(j) + msg += "\n" + return msg def runTestSuite(): + ''' collect all test suites before running them ''' + if Configuration.DEBUG == True: print("TestRunner.py - runTestSuite") testSuite = unittest.TestSuite() result = unittest.TestResult() - addVisibilityTests(testSuite) + + #What are we working with? + Configuration.Platform = "DESKTOP" + if arcpy.GetInstallInfo()['ProductName'] == 'ArcGISPro': + Configuration.Platform = "PRO" + Configuration.Logger.info(Configuration.Platform + " =======================================") + + testSuite.addTests(addCapabilitySuite()) + testSuite.addTests(addPatternsSuite()) + testSuite.addTests(addVisibilitySuite()) + testSuite.addTests(addSuitabilitySuite()) + + #addDataManagementTests(logger, platform) + #addOperationalGraphicsTests(logger, platform) + #addPatternsTests(logger, platform) + #addSuitabilityTests(logger, platform) + #testSuite.addTests(addVisibilityTests(logger, platform)) + + print("running " + str(testSuite.countTestCases()) + " tests...") testSuite.run(result) print("Test success: {0}".format(str(result.wasSuccessful()))) + return result + +def addCapabilitySuite(): + ''' Add all Capability tests in the ./capability_tests folder ''' + if Configuration.DEBUG == True: print("TestRunner.py - addCapabilitySuite") + from capability_tests import AllCapabilityTestSuite + testSuite = unittest.TestSuite() + testSuite.addTests(AllCapabilityTestSuite.getCapabilityTestSuites()) + return testSuite + +def addPatternsSuite(): + ''' Add all Patterns tests in the ./patterns_tests folder ''' + if Configuration.DEBUG == True: print("TestRunner.py - addPatternsSuite") + from patterns_tests import AllPatternsTestSuite + suite = unittest.TestSuite() + suite.addTest(AllPatternsTestSuite.getPatternsTestSuites()) + return suite + +def addVisibilitySuite(): + ''' Add all Visibility tests in the ./visibility_tests folder ''' + if Configuration.DEBUG == True: print("TestRunner.py - addVisibilitySuite") + from visibility_tests import AllVisibilityTestSuite + suite = unittest.TestSuite() + suite.addTests(AllVisibilityTestSuite.getVisibilityTestSuites()) + return suite + +def addSuitabilitySuite(): + ''' Add all Suitability tests in the ./suitability_tests folder ''' + if Configuration.DEBUG == True: print("TestRunner.py - addSuitabilitySuite") + from suitability_tests import AllSuitabilityTestSuite + suite = unittest.TestSuite() + suite.addTests(AllSuitabilityTestSuite.getSuitabilityTestSuites()) + return suite # MAIN ============================================= if __name__ == "__main__": - sunPosPath = os.path.normpath(os.path.join(TestUtilities.currentPath, r"../../visibility/test/test_sun_position/")) - visRangePath = os.path.normpath(os.path.join(TestUtilities.currentPath, r"../../visibility/test/test_viz_and_range/")) - sys.path.insert(0, sunPosPath) - sys.path.insert(0, visRangePath) - from SunPositionAndHillshadeTestCase import SunPositionAndHillshadeTestCase - from FindLocalPeaksTestCase import FindLocalPeaksTestCase + if Configuration.DEBUG == True: + print("TestRunner.py") main() diff --git a/utils/test/TestUtilities.py b/utils/test/TestUtilities.py deleted file mode 100644 index 0bbb77a8..00000000 --- a/utils/test/TestUtilities.py +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#----------------------------------------------------------------------------- -# TestUtilities.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys - -currentPath = os.path.dirname(__file__) -logPath = os.path.normpath(os.path.join(currentPath, r"../log/")) - -#### Visibility #### -vis_GeodatabasePath = os.path.normpath(os.path.join(currentPath, r"../../visibility/data/geodatabases/")) -vis_ScratchPath = os.path.normpath(os.path.join(currentPath, r"../../visibility/data/geodatabases")) -vis_ToolboxesPath = os.path.normpath(os.path.join(currentPath, r"../../visibility/toolboxes/")) -vis_ScriptsPath = os.path.join(vis_ToolboxesPath, "scripts") -sunPosToolbox = os.path.join(vis_ToolboxesPath, "Sun Position Analysis Tools_10.3.tbx") -visandRangeToolbox = os.path.join(vis_ToolboxesPath, "Visibility and Range Tools_10.3.tbx") - - - diff --git a/utils/test/UnitTestCase.py b/utils/test/UnitTestCase.py deleted file mode 100644 index 622fc5ab..00000000 --- a/utils/test/UnitTestCase.py +++ /dev/null @@ -1,27 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ - -import sys -import arcpy -import unittest -import TestUtilities -import UnitTestUtilities - -class UnitTestCase(unittest.TestCase): - def setUp(self): - UnitTestUtilities.checkArcPy() - visibility_Paths = [TestUtilities.vis_GeodatabasePath, TestUtilities.vis_ToolboxesPath, TestUtilities.sunPosToolbox, TestUtilities.visandRangeToolbox] - UnitTestUtilities.checkFilePaths(visibility_Paths) - \ No newline at end of file diff --git a/utils/test/UnitTestUtilities.py b/utils/test/UnitTestUtilities.py index a6f44337..b70fef42 100644 --- a/utils/test/UnitTestUtilities.py +++ b/utils/test/UnitTestUtilities.py @@ -1,89 +1,197 @@ -#------------------------------------------------------------------------------ -# Copyright 2015 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ +# coding: utf-8 +''' +------------------------------------------------------------------------------ + Copyright 2015 Esri + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------------------------------------------------------------------------------ +================================================== +UnitTestUtiliites.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +Basic methods used in unit tests + +================================================== +history: +10/06/2015 - JH - original coding +10/23/2015 - MF - mods for tests +================================================== +''' import arcpy import os import sys +import traceback import platform import logging -import TestUtilities +import Configuration +import datetime + +def getLoggerName(): + ''' get unique log file name ''' + if Configuration.DEBUG == True: + print("UnitTestUtilities - getLoggerName") + seq = 0 + name = nameFromDate(seq) + #add +=1 to seq until name doesn't exist as a path + while os.path.exists(os.path.join(Configuration.logPath, name)): + seq += 1 + name = nameFromDate(seq) + #logFilePath = os.path.join(Configuration.logPath, name) + return name + +def getCurrentDateTimeForLogFile(): + ''' Get current date/time string as: YYYY-MM-DD_HH-MM-SS ''' + return datetime.datetime.now().strftime("%Y-%B-%d_%H-%M-%S") + +def getCurrentDateTime(): + ''' Get current date/time string as: DD/MM/YYYY HH:MM:SS ''' + return datetime.datetime.now().strftime("%d/%B/%Y %H:%M:%S") + +def nameFromDate(seq): + ''' Make log file name''' + return 'SGT_' + str(getCurrentDateTimeForLogFile()) + '_seq' + str(seq) + '.log' + +def makeFileFromPath(filePath): + ''' make a file object from a path to that + file if it doesn't already exist ''' + if not checkExists(filePath): + try: + fd = open(filePath, 'a') + fd.close() + except: + print("Can't make file for some reason.") + return filePath + +def makeFolderFromPath(folderPath): + ''' make a folder(s) from a path if it doesn't + already exist ''' + if not checkExists(folderPath): + try: + os.makedirs(folderPath) + except: + print("Can't make the folder for some reason.") + return folderPath def initializeLogger(name): - # get and return named logger - logFile = os.path.join(TestUtilities.logPath, 'test.log') + ''' get and return named logger ''' + if Configuration.DEBUG == True: + print("UnitTestUtilities - initializeLogger") + + # Check if the path to the log files exists, and create if not + if not os.path.exists(Configuration.logPath): + dummy = makeFolderFromPath(Configuration.logPath) + + # get a unique log file name if we don't have a name already + if name == None or name == "": + name = getLoggerName() + + logFile = os.path.join(Configuration.logPath, name) + + # if the log file does NOT exist, create it + if not os.path.exists(logFile): + logFile = makeFileFromPath(logFile) + logging.basicConfig(format='%(levelname)s: %(asctime)s %(message)s', filename=logFile, level=logging.DEBUG) logger = logging.getLogger(name) return logger - -def setUpLogFileHeader(log): - log.info("------------ New Test ------------------") - log.info("Platform: {0}".format(platform.platform())) - log.info("Python Version {0}".format(sys.version)) + +def setUpLogFileHeader(): + ''' Add a header to log file when initalized ''' + if Configuration.DEBUG == True: + print("UnitTestUtilities - setUpLogFileHeader") + Configuration.Logger.info("------------ Begin Test ------------------") + Configuration.Logger.info("Platform: {0}".format(platform.platform())) + Configuration.Logger.info("Python Version {0}".format(sys.version)) d = arcpy.GetInstallInfo() - log.info("{0} Version {1}, installed on {2}.".format(d['ProductName'], d['Version'], d['InstallDate'])) - log.info("----------------------------------------") - + Configuration.Logger.info("{0} Version {1}, installed on {2}.".format(d['ProductName'], d['Version'], d['InstallDate'])) + Configuration.Logger.info("----------------------------------------") + def checkArcPy(): - print("Testing ArcPy") + ''' sanity check that ArcPy is working ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - checkArcPy") arcpy.AddMessage("ArcPy works") - + +def checkExists(p): + ''' Python check for existance ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - checkExists") + return os.path.exists(p) + def createScratch(scratchPath): + ''' create scratch geodatabase ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - createScratch") + scratchName = 'scratch.gdb' + scratchGDB = os.path.join(scratchPath, scratchName) + if checkExists(scratchGDB): + print("Scratch already exists") + return scratchGDB try: - print("Creating scratch geodatabase...") - arcpy.CreateFileGDB_management(scratchPath, "scratch.gdb") - print("Created scratch gdb.") + if Configuration.DEBUG == True: print("Creating scratch geodatabase...") + arcpy.CreateFileGDB_management(scratchPath, scratchName) + if Configuration.DEBUG == True: print("Created scratch gdb.") except: - print("scratch.gdb already exists") - return + print("Problem creating scratch.gdb") + return scratchGDB def deleteScratch(scratchPath): + ''' delete scratch geodatabase ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - deleteScratch") try: arcpy.Delete_management(scratchPath) - print("Deleted scratch gdb.") + if Configuration.DEBUG == True: print("Deleted scratch gdb.") except: - print("scratch.gdb delete failed") + print("scratch.gdb delete failed") return - -def checkFilePaths(paths): + +def checkFilePaths(paths): + ''' check file/folder paths exist ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - checkFilePaths") for path2check in paths: if os.path.exists(path2check): - print("Valid Path: " + path2check) + if Configuration.DEBUG == True: print("Valid Path: " + path2check) else: - print("ERROR: Necessary Path not found: " + path2check) - raise Exception('Bad Path') + raise Exception('Bad Path: ' + str(path2check)) -def checkGeoObjects(objects): +def checkGeoObjects(objects): + ''' check geospatial stuff exists ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - checkGeoObjects") for object2Check in objects: + #TODO: Shouldn't we be using arcpy.Exists()? desc = arcpy.Describe(object2Check) if desc == None: print("--> Invalid Object: " + str(object2Check)) arcpy.AddError("Bad Input") raise Exception('Bad Input') else: - print("Valid Object: " + desc.Name) - + if Configuration.DEBUG == True: print("Valid Object: " + desc.Name) + def handleArcPyError(): + ''' Basic GP error handling, errors printed to console and logger ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - handleArcPyError") # Get the arcpy error messages msgs = arcpy.GetMessages() arcpy.AddError(msgs) print(msgs) + Configuration.Logger.error(msgs) - # return a system error code - sys.exit(-1) - def handleGeneralError(): + ''' Basic error handler, errors printed to console and logger ''' + if Configuration.DEBUG == True: print("UnitTestUtilities - handleGeneralError") # Get the traceback object tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] @@ -92,13 +200,31 @@ def handleGeneralError(): pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - # Print Python error messages for use in Python / Python Window print(pymsg + "\n") + Configuration.Logger.error(pymsg) print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file + Configuration.Logger.error(msgs) + +def geoObjectsExist(objects): + ''' Return true if all of the input list of geo-objects exist, false otherwise ''' + allExist = True + for obj in objects: + if not arcpy.Exists(obj): + allExist = False + return allExist + +def folderPathsExist(paths): + ''' Return true if all input paths exist, false otherwise ''' + allExist = True + for p in paths: + if not os.path.exists(p): + allExist = False + return allExist + +def deleteIfExists(dataset): + ''' Delete the input dataset if it exists ''' + if (arcpy.Exists(dataset)): + arcpy.Delete_management(dataset) + arcpy.AddMessage("deleted dataset: " + dataset) + \ No newline at end of file diff --git a/utils/test/WritingTests.md b/utils/test/WritingTests.md new file mode 100644 index 00000000..5d048ccd --- /dev/null +++ b/utils/test/WritingTests.md @@ -0,0 +1,58 @@ +# Writing tests for solutions-geoprocessing-toolbox + +## Sections +* [Introduction](#introduction) +* [The Test Structure](#the-test-structure) +* [TestKickStart and TestRunner](testkickstart-and-testrunner) +* [Test Suites](#test-suites) +* [Test Cases](#test-cases) +* [Test Data](#test-data) + +## Introduction +The goal of this document is to give an overview of how the solutions-geoprocessing-toolbox tests are structured and how they are intended to work. This is just an overview. To build new tests, the successful developer will need to review the existing tests as a guide for building their own. + +## The Test Structure + +### TestKickStart and TestRunner +These two files, along with some supporting files, start the tests, and determine which platform the tests will run within. + +**TestKickStart.bat** is a simple .BAT file to run the tests under both Python 2.7 (ArcGIS Desktop) and Python 3.4 (ArcGIS Pro). + +**TestRunner.py** calls the test suites to run. + +### Test Suites +Test suites are collections of [Test Cases](#test-cases). There are two major levels of test suites. The top level are test suites for each of the six tool categories: capability, data_management, operational_graphics, patterns, suitability, visibility. + +The test suite files are named **All[category]TestSuite.py**. In each one is the collection the second level of test suites: the toolbox test suites. + +The toolbox test suites are the collection of test cases for each toolbox in the tool category. + +These are named **[toolbox name]TestSuite.py**. + +### Test Cases +Test cases are the collection of individual tests for a specific tool, or supporting toolset. + +They are named **[toolname]TestCase.py** + +### Test Data +The it is impossible to build a test without some kind of inputs. Some tests generate their own data internally (Check out the ERG tool tests as an example). But most will require some kind of output test data. + +* Test data **must** be stored in the *./data* folder. +* Keep feature data in a file geodatabase. You should name it like your toolbox. +* Any file data (CSV, TXT, XLSX, etc.) should be easy to identify which toolbox it belongs to. + +## Outline for writing tests +### 1. Make a separate branch from dev +Use this as a chance to create a feature branch from **dev** which will be merged back in when you are done. THis keeps your work separate from other work and the main **dev** branch. + +### 2. Get data and run the test manually +Before you start writing any test code, collect your releasable data. Then manually run the tool or tools with the data. Make sure it works and you are familiar with the tool's operation and the expected results. + +### 3. Write your test cases +Use the existing Test Case files as a guide to get started writing your own. The goal is to run the tool to create output that can be tested by the unittest TestCase assert methods [link to assert methods](https://docs.python.org/3/library/unittest.html#unittest.TestCase). + +### 4. Wire them up to the framework +Create a Test Suite that calls your Test Case +Add your Test Suite to the existing All[category]TestSuite.py + +### 5. Run the test from TestKickStarter.bat diff --git a/utils/test/arcpyAssert.py b/utils/test/arcpyAssert.py new file mode 100644 index 00000000..223fd846 --- /dev/null +++ b/utils/test/arcpyAssert.py @@ -0,0 +1,105 @@ + +# coding: utf-8 +''' +------------------------------------------------------------------------------ + Copyright 2017 Esri + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +------------------------------------------------------------------------------ + ================================================== + arcpyAssert.py + -------------------------------------------------- + requirements: ArcGIS X.X, Python 2.7 or Python 3.4 + author: ArcGIS Solutions + contact: support@esri.com + company: Esri + ================================================== + description: + Credit to Moravec Labs for originating this Mixin class + * + * https://github.com/MoravecLabs/ArcpyTestExample + + ================================================== + history: + 05/02/2017 - MF - Copied code from MoravecLabs + ================================================== +''' + +import arcpy +import os +import tempfile +import unittest + +class FeatureClassAssertMixin(object): + """ + Mixin for supporting the compare or assertion of two feature classes. + """ + + def assertFeatureClassEqual(self, + first, + second, + sort_field, + message=None, + compare_type=None, + ignore_options=None, + xy_tolerance=None, + m_tolerance=None, + z_tolerance=None, + attribute_tolerances=None, + omit_field=None): + """ + Compares the second feature class to the first, and reports any issues. Detailed issues are printed to the + console if found. + :param first: + :param second: + :param sort_field: + :param message: + :param compare_type: + :param ignore_options: + :param xy_tolerance: + :param m_tolerance: + :param z_tolerance: + :param attribute_tolerances: + :param omit_field: + :return: + """ + + # Make a place to store the compare file + compare_file = tempfile.mkstemp(".txt") + os.close(compare_file[0]) + os.remove(compare_file[1]) + result = arcpy.FeatureCompare_management(first, + second, + sort_field, + compare_type, + ignore_options, + xy_tolerance, + m_tolerance, + z_tolerance, + attribute_tolerances, + omit_field, + continue_compare=True, + out_compare_file=compare_file[1]) + if 'true' == result.getOutput(1): + # delete the compare file + os.remove(compare_file[1]) + return + + # read the compare file and print it out + print(compare_file[1]) + with open(compare_file[1], 'r') as f: + #[print(l.rstrip()) for l in f.readlines()] # syntax error here + for l in f.readlines(): + print(l.rstrip()) + os.remove(compare_file[1]) + + # set the assertion message. + msg = message if message is not None else "Feature class {} is not equal to {}".format(second, first) + raise AssertionError(msg) \ No newline at end of file diff --git a/utils/test/capability_tests/AllCapabilityTestSuite.py b/utils/test/capability_tests/AllCapabilityTestSuite.py new file mode 100644 index 00000000..d295fca1 --- /dev/null +++ b/utils/test/capability_tests/AllCapabilityTestSuite.py @@ -0,0 +1,66 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +AllCapabilityTestSuite.py +-------------------------------------------------- +requirements: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the capability toolbox test suites: +* HelicopterLandingZoneToolsTestSuite.py +* ERGToolsTestSuite.py +* PointOfOriginToolsTestSuite.py - PENDING + +================================================== +history: +10/23/2015 - MF - original writeup +================================================== +''' + +import unittest +import Configuration + +from . import HelicopterLandingZoneToolsTestSuite +# Getting an error on line above during run in Python 3.4: +# File "C:\Users\\Documents\GitHub\solutions-geoprocessing-toolbox\utils\test\capability_tests\AllCapabilityTestSuite.py", line 41, in +# import HelicopterLandingZoneToolsTestSuite +# ImportError: No module named 'HelicopterLandingZoneToolsTestSuite' +#FIX: instead of "import " use "from . import " + +#from . import PointOfOriginToolsTestSuite - Doesn't Exist Yet +from . import ERGToolsTestSuite + +def getCapabilityTestSuites(): + ''' This pulls together all of the toolbox test suites in this folder ''' + if Configuration.DEBUG == True: + print(" AllCapabilityTestSuite.capabilityTestSuite") + Configuration.Logger.info("Adding Capability Tests including:") + testSuite = unittest.TestSuite() + + # these come from HelicopterLandingZoneToolsTestSuite.py + testSuite.addTests(HelicopterLandingZoneToolsTestSuite.getHLZTestSuite()) + + #TODO: these will come from PointOfOriginToolsTestSuite + + # these come from ERGToolsTestSuite.py + testSuite.addTests(ERGToolsTestSuite.getERGTestSuite()) + return testSuite diff --git a/utils/test/capability_tests/ERGByChemicalTestCase.py b/utils/test/capability_tests/ERGByChemicalTestCase.py new file mode 100644 index 00000000..e0b47d04 --- /dev/null +++ b/utils/test/capability_tests/ERGByChemicalTestCase.py @@ -0,0 +1,138 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +ERGByChemicalTestCase.py +-------------------------------------------------- +requirements: +author: ArcGIS Solutions +company: Esri +================================================== +Description: Unit test for the ERG By Placard + +Includes the following tests: +* test_ERGByChemical_001 +* test_ERGByChemical_002 + +================================================== +history: +11/09/2015 - MF - original coding +02/24/2017 - MF - update for new 2016 ERG chemical list +================================================== +''' + +import arcpy +import os +import unittest +import Configuration +import UnitTestUtilities +from . import ERGTestUtils + + +class ERGByChemical(unittest.TestCase): + ''' Test ERG By Chemical tool in the ERG Tools toolbox''' + + scratchGDB = None + inputPoint = None + + tbxFolderPath = os.path.join(Configuration.repoPath, "capability", "toolboxes", "ERG Tools.pyt") + testDataFolderPath = os.path.join(Configuration.capabilityPath, "data") + + def setUp(self): + ''' set-up code ''' + if Configuration.DEBUG == True: print(" ERGByChemical.setUp") + UnitTestUtilities.checkArcPy() + UnitTestUtilities.checkFilePaths([self.testDataFolderPath, + self.tbxFolderPath]) + + # Import the toolbox + arcpy.ImportToolbox(self.tbxFolderPath, "erg") + + # Check the test inputs (do they exist? or not?) + if (self.scratchGDB == None) or (not arcpy.Exists(self.scratchGDB)): + self.scratchGDB = UnitTestUtilities.createScratch(self.testDataFolderPath) + + # Setup the test inputs + self.inputPoint = ERGTestUtils.getInputPointFC() + UnitTestUtilities.checkGeoObjects([self.inputPoint]) + return + + def tearDown(self): + ''' clean up after tests''' + if Configuration.DEBUG == True: print(" ERGByChemical.tearDown") + UnitTestUtilities.deleteScratch(self.scratchGDB) + return + + def test_ERGByChemical_001(self): + ''' test the tool ''' + if Configuration.DEBUG == True: print(" ERGByChemical.test_ERGByChemical_001") + inputMaterialType = "Allylamine" + inputWindBearing = 10 + inputDayOrNight = "Day" + inputLargeOrSmall = "Large" + countAreas, countLines = self.ERGByChemical(inputMaterialType, inputWindBearing, + inputDayOrNight, inputLargeOrSmall) + self.assertEqual(countAreas, int(3)) + self.assertEqual(countLines, int(3)) + return + + def test_ERGByChemical_002(self): + ''' test the tool ''' + if Configuration.DEBUG == True: print(" ERGByChemical.test_ERGByChemical_002") + inputMaterialType = "Allylamine" + inputWindBearing = 130 + inputDayOrNight = "Night" + inputLargeOrSmall = "Small" + countAreas, countLines = self.ERGByChemical(inputMaterialType, inputWindBearing, + inputDayOrNight, inputLargeOrSmall) + self.assertEqual(countAreas, int(3)) + self.assertEqual(countLines, int(3)) + return + + def test_ERGByChemical_003(self): + ''' test the tool ''' + if Configuration.DEBUG == True: print(" ERGByChemical.test_ERGByChemical_003") + inputMaterialType = "GB (Weaponized Sarin)" + inputWindBearing = 250 + inputDayOrNight = "Night" + inputLargeOrSmall = "Large" + countAreas, countLines = self.ERGByChemical(inputMaterialType, inputWindBearing, + inputDayOrNight, inputLargeOrSmall) + self.assertEqual(countAreas, int(3)) + self.assertEqual(countLines, int(3)) + return + + def ERGByChemical(self, inputMaterialType, inputWindBearing, inputDayOrNight, inputLargeOrSmall): + ''' Test the supporting script tool ''' + if Configuration.DEBUG == True: + print(" ERGByChemical.test_ERGByChemical") + else: + print("Testing ERG By Chemical...") + + # Testing ERG By Placard + outputERGAreas = os.path.join(self.scratchGDB, "ERGAreasChemical") + outputERGLines = os.path.join(self.scratchGDB, "ERGLinesChemical") + outputERGAreas, outputERGLines = arcpy.ERGByChemical_erg(self.inputPoint, inputMaterialType, + inputWindBearing, inputDayOrNight, + inputLargeOrSmall, outputERGAreas, + outputERGLines) + + # Verify Results + countAreas = int(arcpy.GetCount_management(outputERGAreas).getOutput(0)) + countLines = int(arcpy.GetCount_management(outputERGLines).getOutput(0)) + + return [countAreas, countLines] diff --git a/utils/test/capability_tests/ERGByPlacardTestCase.py b/utils/test/capability_tests/ERGByPlacardTestCase.py new file mode 100644 index 00000000..9577c9e5 --- /dev/null +++ b/utils/test/capability_tests/ERGByPlacardTestCase.py @@ -0,0 +1,130 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +ERGByPlacardTestCase.py +-------------------------------------------------- +requirements: +author: ArcGIS Solutions +company: Esri +================================================== +Description: Unit test for the ERG By Placard + +Includes the following tests: + + +================================================== +history: +11/09/2015 - MF - original coding +================================================== +''' + +import arcpy +import os +import unittest +import Configuration +import UnitTestUtilities +from . import ERGTestUtils + + +class ERGByPlacard(unittest.TestCase): + ''' Test ERG By Placard tool in the ERG Tools toolbox''' + + scratchGDB = None + inputPoint = None + + tbxFolderPath = os.path.join(Configuration.repoPath, "capability", "toolboxes", "ERG Tools.pyt") + testDataFolderPath = os.path.join(Configuration.capabilityPath, "data") + + def setUp(self): + ''' set-up code ''' + if Configuration.DEBUG == True: print(" ERGByPlacard.setUp") + UnitTestUtilities.checkArcPy() + UnitTestUtilities.checkFilePaths([self.testDataFolderPath, + self.tbxFolderPath]) + + # Import the toolbox + arcpy.ImportToolbox(self.tbxFolderPath, "erg") + + # Check the test inputs (do they exist? or not?) + if (self.scratchGDB == None) or (not arcpy.Exists(self.scratchGDB)): + self.scratchGDB = UnitTestUtilities.createScratch(self.testDataFolderPath) + + # Setup the test inputs + self.inputPoint = ERGTestUtils.getInputPointFC() + UnitTestUtilities.checkGeoObjects([self.inputPoint]) + + return + + def tearDown(self): + ''' clean up after tests''' + if Configuration.DEBUG == True: print(" ERGByPlacard.tearDown") + UnitTestUtilities.deleteScratch(self.scratchGDB) + return + + def test_ERGByPlacard_001(self): + ''' test the tool with basic inputs''' + if Configuration.DEBUG == True: print(" ERGByPlacard.test_ERGByPlacard_001") + inputPlacardID = 1560 + inputWindBearing = 10 + inputDayOrNight = "Day" + inputLargeOrSmall = "Large" + countAreas, countLines = self.ERGByPlacard(inputPlacardID, + inputWindBearing, + inputDayOrNight, + inputLargeOrSmall) + + self.assertEqual(countAreas, int(3)) + self.assertEqual(countLines, int(3)) + return + + def test_ERGByPlacard_002(self): + ''' test the tool with basic inputs''' + if Configuration.DEBUG == True: print(" ERGByPlacard.test_ERGByPlacard_002") + inputPlacardID = 1560 + inputWindBearing = 130 + inputDayOrNight = "Night" + inputLargeOrSmall = "Small" + countAreas, countLines = self.ERGByPlacard(inputPlacardID, + inputWindBearing, + inputDayOrNight, + inputLargeOrSmall) + + self.assertEqual(countAreas, int(3)) + self.assertEqual(countLines, int(3)) + return + + def ERGByPlacard(self, inputPlacardID, inputWindBearing, inputDayOrNight, inputLargeOrSmall): + ''' Main ERG By Placard test ''' + if Configuration.DEBUG == True: + print(" ERGByPlacard.ERGByPlacard") + else: + print("Testing ERG By Placard...") + + # Testing ERG By Placard + outputERGAreas = os.path.join(self.scratchGDB, "ERGAreasPlacard") + outputERGLines = os.path.join(self.scratchGDB, "ERGLinesPlacard") + outputERGAreas, outputERGLines = arcpy.ERGByPlacard_erg(self.inputPoint, inputPlacardID, + inputWindBearing, inputDayOrNight, + inputLargeOrSmall, outputERGAreas, + outputERGLines) + + # Verify Results + countAreas = int(arcpy.GetCount_management(outputERGAreas).getOutput(0)) + countLines = int(arcpy.GetCount_management(outputERGLines).getOutput(0)) + + return [countAreas, countLines] diff --git a/utils/test/capability_tests/ERGScriptTestCase.py b/utils/test/capability_tests/ERGScriptTestCase.py new file mode 100644 index 00000000..7613c10c --- /dev/null +++ b/utils/test/capability_tests/ERGScriptTestCase.py @@ -0,0 +1,179 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +ERGScriptTestCase.py +-------------------------------------------------- +requirements: +author: ArcGIS Solutions +company: Esri +================================================== +Description: Unit test for the ERG Script that drives the ERG By Placard and ERG By Chemical +tools. +The tool is based on the Emergency Response Guidebook (ERG) 2012 ed.: +http://phmsa.dot.gov/pv_obj_cache/pv_obj_id_7410989F4294AE44A2EBF6A80ADB640BCA8E4200/filename/ERG2012.pdf +(retrieved 11/11/2015) +References to page numbers in the tests below are from this book. + +Includes the following tests: +* test_LookUpERG001 +* + +================================================== +history: +11/09/2015 - MF - original coding +================================================== +''' + +import arcpy +import os +import sys +import unittest +import Configuration +import UnitTestUtilities +from . import ERGTestUtils + +#from . import ERG +sys.path.append(os.path.relpath(r'.\..\..\capability\toolboxes\scripts')) +#print('sys.path' + str(sys.path)) +import ERG + +class ERGTest(unittest.TestCase): + ''' Test ERG source script for the ERG Tools toolbox''' + + scratchGDB = None + scriptFolderPath = os.path.join(Configuration.repoPath, "capability", + "toolboxes", "scripts", "ERG.py") + # dbfFolderPath = os.path.join(Configuration.repoPath, "capability", + # "toolboxes", "tooldata", "ERG2012LookupTable.dbf") + dbfFolderPath = os.path.join(Configuration.repoPath, "capability", + "toolboxes", "tooldata", "ERG2016LookupTable.dbf") + testDataFolderPath = os.path.join(Configuration.capabilityPath, "data") + + def setUp(self): + ''' set-up code ''' + if Configuration.DEBUG: + print(".....ERGScript.setUp") + UnitTestUtilities.checkArcPy() + UnitTestUtilities.checkFilePaths([self.scriptFolderPath, + self.testDataFolderPath]) + + # Check the test inputs (do they exist? or not?) + if (self.scratchGDB == None) or (not arcpy.Exists(self.scratchGDB)): + self.scratchGDB = UnitTestUtilities.createScratch(self.testDataFolderPath) + UnitTestUtilities.checkGeoObjects([self.scratchGDB, self.dbfFolderPath]) + return + + def tearDown(self): + ''' clean up after tests''' + if Configuration.DEBUG: + print(".....ERGScript.tearDown") + UnitTestUtilities.deleteScratch(self.scratchGDB) + return + + ergDict = { + '001': [1017, 124, 'Chlorine', 'Large', 'Day', 500.0, 3000.0], + '002': [1076, 125, 'Phosgene', 'Small', 'Day', 100.0, 600.0], + '003': [2810, 153, 'GB (Weaponized Sarin)', 'Large', 'Night', 400.0, 4900.0] + } + + def test_LookUpERG001(self): + ''' + test case one + ERG: ID No. 1017 Chlorine + ''' + if Configuration.DEBUG: print(".....ERGScript.test_LookUpERG001") + inChemical = 'Chlorine' + inPlacardID = 1017 + inSpillSize = 'Large' #'Large' or 'Small' + inTimeOfDay = 'Day' #'Day' or 'Night' + outResult = ERG.LookUpERG(inChemical, inPlacardID, inSpillSize, inTimeOfDay, self.dbfFolderPath) + self.assertEqual(outResult[0], 500.0) # Initial Isolation Distance + self.assertEqual(outResult[1], 3000.0) # Protective Action Distance + self.assertEqual(outResult[2], 'Chlorine') # Materials + self.assertEqual(outResult[3], 124) # GuideNum + return + + def test_LookUpERG002(self): + ''' + test case two + ERG: ID No. 1076 Phosgene + ''' + if Configuration.DEBUG: print(".....ERGScript.test_LookUpERG002") + inChemical = 'Phosgene' + inPlacardID = 1076 + inSpillSize = 'Small' #'Large' or 'Small' + inTimeOfDay = 'Day' #'Day' or 'Night' + outResult = ERG.LookUpERG(inChemical, inPlacardID, inSpillSize, inTimeOfDay, self.dbfFolderPath) + self.assertEqual(outResult[0], 100.0) # Initial Isolation Distance + self.assertEqual(outResult[1], 600.0) # Protective Action Distance + self.assertEqual(outResult[2], 'Phosgene') # Materials + self.assertEqual(outResult[3], 125) # GuideNum + return + + def test_LookUpERG003(self): + ''' + test case three + ERG: ID No. 2810 Sarin + ''' + if Configuration.DEBUG == True: print(".....ERGScript.test_LookUpERG003") + inChemical = 'GB (Weaponized Sarin)' + inPlacardID = 2810 + inSpillSize = 'Large' #'Large' or 'Small' + inTimeOfDay = 'Night' #'Day' or 'Night' + outResult = ERG.LookUpERG(inChemical, inPlacardID, inSpillSize, inTimeOfDay, self.dbfFolderPath) + self.assertEqual(outResult[0], 400.0) # Initial Isolation Distance + self.assertEqual(outResult[1], 4900.0) # Protective Action Distance + #self.assertEqual(outResult[2], 'Sarin (when used as a weapon)') # Materials + self.assertEqual(outResult[3], 153) # GuideNum + return + + def test_GetProjectedPoint001(self): + ''' test case one ''' + if Configuration.DEBUG == True: print(".....ERGScript.test_GetProjectedPoint001") + inputPoint = ERGTestUtils.getInputPointFC() + outputPoint = ERG.GetProjectedPoint(inputPoint) + sr = outputPoint.spatialReference + self.assertEqual(sr.factoryCode, int(32643)) + return + + def test_GetProjectedPoint002(self): + ''' test case two ''' + if Configuration.DEBUG == True: print(".....ERGScript.test_GetProjectedPoint002") + inputPoint = ERGTestUtils.getInputPointFCFromXY(-121.844234,36.586438) + outputPoint = ERG.GetProjectedPoint(inputPoint) + sr = outputPoint.spatialReference + self.assertEqual(sr.factoryCode, int(32610)) + return + + def test_GetProjectedPoint003(self): + ''' test case three ''' + if Configuration.DEBUG == True: print(".....ERGScript.test_GetProjectedPoint003") + inputPoint = ERGTestUtils.getInputPointFCFromXY(-68.609535, 46.178194) + outputPoint = ERG.GetProjectedPoint(inputPoint) + sr = outputPoint.spatialReference + self.assertEqual(sr.factoryCode, int(32619)) + return + + def test_GetProjectedPoint004(self): + ''' test case four ''' + if Configuration.DEBUG == True: print(".....ERGScript.test_GetProjectedPoint004") + inputPoint = ERGTestUtils.getInputPointFCFromXY(-98.233824, 26.654716) + outputPoint = ERG.GetProjectedPoint(inputPoint) + sr = outputPoint.spatialReference + self.assertEqual(sr.factoryCode, int(32614)) + return diff --git a/utils/test/capability_tests/ERGTestUtils.py b/utils/test/capability_tests/ERGTestUtils.py new file mode 100644 index 00000000..6f142e89 --- /dev/null +++ b/utils/test/capability_tests/ERGTestUtils.py @@ -0,0 +1,60 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +ERGTestUtils.py +-------------------------------------------------- +requirments: ArcGIS X.X, Python 2.7 or Python 3.4 +author: ArcGIS Solutions +contact: ArcGISTeam@esri.com +company: Esri +================================================== +description: +These are utility modules used by the two ERG tool test cases: +* ERGByChemicalTestCase.py +* ERGByPlacardTestCase.py + +================================================== +history: +11/10/2015 - MF - intial work +================================================== +''' + +import arcpy + +def getInputPointFC(): + ''' returns UTM projected point from static WGS 84 point ''' + fc = getInputPointFCFromXY(77.0, 38.9) + return fc + +def getInputPointFCFromXY(x, y): + ''' returns UTM projected point from X and Y coords (longitude, latitude) in WGS 84 ''' + inPoint = arcpy.Point(x, y) + inWGS84Point = arcpy.PointGeometry(inPoint) + sr = arcpy.SpatialReference(4326) #GCS_WGS_1984? + inWGS84Point.spatial_reference = sr + # create an in_memory feature class to initially contain the input point + fc = arcpy.CreateFeatureclass_management("in_memory", "tempfc", "POINT", + None, "DISABLED", "DISABLED", + sr)[0] + # open and insert cursor + with arcpy.da.InsertCursor(fc, ["SHAPE@"]) as cursor: + cursor.insertRow([inWGS84Point]) + # create a featureset object and load the fc + inputFeatureSet = arcpy.FeatureSet() + inputFeatureSet.load(fc) + return fc diff --git a/utils/test/capability_tests/ERGToolsTestSuite.py b/utils/test/capability_tests/ERGToolsTestSuite.py new file mode 100644 index 00000000..96b34a7e --- /dev/null +++ b/utils/test/capability_tests/ERGToolsTestSuite.py @@ -0,0 +1,76 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +ERGToolsTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +Test Suite collects all of the test cases for the ERG Tools toolbox: +* ERGByPlacardTestCase.py +* ERGByChemicalTestCase.py +* ERGScriptTestCase.py + +================================================== +history: +11/09/2015 - MF - placeholder +02/24/2017 - MF - Hide test_LookUpERG001 -- chemical values incorrect +================================================== +''' + +import unittest +import Configuration +from . import ERGByPlacardTestCase +from . import ERGByChemicalTestCase +from . import ERGScriptTestCase + +def getERGTestSuite(): + ''' run the HLZ tests as either Pro or Desktop''' + + if Configuration.DEBUG == True: + print(" ERGTestSuite.runERGTestSuite") + + placardTests = ['test_ERGByPlacard_001', 'test_ERGByPlacard_002'] + chemicalTests = ['test_ERGByChemical_001', 'test_ERGByChemical_002', 'test_ERGByChemical_003'] + # removed 'test_LookUpERG001', + scriptTests = ['test_LookUpERG002', 'test_LookUpERG003', + 'test_GetProjectedPoint001', 'test_GetProjectedPoint002', + 'test_GetProjectedPoint003', 'test_GetProjectedPoint004'] + testSuite = unittest.TestSuite() + Configuration.Logger.info("ERG Tools tests") + + for t in chemicalTests: + testSuite.addTest(ERGByChemicalTestCase.ERGByChemical(t)) + print("adding test: " + str(t)) + Configuration.Logger.info(t) + + for t in placardTests: + testSuite.addTest(ERGByPlacardTestCase.ERGByPlacard(t)) + print("adding test: " + str(t)) + Configuration.Logger.info(t) + + for t in scriptTests: + testSuite.addTest(ERGScriptTestCase.ERGTest(t)) + print("adding test: " + str(t)) + Configuration.Logger.info(t) + + return testSuite diff --git a/utils/test/capability_tests/HLZTouchdownPointsTestCase.py b/utils/test/capability_tests/HLZTouchdownPointsTestCase.py new file mode 100644 index 00000000..25caa80b --- /dev/null +++ b/utils/test/capability_tests/HLZTouchdownPointsTestCase.py @@ -0,0 +1,233 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +HLZTouchdownPointsTestCase.py +-------------------------------------------------- +requirements: +author: ArcGIS Solutions +company: Esri +================================================== +Description: Unit test for the HLZ Touchdown Points tool and also the supporting tools: +Choose Field Value Script Tool, and MinimumBoundingFishnet. + +Includes the following tests: +* test_MinimumBoundingFishnet +* test_Choose_Field_Value_Script_Tool +* test_HLZ_Touchdown_Points_001 + +================================================== +history: +9/24/2015 - 10/19/2015 - MF - original test writeup +10/21/2015 - MF - removed 10.x/1.x split between test cases +04/29/2016 - MF - fix #387 where test_hlz_tools.gdb is not created +09/12/2016 - MF - Split 10.x/1.x tests as errors are not trapped +================================================== +''' + +import arcpy +import os +import unittest +import Configuration +import UnitTestUtilities +import DataDownload + +class HLZTouchdownPoints(unittest.TestCase): + ''' Test all tools and methods related to the HLZ Touchdown Points tool + in the Helicopter Landing Zones toolbox''' + + scratchGDB = None + testDataFolderPath = None + #testDataFolderPath = os.path.join(Configuration.capabilityPath, "data") + + inputAirframeTable = None + inputSuitableAreas = None + inputSlope = None + outputGeodatabase = None + outputCenterpoints = None + outputCircles = None + + def setUp(self): + ''' set-up code ''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.setUp") + UnitTestUtilities.checkArcPy() + + # Setup the test specific paths + self.tbxProFolderPath = os.path.join(Configuration.repoPath, "capability", "toolboxes", "Helicopter Landing Zone Tools.tbx") + self.tbxDesktopFolderPath = os.path.join(Configuration.repoPath, "capability", "toolboxes", "Helicopter Landing Zone Tools_10.4.tbx") + self.dataDownloadURL = r"http://www.arcgis.com/sharing/content/items/eb5685e1af5d4c16b49fc8870ced036c/data" + self.testDataFolderPath = DataDownload.createDataFolder(Configuration.capabilityPath) + + # Check the paths exist + print("Created Capability test data folder.") + UnitTestUtilities.checkFilePaths([self.testDataFolderPath, + self.tbxProFolderPath, + self.tbxDesktopFolderPath]) + # set the geodatabase + self.testDataGeodatabase = os.path.join(self.testDataFolderPath, r"test_hlz_tools.gdb") + + # Download the test data from arcgis.com + self.testDataFolderPath = DataDownload.runDataDownload(Configuration.capabilityPath, + os.path.basename(self.testDataGeodatabase), + self.dataDownloadURL) + + # Check the test inputs (do they exist? or not?) + if (self.scratchGDB == None) or (not arcpy.Exists(self.scratchGDB)): + self.scratchGDB = UnitTestUtilities.createScratch(self.testDataFolderPath) + + # Setup the test inputs + self.inputAirframeTable = os.path.join(self.testDataGeodatabase, r"Aircraft_Specifications") + self.inputSuitableAreas = os.path.join(self.testDataGeodatabase, r"HLZSelectionArea") + self.inputSlope = os.path.join(self.testDataGeodatabase, r"SRTMPctSlope") + self.outputGeodatabase = os.path.join(self.scratchGDB) + self.outputCenterpoints = os.path.join(self.outputGeodatabase, r"centerPoints") + self.outputCircles = os.path.join(self.outputGeodatabase, r"tdCircles") + + UnitTestUtilities.checkGeoObjects([self.testDataGeodatabase, + self.outputGeodatabase, + self.inputAirframeTable, + self.inputSuitableAreas, + self.inputSlope]) + return + + def tearDown(self): + ''' clean up after tests''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.tearDown") + UnitTestUtilities.deleteScratch(self.scratchGDB) + return + + def test_MinimumBoundingFishnet_Pro(self): + '''Test Minimum Bounding Fishnet for Pro''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.test_MinimumBoundingFishnet_Pro") + outputFishnet = os.path.join(self.scratchGDB, "outputFishnet") + arcpy.ImportToolbox(self.tbxProFolderPath, "tdpoints") + groupOption = r"NONE" + groupFields = r"#" + cellWidth = 75 + cellHeight = 75 + rows = 0 + columns = 0 + labelOption = r"NO_LABELS" + arcpy.MinimumBoundingFishnet_tdpoints(self.inputSuitableAreas, outputFishnet, + groupOption, groupFields, + cellWidth, cellHeight, rows, columns, labelOption) + countOutputFishnet = arcpy.GetCount_management(os.path.join(self.outputGeodatabase, outputFishnet)).getOutput(0) + self.assertEqual(countOutputFishnet, str(1260)) + return + + def test_MinimumBoundingFishnet_Desktop(self): + ''' Test Minimum Bounding Fishnet for Desktop ''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.test_MinimumBoundingFishnet_Desktop") + outputFishnet = os.path.join(self.scratchGDB, "outputFishnet") + arcpy.ImportToolbox(self.tbxDesktopFolderPath, "tdpoints") + groupOption = r"NONE" + groupFields = r"#" + cellWidth = 75 + cellHeight = 75 + rows = 0 + columns = 0 + labelOption = r"NO_LABELS" + arcpy.MinimumBoundingFishnet_tdpoints(self.inputSuitableAreas, outputFishnet, + groupOption, groupFields, + cellWidth, cellHeight, rows, columns, labelOption) + countOutputFishnet = arcpy.GetCount_management(os.path.join(self.outputGeodatabase, outputFishnet)).getOutput(0) + self.assertEqual(countOutputFishnet, str(1260)) + return + + + def test_Choose_Field_Value_Script_Tool_Pro(self): + '''Test for Choose Field Value script tool for Pro''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.test_Choose_Field_Value_Script_Tool_Pro") + arcpy.ImportToolbox(self.tbxProFolderPath, "tdpoints") + inputField = r"Model" + inputChoice = r"UH-60" + result = arcpy.ChooseFieldValueScriptTool_tdpoints(self.inputAirframeTable, inputField, inputChoice) + # compare results + self.assertEqual(result.getOutput(0), inputChoice) + return + + def test_Choose_Field_Value_Script_Tool_Desktop(self): + '''Test for Choose Field Value script tool for Desktop''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.test_Choose_Field_Values_Script_Tool_Desktop") + arcpy.ImportToolbox(self.tbxDesktopFolderPath, "tdpoints") + inputField = r"Model" + inputChoice = r"UH-60" + result = arcpy.ChooseFieldValueScriptTool_tdpoints(self.inputAirframeTable, inputField, inputChoice) + # compare results + self.assertEqual(result.getOutput(0), inputChoice) + return + + + def test_HLZ_Touchdown_Points_001_Pro(self): + '''Test 001 for HLZ Touchdown Points for Pro''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.test_HLZ_Touchdown_Points_001_Pro") + arcpy.CheckOutExtension("Spatial") + arcpy.ImportToolbox(self.tbxProFolderPath, "tdpoints") + arcpy.env.overwriteOutput = True + inputAirframeString = r"UH-60" + arcpy.HLZTouchdownPoints_tdpoints(self.inputAirframeTable, + inputAirframeString, + self.inputSuitableAreas, + self.inputSlope, + self.outputGeodatabase, + self.outputCenterpoints, + self.outputCircles) + + arcpy.CheckInExtension("Spatial") + # count output center points + + if Configuration.DEBUG == True: print("self.scratch.GDB: " + self.scratchGDB) + if Configuration.DEBUG == True: print("self.outputGeodatabase: " + self.outputGeodatabase) + if Configuration.DEBUG == True: print("self.outputCenterPoints: " + self.outputCenterpoints) + + countCenterPoints = float(arcpy.GetCount_management(self.outputCenterpoints).getOutput(0)) + # count output circles + countOutputCircles = float(arcpy.GetCount_management(self.outputCircles).getOutput(0)) + #TODO: make sure center points fall within circles + self.assertEqual(countCenterPoints, float(972)) + self.assertEqual(countOutputCircles, float(972)) + return + + def test_HLZ_Touchdown_Points_001_Desktop(self): + '''Test 001 for HLZ Touchdown Points for Pro''' + if Configuration.DEBUG == True: print(".....HLZTouchdownPoints.test_HLZ_Touchdown_Points_001_Desktop") + arcpy.CheckOutExtension("Spatial") + arcpy.ImportToolbox(self.tbxDesktopFolderPath, "tdpoints") + arcpy.env.overwriteOutput = True + inputAirframeString = r"UH-60" + arcpy.HLZTouchdownPoints_tdpoints(self.inputAirframeTable, + inputAirframeString, + self.inputSuitableAreas, + self.inputSlope, + self.outputGeodatabase, + self.outputCenterpoints, + self.outputCircles) + + arcpy.CheckInExtension("Spatial") + # count output center points + + if Configuration.DEBUG == True: print("self.scratch.GDB: " + self.scratchGDB) + if Configuration.DEBUG == True: print("self.outputGeodatabase: " + self.outputGeodatabase) + if Configuration.DEBUG == True: print("self.outputCenterPoints: " + self.outputCenterpoints) + + countCenterPoints = float(arcpy.GetCount_management(self.outputCenterpoints).getOutput(0)) + # count output circles + countOutputCircles = float(arcpy.GetCount_management(self.outputCircles).getOutput(0)) + #TODO: make sure center points fall within circles + self.assertEqual(countCenterPoints, float(972)) + self.assertEqual(countOutputCircles, float(972)) + return diff --git a/utils/test/capability_tests/HelicopterLandingZoneToolsTestSuite.py b/utils/test/capability_tests/HelicopterLandingZoneToolsTestSuite.py new file mode 100644 index 00000000..e9d6ad89 --- /dev/null +++ b/utils/test/capability_tests/HelicopterLandingZoneToolsTestSuite.py @@ -0,0 +1,71 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +HelicopterLandingZoneTestSuite.py +-------------------------------------------------- +requirements: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the test cases for the +Helicopter Landing Zone Tools toolboxes: +* HLZTouchdownPointsTestCase.py + +================================================== +history: +10/23/2015 - MF - initial coding started +================================================== +''' + +import unittest +import Configuration +from . import HLZTouchdownPointsTestCase + +def getHLZTestSuite(): + ''' run the HLZ tests as either Pro or Desktop''' + + desktopTestList = ['test_Choose_Field_Value_Script_Tool_Desktop', + 'test_MinimumBoundingFishnet_Desktop', + 'test_HLZ_Touchdown_Points_001_Desktop'] + proTestList = ['test_Choose_Field_Value_Script_Tool_Pro', + 'test_MinimumBoundingFishnet_Pro', + 'test_HLZ_Touchdown_Points_001_Pro'] + + if Configuration.DEBUG == True: + print(" HelicopterLandingZoneTestSuite.runHLZTestSuite") + testSuite = unittest.TestSuite() + if Configuration.Platform == "PRO": + Configuration.Logger.info("Helicopter Landing Zone Tools Pro tests") + testSuite = addTestFromList(testSuite, proTestList) + else: + Configuration.Logger.info("Helicopter Landing Zone Tools Desktop tests...") + testSuite = addTestFromList(testSuite, desktopTestList) + return testSuite + +def addTestFromList(testSuite, inputTestList): + ''' add tests from list''' + for p in inputTestList: + if Configuration.DEBUG == True: + print(" HelicopterLandingZoneTestSuite.addTestFromList") + print("adding test: " + str(p)) + Configuration.Logger.info(p) + testSuite.addTest(HLZTouchdownPointsTestCase.HLZTouchdownPoints(p)) + return testSuite diff --git a/utils/test/capability_tests/PointOfOriginToolsTestSuite.py b/utils/test/capability_tests/PointOfOriginToolsTestSuite.py new file mode 100644 index 00000000..33847435 --- /dev/null +++ b/utils/test/capability_tests/PointOfOriginToolsTestSuite.py @@ -0,0 +1,35 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +PointOfOriginTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +Test Suite collects all of the test cases for the Point Of Origin Tools toolbox: +* TestCase.py + +================================================== +history: +10/23/2015 - MF - placeholder +================================================== +''' diff --git a/visibility/test/test_sun_position/__init__.py b/utils/test/capability_tests/__init__.py similarity index 100% rename from visibility/test/test_sun_position/__init__.py rename to utils/test/capability_tests/__init__.py diff --git a/utils/test/data_management_tests/AllDataManagementTestSuite.py b/utils/test/data_management_tests/AllDataManagementTestSuite.py new file mode 100644 index 00000000..6e640e30 --- /dev/null +++ b/utils/test/data_management_tests/AllDataManagementTestSuite.py @@ -0,0 +1,35 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +AllDataManagementTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the data management toolbox test suites: +* ToolsTestSuite.py + +================================================== +history: +10/23/2015 - MF - placeholder +================================================== +''' diff --git a/visibility/test/test_viz_and_range/__init__.py b/utils/test/data_management_tests/__init__.py similarity index 100% rename from visibility/test/test_viz_and_range/__init__.py rename to utils/test/data_management_tests/__init__.py diff --git a/utils/test/operational_graphics_tests/AllOperationalGraphicsTestSuite.py b/utils/test/operational_graphics_tests/AllOperationalGraphicsTestSuite.py new file mode 100644 index 00000000..28348a22 --- /dev/null +++ b/utils/test/operational_graphics_tests/AllOperationalGraphicsTestSuite.py @@ -0,0 +1,35 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +AllOperationalGraphicsTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the operational graphics toolbox test suites: +* ToolsTestSuite.py + +================================================== +history: +10/23/2015 - MF - placeholder +================================================== +''' diff --git a/utils/test/operational_graphics_tests/__init__.py b/utils/test/operational_graphics_tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/utils/test/patterns_tests/AllPatternsTestSuite.py b/utils/test/patterns_tests/AllPatternsTestSuite.py new file mode 100644 index 00000000..18544e4d --- /dev/null +++ b/utils/test/patterns_tests/AllPatternsTestSuite.py @@ -0,0 +1,52 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +AllPatternsTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the patterns toolbox test suites: +* IncidentAnalysisToolsTestSuite.py + +================================================== +history: +10/23/2015 - MF - placeholder +================================================== +''' + +import logging +import unittest +import Configuration +from . import IncidentAnalysisToolsTestSuite + + +def getPatternsTestSuites(): + ''' This pulls together all of the toolbox test suites in this folder ''' + if Configuration.DEBUG == True: + print(" AllPatternsTestSuite.getPatternsTestSuites") + Configuration.Logger.info("Adding Patterns Tests including: ") + testSuite = unittest.TestSuite() + + testSuite.addTests(IncidentAnalysisToolsTestSuite.getIncidentAnalysisTestSuite()) + return testSuite + \ No newline at end of file diff --git a/utils/test/patterns_tests/ClusterAnalysisTestCase.py b/utils/test/patterns_tests/ClusterAnalysisTestCase.py new file mode 100644 index 00000000..c7f843a4 --- /dev/null +++ b/utils/test/patterns_tests/ClusterAnalysisTestCase.py @@ -0,0 +1,98 @@ +#coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +ClusterAnalysisTestCase.py +-------------------------------------------------- +requirements: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 + +author: ArcGIS Solutions +company: Esri + +================================================== +history: +12/16/2015 - JH - initial creation +09/20/2016 - MF - Update to two method test pattern +================================================== +''' + +import arcpy +import os +import unittest +import UnitTestUtilities +import Configuration +import DataDownload + +class ClusterAnalysisTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Cluster Analysis tool + in the Incident Analysis toolbox''' + inputPointsFeatures = None + + def setUp(self): + if Configuration.DEBUG == True: print(".....ClusterAnalysisTestCase.setUp") + UnitTestUtilities.checkArcPy() + + Configuration.incidentDataPath = DataDownload.runDataDownload(Configuration.patternsPaths, Configuration.incidentGDBName, Configuration.incidentURL) + if (Configuration.incidentScratchGDB == None) or (not arcpy.Exists(Configuration.incidentScratchGDB)): + Configuration.incidentScratchGDB = UnitTestUtilities.createScratch(Configuration.incidentDataPath) + Configuration.incidentInputGDB = os.path.join(Configuration.incidentDataPath, Configuration.incidentGDBName) + + UnitTestUtilities.checkFilePaths([Configuration.incidentDataPath, + Configuration.incidentInputGDB, + Configuration.patterns_ProToolboxPath, + Configuration.patterns_DesktopToolboxPath]) + + # set up inputs + self.inputPointsFeatures = os.path.join(Configuration.incidentInputGDB, "Incidents") + + def tearDown(self): + if Configuration.DEBUG == True: print(".....ClusterAnalysisTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.incidentScratchGDB) + + def test_cluster_analysis_pro(self): + '''test_cluster_analysis_pro''' + if Configuration.DEBUG == True: print(".....ClusterAnalysisTestCase.test_cluster_analysis_pro") + arcpy.ImportToolbox(Configuration.patterns_ProToolboxPath, "iaTools") + outputClusterFeatures = os.path.join(Configuration.incidentScratchGDB, "outputClusters") + runToolMessage = "Running tool (Cluster Analysis - Pro)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + try: + arcpy.ClusterAnalysis_iaTools(self.inputPointsFeatures, outputClusterFeatures) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in ClusterAnalysis_iaTools for Pro toolbox \n' + msg) + clusterCount = int(arcpy.GetCount_management(outputClusterFeatures).getOutput(0)) + self.assertEqual(clusterCount, int(37)) + + def test_cluster_analysis_desktop(self): + '''test_cluster_analysis_desktop''' + if Configuration.DEBUG == True: print(".....ClusterAnalysisTestCase.test_cluster_analysis_desktop") + arcpy.ImportToolbox(Configuration.patterns_DesktopToolboxPath, "iaTools") + outputClusterFeatures = os.path.join(Configuration.incidentScratchGDB, "outputClusters") + runToolMessage = "Running tool (Cluster Analysis - Desktop)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + try: + arcpy.ClusterAnalysis_iaTools(self.inputPointsFeatures, outputClusterFeatures) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in ClusterAnalysis_iaTools for Desktop toolbox \n' + msg ) + clusterCount = int(arcpy.GetCount_management(outputClusterFeatures).getOutput(0)) + self.assertEqual(clusterCount, int(37)) diff --git a/utils/test/patterns_tests/CountIncidentsByLOCTestCase.py b/utils/test/patterns_tests/CountIncidentsByLOCTestCase.py new file mode 100644 index 00000000..d92d81f3 --- /dev/null +++ b/utils/test/patterns_tests/CountIncidentsByLOCTestCase.py @@ -0,0 +1,97 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +CountIncidentsByLOCTestCase.py +-------------------------------------------------- +requirments: ArcGIS X.X, Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +history: +12/16/2015 - JH - initial creation +09/20/2016 - MF - Update to two method test pattern +05/02/2017 - MF - Update test for new AOI parameter in the tool +================================================== +''' + +import arcpy +import os +import unittest +import UnitTestUtilities +import Configuration +import DataDownload +import arcpyAssert + +class CountIncidentsByLOCTestCase(unittest.TestCase, arcpyAssert.FeatureClassAssertMixin): + ''' Test all tools and methods related to the Count Incidents by LOC tool + in the Incident Analysis toolbox''' + + inputPointsFeatures = None + inputLinesFeatures = None + + def setUp(self): + if Configuration.DEBUG == True: print(".....CountIncidentsByLOCTestCase.setUp") + UnitTestUtilities.checkArcPy() + + Configuration.incidentDataPath = DataDownload.runDataDownload(Configuration.patternsPaths, Configuration.incidentGDBName, Configuration.incidentURL) + if (Configuration.incidentScratchGDB == None) or (not arcpy.Exists(Configuration.incidentScratchGDB)): + Configuration.incidentScratchGDB = UnitTestUtilities.createScratch(Configuration.incidentDataPath) + Configuration.incidentInputGDB = os.path.join(Configuration.incidentDataPath, Configuration.incidentGDBName) + Configuration.incidentResultGDB = os.path.join(Configuration.incidentDataPath, Configuration.incidentResultGDBName) + + UnitTestUtilities.checkFilePaths([Configuration.incidentDataPath, Configuration.incidentInputGDB, Configuration.patterns_ProToolboxPath, Configuration.patterns_DesktopToolboxPath]) + + # set up inputs + self.inputPointsFeatures = os.path.join(Configuration.incidentInputGDB, "Incidents") + self.inputLinesFeatures = os.path.join(Configuration.incidentInputGDB, "Roads") + self.inputAOIFeatures = os.path.join(Configuration.incidentInputGDB, "Districts") + self.resultCompareFeatures0001 = os.path.join(Configuration.incidentResultGDB, "resultsCountIncidentsByLOC_0001") + + def tearDown(self): + if Configuration.DEBUG == True: print(".....CountIncidentsByLOCTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.incidentScratchGDB) + + def test_count_incidents_pro(self): + '''test_count_incidents_pro''' + if Configuration.DEBUG == True: print(".....CountIncidentsByLOCTestCase.test_count_incidents_pro") + arcpy.ImportToolbox(Configuration.patterns_ProToolboxPath, "iaTools") + outputCountFeatures = os.path.join(Configuration.incidentScratchGDB, "outputCount") + runToolMsg = "Running tool (Count Incidents By LOC - Pro)" + arcpy.AddMessage(runToolMsg) + Configuration.Logger.info(runToolMsg) + arcpy.CountIncidentsByLOC_iaTools(self.inputPointsFeatures, + self.inputLinesFeatures, + self.inputAOIFeatures, + outputCountFeatures, + "50 Meters") + self.assertFeatureClassEqual(self.resultCompareFeatures0001, outputCountFeatures, "OBJECTID") + + + def test_count_incidents_desktop(self): + if Configuration.DEBUG == True: print(".....CountIncidentsByLOCTestCase.test_count_incidents_desktop") + arcpy.ImportToolbox(Configuration.patterns_DesktopToolboxPath, "iaTools") + outputCountFeatures = os.path.join(Configuration.incidentScratchGDB, "outputCount") + runToolMsg = "Running tool (Count Incidents By LOC - Desktop)" + arcpy.AddMessage(runToolMsg) + Configuration.Logger.info(runToolMsg) + arcpy.CountIncidentsByLOC_iaTools(self.inputPointsFeatures, + self.inputLinesFeatures, + self.inputAOIFeatures, + outputCountFeatures, + "50 Meters") + self.assertFeatureClassEqual(self.resultCompareFeatures0001,outputCountFeatures,"OBJECTID") diff --git a/utils/test/patterns_tests/FindPercentChangeTestCase.py b/utils/test/patterns_tests/FindPercentChangeTestCase.py new file mode 100644 index 00000000..6f614f1a --- /dev/null +++ b/utils/test/patterns_tests/FindPercentChangeTestCase.py @@ -0,0 +1,122 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +FindPercentChangeTestCase.py +-------------------------------------------------- +requirments: ArcGIS X.X, Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +history: +12/16/2015 - JH - initial creation +09/20/2016 - MF - Update to two method test pattern +================================================== +''' + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class FindPercentChangeTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Find Percent Change tool + in the Incident Analysis toolbox''' + + inputOldIncidents = None + inputNewIncidents = None + inputAOIFeatures = None + + def setUp(self): + if Configuration.DEBUG == True: print(".....FindPercentChangeTestCase.setUp") + UnitTestUtilities.checkArcPy() + + Configuration.incidentDataPath = DataDownload.runDataDownload(Configuration.patternsPaths, Configuration.incidentGDBName, Configuration.incidentURL) + if (Configuration.incidentScratchGDB == None) or (not arcpy.Exists(Configuration.incidentScratchGDB)): + Configuration.incidentScratchGDB = UnitTestUtilities.createScratch(Configuration.incidentDataPath) + Configuration.incidentInputGDB = os.path.join(Configuration.incidentDataPath, Configuration.incidentGDBName) + + UnitTestUtilities.checkFilePaths([Configuration.incidentDataPath, Configuration.incidentInputGDB, Configuration.patterns_ProToolboxPath, Configuration.patterns_DesktopToolboxPath]) + + self.inputOldIncidents = os.path.join(Configuration.incidentInputGDB, "Incidents2014") + self.inputNewIncidents = os.path.join(Configuration.incidentInputGDB, "Incidents2015") + self.inputAOIFeatures = os.path.join(Configuration.incidentInputGDB, "Districts") + + def tearDown(self): + if Configuration.DEBUG == True: print(".....FindPercentChangeTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.incidentScratchGDB) + + def test_percent_change_pro(self): + '''test_percent_change_pro''' + if Configuration.DEBUG == True: print(".....FindPercentChangeTestCase.test_percent_change_pro") + arcpy.ImportToolbox(Configuration.patterns_ProToolboxPath, "iaTools") + runToolMessage = "Running tool (Find Percent Change - Pro)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + outputFeatures = os.path.join(Configuration.incidentScratchGDB, "outputPercentChange") + # Pro adds an extra parameter for output + try: + arcpy.FindPercentChange_iaTools(self.inputOldIncidents, self.inputAOIFeatures, self.inputNewIncidents, outputFeatures) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in FindPercentChange_iaTools for Pro toolbox \n' + msg) + proResult = arcpy.GetCount_management(outputFeatures) + proCount = int(proResult.getOutput(0)) + self.assertEqual(proCount, int(10)) + + def test_percent_change_desktop(self): + '''test_percent_change_desktop''' + if Configuration.DEBUG == True: print(".....FindPercentChangeTestCase.test_percent_change_desktop") + arcpy.ImportToolbox(Configuration.patterns_DesktopToolboxPath, "iaTools") + runToolMessage = "Running tool (Find Percent Change)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + try: + result = arcpy.FindPercentChange_iaTools(self.inputOldIncidents, self.inputAOIFeatures, self.inputNewIncidents) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in FindPercentChange_iaTools for Desktop toolbox \n' + msg) + featureResult = arcpy.GetCount_management(result) + featureCount = int(featureResult.getOutput(0)) + self.assertEqual(featureCount, int(10)) + + # def test_percent_change(self, toolboxPath, platform): + # try: + # if Configuration.DEBUG == True: print(" FindPercentChangeTestCase.test_percent_change") + # arcpy.ImportToolbox(toolboxPath, "iaTools") + # runToolMessage = "Running tool (Find Percent Change)" + # arcpy.AddMessage(runToolMessage) + # Configuration.Logger.info(runToolMessage) + # if platform == "Pro": + # outputFeatures = os.path.join(Configuration.incidentScratchGDB, "outputPercentChange") + # # Pro adds an extra parameter for output + # arcpy.FindPercentChange_iaTools(self.inputOldIncidents, self.inputAOIFeatures, self.inputNewIncidents, outputFeatures) + # proResult = arcpy.GetCount_management(outputFeatures) + # proCount = int(proResult.getOutput(0)) + # self.assertEqual(proCount, int(10)) + # else: + # result = arcpy.FindPercentChange_iaTools(self.inputOldIncidents, self.inputAOIFeatures, self.inputNewIncidents) + # featureResult = arcpy.GetCount_management(result) + # featureCount = int(featureResult.getOutput(0)) + # self.assertEqual(featureCount, int(10)) + # except arcpy.ExecuteError: + # UnitTestUtilities.handleArcPyError() + # except: + # UnitTestUtilities.handleGeneralError() + \ No newline at end of file diff --git a/utils/test/patterns_tests/HotSpotsByAreaTestCase.py b/utils/test/patterns_tests/HotSpotsByAreaTestCase.py new file mode 100644 index 00000000..c3089ec8 --- /dev/null +++ b/utils/test/patterns_tests/HotSpotsByAreaTestCase.py @@ -0,0 +1,96 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +HotSpotsByAreaTestCase.py +-------------------------------------------------- +requirements: ArcGIS X.X, Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +history: +12/16/2015 - JH - initial creation +09/20/2016 - MF - Update to two method test pattern +================================================== +''' + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class HotSpotsByAreaTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Hot Spots by Area tool + in the Incident Analysis toolbox''' + + inputAOIFeatures = None + inputIncidents = None + + def setUp(self): + if Configuration.DEBUG == True: print(".....HotSpotsByAreaTestCase.setUp") + UnitTestUtilities.checkArcPy() + + Configuration.incidentDataPath = DataDownload.runDataDownload(Configuration.patternsPaths, Configuration.incidentGDBName, Configuration.incidentURL) + if (Configuration.incidentScratchGDB == None) or (not arcpy.Exists(Configuration.incidentScratchGDB)): + Configuration.incidentScratchGDB = UnitTestUtilities.createScratch(Configuration.incidentDataPath) + Configuration.incidentInputGDB = os.path.join(Configuration.incidentDataPath, Configuration.incidentGDBName) + UnitTestUtilities.checkFilePaths([Configuration.incidentDataPath, Configuration.incidentInputGDB, Configuration.patterns_ProToolboxPath, Configuration.patterns_DesktopToolboxPath]) + + self.inputAOIFeatures = os.path.join(Configuration.incidentInputGDB, "Districts") + self.inputIncidents = os.path.join(Configuration.incidentInputGDB, "Incidents") + + def tearDown(self): + if Configuration.DEBUG == True: print(".....HotSpotsByAreaTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.incidentScratchGDB) + + def test_hot_spots_by_area_pro(self): + '''test_hot_spots_by_area_pro''' + if Configuration.DEBUG == True: print(".....HotSpotsByAreaTestCase.test_hot_spots_by_area_pro") + arcpy.ImportToolbox(Configuration.patterns_ProToolboxPath, "iaTools") + runToolMessage = "Running tool (Hot Spots By Area - Pro)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + incidentFieldName = "district" + outputWorkspace = Configuration.incidentDataPath + # second parameter: inputIncidents must be a Feature Layer + arcpy.MakeFeatureLayer_management(self.inputIncidents, "incidentsLayer") + try: + arcpy.HotSpotsByArea_iaTools(self.inputAOIFeatures, "incidentsLayer", incidentFieldName, outputWorkspace) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in HotSpotsByArea_iaTools for Pro toolbox \n' + msg) + self.assertTrue(arcpy.Exists(outputWorkspace)) + + def test_hot_spots_by_area_desktop(self): + '''test_hot_spots_by_area_desktop''' + if Configuration.DEBUG == True: print(".....HotSpotsByAreaTestCase.test_hot_spots_by_area_desktop") + arcpy.ImportToolbox(Configuration.patterns_DesktopToolboxPath, "iaTools") + runToolMessage = "Running tool (Hot Spots By Area - Desktop)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + incidentFieldName = "district" + outputWorkspace = Configuration.incidentDataPath + # second parameter: inputIncidents must be a Feature Layer + arcpy.MakeFeatureLayer_management(self.inputIncidents, "incidentsLayer") + try: + arcpy.HotSpotsByArea_iaTools(self.inputAOIFeatures, "incidentsLayer", incidentFieldName, outputWorkspace) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in HotSpotsByArea_iaTools for Desktop toolbox \n' + msg) + self.assertTrue(arcpy.Exists(outputWorkspace)) diff --git a/utils/test/patterns_tests/IncidentAnalysisToolsTestSuite.py b/utils/test/patterns_tests/IncidentAnalysisToolsTestSuite.py new file mode 100644 index 00000000..11faa415 --- /dev/null +++ b/utils/test/patterns_tests/IncidentAnalysisToolsTestSuite.py @@ -0,0 +1,136 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +IncidentAnalysisToolsTestSuite.py +-------------------------------------------------- +requirements: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the Incident Analysis Tools toolbox test cases: +* ClusterAnalysisTestCase.py +* CountIncidentsByLOCTestCase.py +* FindPercentChangeTestCase.py +* HotSpotsByAreaTestCase.py +* IncidentDensityTestCase.py +* IncidentHotSpotsTestCase.py + +================================================== +history: +10/23/2015 - MF - intial coding started +04/25/2017 - EL - removed IncidentTableToPointTestCase.py +================================================== +''' + +import logging +import unittest +import Configuration + +''' Test suite for all test cases for the Incident Analysis Tools toolbox ''' +TestSuite = unittest.TestSuite() + +def getIncidentAnalysisTestSuite(): + ''' Run the Incident Analysis tests as either Pro or Desktop''' + + cluster_desktopTests = ['test_cluster_analysis_desktop'] + cluster_proTests = ['test_cluster_analysis_pro'] + count_desktopTests = ['test_count_incidents_desktop'] + count_proTests = ['test_count_incidents_pro'] + density_desktopTests = ['test_incident_density_desktop'] + density_proTests = ['test_incident_density_pro'] + hotSpots_desktopTests = ['test_hot_spots_by_area_desktop'] + hotSpots_proTests = ['test_hot_spots_by_area_pro'] + incidentHotSpots_desktopTests = ['test_incident_hot_spots_desktop'] + incidentHotSpots_proTests = ['test_incident_hot_spots_pro'] + percentChange_desktopTests = ['test_percent_change_desktop'] + percentChange_proTests = ['test_percent_change_pro'] + + if Configuration.DEBUG == True: print(" IncidentAnalysisToolsTestSuite.getIncidentAnalysisTestSuite") + + if Configuration.Platform == "PRO": + Configuration.Logger.info("Incident Analysis Tools Pro tests") + addClusterTests(cluster_proTests) + addCountIncidentTests(count_proTests) + addIncidentDensityTests(density_proTests) + addHotSpotsByAreaTests(hotSpots_proTests) + addIncidentHotSpotsTests(incidentHotSpots_proTests) + addFindPercentChangeTests(percentChange_proTests) + else: + Configuration.Logger.info("Incident Analysis Tools Desktop tests") + addClusterTests(cluster_desktopTests) + addCountIncidentTests(count_desktopTests) + addIncidentDensityTests(density_desktopTests) + addHotSpotsByAreaTests(hotSpots_desktopTests) + addIncidentHotSpotsTests(incidentHotSpots_desktopTests) + addFindPercentChangeTests(percentChange_desktopTests) + + return TestSuite + + +def addClusterTests(inputTestList): + if Configuration.DEBUG == True: print(" IncidentAnalysisToolsTestSuite.addClusterTests") + from . import ClusterAnalysisTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(ClusterAnalysisTestCase.ClusterAnalysisTestCase(test)) + +def addCountIncidentTests(inputTestList): + if Configuration.DEBUG == True: print(" IncidentAnalysisToolsTestSuite.addCountIncidentTests") + from . import CountIncidentsByLOCTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(CountIncidentsByLOCTestCase.CountIncidentsByLOCTestCase(test)) + +def addIncidentDensityTests(inputTestList): + if Configuration.DEBUG == True: print(" IncidentAnalysisToolsTestSuite.addIncidentDensityTests") + from . import IncidentDensityTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(IncidentDensityTestCase.IncidentDensityTestCase(test)) + +def addHotSpotsByAreaTests(inputTestList): + if Configuration.DEBUG == True: print(" IncidentAnalysisToolsTestSuite.addHotSpotsByAreaTests") + from . import HotSpotsByAreaTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(HotSpotsByAreaTestCase.HotSpotsByAreaTestCase(test)) + +def addIncidentHotSpotsTests(inputTestList): + if Configuration.DEBUG == True: print(" IncidentAnalysisToolsTestSuite.addIncidentHotSpotsTests") + from . import IncidentHotSpotsTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(IncidentHotSpotsTestCase.IncidentHotSpotsTestCase(test)) + +def addFindPercentChangeTests(inputTestList): + if Configuration.DEBUG == True: print(" IncidentAnalysisToolsTestSuite.addFindPercentChangeTests") + from . import FindPercentChangeTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(FindPercentChangeTestCase.FindPercentChangeTestCase(test)) + + diff --git a/utils/test/patterns_tests/IncidentDensityTestCase.py b/utils/test/patterns_tests/IncidentDensityTestCase.py new file mode 100644 index 00000000..6a3171c1 --- /dev/null +++ b/utils/test/patterns_tests/IncidentDensityTestCase.py @@ -0,0 +1,95 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +IncidentDensityTestCase.py +-------------------------------------------------- +requirments: ArcGIS X.X, Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +history: +12/16/2015 - JH - initial creation +09/20/2016 - MF - Update to two method test pattern +================================================== +''' + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class IncidentDensityTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Incident Density tool + in the Incident Analysis toolbox''' + + inputPointFeatures = None + inputBoundaryFeatures = None + + def setUp(self): + if Configuration.DEBUG == True: print(".....IncidentDensityTestCase.setUp") + UnitTestUtilities.checkArcPy() + + Configuration.incidentDataPath = DataDownload.runDataDownload(Configuration.patternsPaths, Configuration.incidentGDBName, Configuration.incidentURL) + if (Configuration.incidentScratchGDB == None) or (not arcpy.Exists(Configuration.incidentScratchGDB)): + Configuration.incidentScratchGDB = UnitTestUtilities.createScratch(Configuration.incidentDataPath) + Configuration.incidentInputGDB = os.path.join(Configuration.incidentDataPath, Configuration.incidentGDBName) + + UnitTestUtilities.checkFilePaths([Configuration.incidentDataPath, Configuration.incidentInputGDB, Configuration.patterns_ProToolboxPath, Configuration.patterns_DesktopToolboxPath]) + + self.inputPointFeatures = os.path.join(Configuration.incidentInputGDB, "Incidents") + self.inputBoundaryFeatures = os.path.join(Configuration.incidentInputGDB, "Districts") + + def tearDown(self): + if Configuration.DEBUG == True: print(".....IncidentDensityTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.incidentScratchGDB) + + def test_incident_density_pro(self): + '''test_incident_density_pro''' + if Configuration.DEBUG == True: print(".....IncidentDensityTestCase.test_incident_density_pro") + arcpy.CheckOutExtension("Spatial") + arcpy.ImportToolbox(Configuration.patterns_ProToolboxPath, "iaTools") + runToolMsg = "Running tool (Incident Density)" + arcpy.AddMessage(runToolMsg) + Configuration.Logger.info(runToolMsg) + outputDensity = os.path.join(Configuration.incidentScratchGDB, "outputDensity") + try: + arcpy.IncidentDensity_iaTools(self.inputPointFeatures, self.inputBoundaryFeatures, outputDensity) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in IncidentDensity_iaTools for Pro toolbox \n' + msg) + arcpy.CheckInExtension("Spatial") + self.assertTrue(arcpy.Exists(outputDensity)) + + def test_incident_density_desktop(self): + '''test_incident_density_desktop''' + if Configuration.DEBUG == True: print(".....IncidentDensityTestCase.test_incident_density_desktop") + arcpy.CheckOutExtension("Spatial") + arcpy.ImportToolbox(Configuration.patterns_DesktopToolboxPath, "iaTools") + runToolMsg = "Running tool (Incident Density)" + arcpy.AddMessage(runToolMsg) + Configuration.Logger.info(runToolMsg) + outputDensity = os.path.join(Configuration.incidentScratchGDB, "outputDensity") + try: + arcpy.IncidentDensity_iaTools(self.inputPointFeatures, self.inputBoundaryFeatures, outputDensity) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in IncidentDensity_iaTools for Desktop toolbox \n' + msg) + arcpy.CheckInExtension("Spatial") + self.assertTrue(arcpy.Exists(outputDensity)) diff --git a/utils/test/patterns_tests/IncidentHotSpotsTestCase.py b/utils/test/patterns_tests/IncidentHotSpotsTestCase.py new file mode 100644 index 00000000..e3c21f5e --- /dev/null +++ b/utils/test/patterns_tests/IncidentHotSpotsTestCase.py @@ -0,0 +1,92 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +IncidentHotSpotsTestCase.py +-------------------------------------------------- +requirments: ArcGIS X.X, Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +history: +12/16/2015 - JH - initial creation +09/20/2016 - MF - Update to two method test pattern +================================================== +''' + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class IncidentHotSpotsTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Incident Hot Spots tool + in the Incident Analysis toolbox''' + + inputPointFeatures = None + inputBoundaryFeatures = None + + def setUp(self): + if Configuration.DEBUG == True: print(".....IncidentHotSpotsTestCase.setUp") + UnitTestUtilities.checkArcPy() + Configuration.incidentDataPath = DataDownload.runDataDownload(Configuration.patternsPaths, Configuration.incidentGDBName, Configuration.incidentURL) + if (Configuration.incidentScratchGDB == None) or (not arcpy.Exists(Configuration.incidentScratchGDB)): + Configuration.incidentScratchGDB = UnitTestUtilities.createScratch(Configuration.incidentDataPath) + Configuration.incidentInputGDB = os.path.join(Configuration.incidentDataPath, Configuration.incidentGDBName) + UnitTestUtilities.checkFilePaths([Configuration.incidentDataPath, Configuration.incidentInputGDB, Configuration.patterns_ProToolboxPath, Configuration.patterns_DesktopToolboxPath]) + self.inputPointFeatures = os.path.join(Configuration.incidentInputGDB, "Incidents") + self.inputBoundaryFeatures = os.path.join(Configuration.incidentInputGDB, "Districts") + + def tearDown(self): + if Configuration.DEBUG == True: print(".....IncidentHotSpotsTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.incidentScratchGDB) + + def test_incident_hot_spots_pro(self): + '''test_incident_hot_spots_pro''' + if Configuration.DEBUG == True: print(".....IncidentHotSpotsTestCase.test_incident_hot_spots_pro") + arcpy.ImportToolbox(Configuration.patterns_ProToolboxPath, "iaTools") + runToolMessage = "Running tool (Incident Hot Spots - Pro)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + outputFeatures = os.path.join(Configuration.incidentScratchGDB, "outputHotSpots") + try: + arcpy.IncidentHotSpots_iaTools(self.inputPointFeatures, self.inputBoundaryFeatures, outputFeatures) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in IncidentHotSpots_iaTools for Pro toolbox \n' + msg) + result = arcpy.GetCount_management(outputFeatures) + featureCount = int(result.getOutput(0)) + self.assertEqual(featureCount, int(7302)) + + def test_incident_hot_spots_desktop(self): + '''test_incident_hot_spots_desktop''' + if Configuration.DEBUG == True: print(".....IncidentHotSpotsTestCase.test_incident_hot_spots_desktop") + arcpy.ImportToolbox(Configuration.patterns_DesktopToolboxPath, "iaTools") + runToolMessage = "Running tool (Incident Hot Spots - Desktop)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + outputFeatures = os.path.join(Configuration.incidentScratchGDB, "outputHotSpots") + try: + arcpy.IncidentHotSpots_iaTools(self.inputPointFeatures, self.inputBoundaryFeatures, outputFeatures) + except: + msg = arcpy.GetMessages(2) + self.fail('Exception in IncidentHotSpots_iaTools for Desktop toolbox \n' + msg) + result = arcpy.GetCount_management(outputFeatures) + featureCount = int(result.getOutput(0)) + self.assertEqual(featureCount, int(7302)) diff --git a/utils/test/patterns_tests/__init__.py b/utils/test/patterns_tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/utils/test/suitability_tests/AllSuitabilityTestSuite.py b/utils/test/suitability_tests/AllSuitabilityTestSuite.py new file mode 100644 index 00000000..d30bfb6d --- /dev/null +++ b/utils/test/suitability_tests/AllSuitabilityTestSuite.py @@ -0,0 +1,54 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +AllSuitabilityTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the suitability toolbox test suites: +* MilitaryAspectsOfWeatherTestSuite.py + +================================================== +history: +2/9/2016 - JH - creation +================================================== +''' + +import logging +import unittest +import Configuration +from . import MilitaryAspectsOfWeatherTestSuite +from . import MaritimeDecisionAidToolsTestSuite + +def getSuitabilityTestSuites(): + ''' This pulls together all of the toolbox test suites in this folder ''' + if Configuration.DEBUG == True: + print(" AllSuitabilityTestSuite.getSuitabilityTestSuites") + Configuration.Logger.info("Adding Suitability tests including: ") + testSuite = unittest.TestSuite() + + testSuite.addTests(MilitaryAspectsOfWeatherTestSuite.getWeatherTestSuite()) + testSuite.addTests(MaritimeDecisionAidToolsTestSuite.getMaritimeTestSuite()) + + return testSuite + \ No newline at end of file diff --git a/utils/test/suitability_tests/FarthestOnCircleTestCase.py b/utils/test/suitability_tests/FarthestOnCircleTestCase.py new file mode 100644 index 00000000..0226b1b3 --- /dev/null +++ b/utils/test/suitability_tests/FarthestOnCircleTestCase.py @@ -0,0 +1,97 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# FarthestOnCircleTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +# * Python 2.7 or Python 3.4 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 3/1/2016 - JH - initial creation +# ================================================== + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class FarthestOnCircleTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Farthest On Circle tool + in the Maritime Decision Aid toolbox''' + + maritimeDataGDB = None + position = None + hoursOfTransit = None + + def setUp(self): + if Configuration.DEBUG == True: print(" FarthestOnCircleTestCase.setUp") + + UnitTestUtilities.checkArcPy() + Configuration.maritimeDataPath = DataDownload.runDataDownload(Configuration.suitabilityPaths, Configuration.maritimeGDBName, Configuration.maritimeURL) + if(Configuration.maritimeScratchGDB == None) or (not arcpy.Exists(Configuration.maritimeScratchGDB)): + Configuration.maritimeScratchGDB = UnitTestUtilities.createScratch(Configuration.maritimeDataPath) + + self.maritimeDataGDB = os.path.join(Configuration.maritimeDataPath, "Maritime Decision Aid Tools.gdb") + + self.position = os.path.join(self.maritimeDataGDB, "Vessel") + self.hoursOfTransit = os.path.join(Configuration.maritimeScratchGDB, "hoursOutput") + UnitTestUtilities.checkFilePaths([Configuration.maritimeDataPath, Configuration.maritime_DesktopToolboxPath, Configuration.maritime_ProToolboxPath]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" FarthestOnCircleTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.maritimeScratchGDB) + + def test_farthest_on_circle_desktop(self): + arcpy.AddMessage("Testing Farthest On Circle (Desktop).") + self.test_farthest_on_cirle(Configuration.maritime_DesktopToolboxPath) + + def test_farthest_on_circle_pro(self): + arcpy.AddMessage("Testing Farthest On Circle (Pro).") + self.test_farthest_on_cirle(Configuration.maritime_ProToolboxPath) + + def test_farthest_on_cirle(self, toolboxPath): + try: + if Configuration.DEBUG == True: print(" FarthestOnCircleTestCase.test_farthest_on_cirle") + + arcpy.ImportToolbox(toolboxPath, "mdat") + runToolMessage = "Running tool (Farthest On Circle)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.CheckOutExtension("Spatial") + arcpy.FarthestOnCircle_mdat(self.position, "#", "#", self.hoursOfTransit) + + self.assertTrue(arcpy.Exists(self.hoursOfTransit)) + + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + + finally: + arcpy.CheckInExtension("Spatial") + + \ No newline at end of file diff --git a/utils/test/suitability_tests/FindSubmarinesTestCase.py b/utils/test/suitability_tests/FindSubmarinesTestCase.py new file mode 100644 index 00000000..7ab71cb5 --- /dev/null +++ b/utils/test/suitability_tests/FindSubmarinesTestCase.py @@ -0,0 +1,92 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# FindSubmarinesTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X +# * Python 2.7 or Python 3.4 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 3/1/2016 - JH - initial creation +# ================================================== + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class FindSubmarinesTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Find Submarine Canyons tool + in the Maritime Decision Aid toolbox''' + + useableCanyons = None + + def setUp(self): + if Configuration.DEBUG == True: print(" FindSubmarinesTestCase.setUp") + + UnitTestUtilities.checkArcPy() + Configuration.maritimeDataPath = DataDownload.runDataDownload(Configuration.suitabilityPaths, Configuration.maritimeGDBName, Configuration.maritimeURL) + if(Configuration.maritimeScratchGDB == None) or (not arcpy.Exists(Configuration.maritimeScratchGDB)): + Configuration.maritimeScratchGDB = UnitTestUtilities.createScratch(Configuration.maritimeDataPath) + + self.useableCanyons = os.path.join(Configuration.maritimeScratchGDB, "canyonsOutput") + UnitTestUtilities.checkFilePaths([Configuration.maritimeDataPath, Configuration.maritime_DesktopToolboxPath, Configuration.maritime_ProToolboxPath]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" FindSubmarinesTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.maritimeScratchGDB) + + def test_find_submarine_desktop(self): + arcpy.AddMessage("Testing Find Submarines (Desktop).") + self.test_find_submarine(Configuration.maritime_DesktopToolboxPath) + + def test_find_submarine_pro(self): + arcpy.AddMessage("Testing Find Submarines (Pro).") + self.test_find_submarine(Configuration.maritime_ProToolboxPath) + + def test_find_submarine(self, toolboxPath): + try: + if Configuration.DEBUG == True: print(" FindSubmarinesTestCase.test_find_submarine") + + arcpy.ImportToolbox(toolboxPath, "mdat") + runToolMessage = "Running tool (Find Submarines)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.CheckOutExtension("Spatial") + arcpy.UseableSubmarineCanyons_mdat("#", "#", "#", self.useableCanyons) + + self.assertTrue(arcpy.Exists(self.useableCanyons)) + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + + finally: + arcpy.CheckInExtension("Spatial") + + + \ No newline at end of file diff --git a/utils/test/suitability_tests/ImportCRUToRasterTestCase.py b/utils/test/suitability_tests/ImportCRUToRasterTestCase.py new file mode 100644 index 00000000..3f1165e5 --- /dev/null +++ b/utils/test/suitability_tests/ImportCRUToRasterTestCase.py @@ -0,0 +1,85 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# ImportCRUToRasterTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ +# * Python 2.7 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 2/10/2016 - JH - initial creation +# ================================================== + + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class ImportCRUToRasterTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Import CRU CL 2.0 To Raster tool + in the Military Aspects of Weather toolbox''' + + inputCRUFolder = None + outputWorkspace = None + + def setUp(self): + if Configuration.DEBUG == True: print(" ImportCRUToRasterTestCase.setUp") + UnitTestUtilities.checkArcPy() + + Configuration.suitabilityDataPath = DataDownload.runDataDownload(Configuration.suitabilityPaths, "MilitaryAspectsOfWeatherTestData", Configuration.maowURL) + self.inputCRUFolder = os.path.join(Configuration.suitabilityDataPath, "CRUdata") + self.outputWorkspace = os.path.join(Configuration.suitabilityDataPath, "CRURasters.gdb") + + UnitTestUtilities.checkFilePaths([Configuration.suitabilityDataPath, Configuration.maow_ToolboxPath, self.outputWorkspace]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" ImportCRUToRasterTestCase.tearDown") + + def test_import_cru_to_raster(self): + try: + if Configuration.DEBUG == True: print(" ImportCRUToRasterTestCase.test_import_cru_to_raster") + arcpy.AddMessage("Testing Import CRU CL2.0 To Raster (Desktop)") + + arcpy.ImportToolbox(Configuration.maow_ToolboxPath, "maow") + runToolMessage = "Running tool (Import CRU CL2.0 To Raster)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.ImportCRUCL2ToRaster_maow(self.inputCRUFolder, self.outputWorkspace) + + # check that dtr_feb raster exists, then check that its bandCount = 1 + dtr_feb_output = os.path.join(self.outputWorkspace, "dtr_feb") + self.assertTrue(arcpy.Exists(dtr_feb_output)) + dtr_desc = arcpy.Describe(dtr_feb_output) + self.assertEqual(dtr_desc.bandCount, int(1)) + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + + + \ No newline at end of file diff --git a/utils/test/suitability_tests/ImportWMOStationDataTestCase.py b/utils/test/suitability_tests/ImportWMOStationDataTestCase.py new file mode 100644 index 00000000..505d517c --- /dev/null +++ b/utils/test/suitability_tests/ImportWMOStationDataTestCase.py @@ -0,0 +1,88 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# ImportWMOStationDataTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X +# * Python 2.7 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 2/10/2016 - JH - initial creation +# ================================================== + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class ImportWMOStationDataTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Import WMO Station Data tool + in the Military Aspects of Weather toolbox''' + + WMOGDB = None + WMOFolder = None + StationDataInputFC = None + StationDataOutputFC = None + outputFCName = None + + def setUp(self): + if Configuration.DEBUG == True: print(" ImportWMOStationDataTestCase.setUp") + UnitTestUtilities.checkArcPy() + self.outputFCName = "WMOStationData" + + # DO NOT run data download again; dependent data is needed from the ImportWMOStationsTestCase + self.WMOGDB = os.path.join(Configuration.suitabilityDataPath, "WMO.gdb") + + self.StationDataInputFC = os.path.join(self.WMOGDB, "WMOFC_output") + self.StationDataOutputFC = os.path.join(self.WMOGDB, self.outputFCName) + self.WMOFolder = os.path.join(Configuration.suitabilityDataPath, "WMOStationFiles") + + UnitTestUtilities.checkFilePaths([Configuration.suitabilityDataPath, Configuration.maow_ToolboxPath, self.WMOFolder, self.WMOGDB]) + UnitTestUtilities.deleteIfExists(self.StationDataOutputFC) + + def tearDown(self): + if Configuration.DEBUG == True: print(" ImportWMOStationDataTestCase.tearDown") + + def test_import_wmo_station_data(self): + try: + if Configuration.DEBUG == True: print(" ImportWMOStationDataTestCase.test_import_wmo_station_data") + arcpy.AddMessage("Testing Import WMO Station Data (Desktop)") + + arcpy.ImportToolbox(Configuration.maow_ToolboxPath, "maow") + runToolMessage = "Running tool (Import WMO Station Data)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.ImportWMOStationData_maow(self.WMOGDB, self.outputFCName, self.WMOFolder, self.StationDataInputFC) + + wmoStationCount = int(arcpy.GetCount_management(self.StationDataOutputFC).getOutput(0)) + self.assertEqual(wmoStationCount, int(252)) + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + + \ No newline at end of file diff --git a/utils/test/suitability_tests/ImportWMOStationsTestCase.py b/utils/test/suitability_tests/ImportWMOStationsTestCase.py new file mode 100644 index 00000000..8cfbc890 --- /dev/null +++ b/utils/test/suitability_tests/ImportWMOStationsTestCase.py @@ -0,0 +1,85 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# ImportWMOStationsTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ +# * Python 2.7 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 2/10/2016 - JH - initial creation +# ================================================== + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class ImportWMOStationsTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Import WMO Station Data tool + in the Military Aspects of Weather toolbox''' + + WMOGDB = None + WMOStationsFC = None + stationsTextFile = None + + def setUp(self): + if Configuration.DEBUG == True: print(" ImportWMOStationsTestCase.setUp") + UnitTestUtilities.checkArcPy() + Configuration.suitabilityDataPath = DataDownload.runDataDownload(Configuration.suitabilityPaths, "MilitaryAspectsOfWeatherTestData", Configuration.maowURL) + self.stationsTextFile = os.path.join(Configuration.suitabilityDataPath, "WMOStations.tab") + self.WMOGDB = os.path.join(Configuration.suitabilityDataPath, "WMO.gdb") + self.WMOStationsFC = os.path.join(self.WMOGDB, "WMOFC_output") + + UnitTestUtilities.checkFilePaths([Configuration.suitabilityDataPath, Configuration.maow_ToolboxPath, self.WMOGDB]) + UnitTestUtilities.deleteIfExists(self.WMOStationsFC) + + def tearDown(self): + if Configuration.DEBUG == True: print(" ImportWMOStationsTestCase.tearDown") + + def test_import_wmo_stations(self): + try: + if Configuration.DEBUG == True: print(" ImportWMOStationsTestCase.test_import_wmo_stations") + arcpy.AddMessage("Testing Import WMO Stations (Desktop)") + + arcpy.ImportToolbox(Configuration.maow_ToolboxPath, "maow") + runToolMessage = "Running tool (Import WMO Stations)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.ImportWMOStations_maow(self.stationsTextFile, self.WMOStationsFC) + + # 12718 features should be in output feature class + wmoStationCount = int(arcpy.GetCount_management(self.WMOStationsFC).getOutput(0)) + self.assertEqual(wmoStationCount, int(12718)) + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + + + + \ No newline at end of file diff --git a/utils/test/suitability_tests/MaritimeDecisionAidToolsTestSuite.py b/utils/test/suitability_tests/MaritimeDecisionAidToolsTestSuite.py new file mode 100644 index 00000000..3a5851f1 --- /dev/null +++ b/utils/test/suitability_tests/MaritimeDecisionAidToolsTestSuite.py @@ -0,0 +1,122 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +MaritimeDecisionAidToolsTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the Maritime Decision Aid Tools toolbox test cases: +* FindSubmarinesTestCase.py +* FarthestOnCircleTestCase.py +* SubDepthRestrictionSuitabilityTestCase.py +* SubSpecificationsTestCase.py +* VisibilityRangeAtSeaTestCase.py +================================================== +history: +2/29/2016 - JH - creation +================================================== +''' + +import logging +import unittest +import Configuration + +TestSuite = unittest.TestSuite() + +def getMaritimeTestSuite(): + ''' Run the Maritime Decision Aid Tools tests (Desktop and Pro)''' + + findSubmarineProTests = ['test_find_submarine_pro'] + findSubmarineDesktopTests = ['test_find_submarine_desktop'] + subDepthRestrictionSuitabilityProTests = ['test_sub_depth_restriction_suitability_pro'] + subDepthRestribtionSuitabilityDesktopTests = ['test_sub_depth_restriction_suitability_desktop'] + subSpecificationsProTests = ['test_sub_specifications_pro'] + subSpecificationsDesktopTests = ['test_sub_specifications_desktop'] + visibilityRangeAtSeaProTests = ['test_visibility_range_at_sea_pro'] + visibilityRangeAtSeaDesktopTests = ['test_visibility_range_at_sea_desktop'] + farthestOnCircleProTests = ['test_farthest_on_circle_pro'] + farthestOnCircleDesktopTests = ['test_farthest_on_circle_desktop'] + + if Configuration.DEBUG == True: print(" MaritimeDecisionAidToolsTestSuite.getMaritimeTestSuite") + + if Configuration.Platform == "DESKTOP": + Configuration.Logger.info("Maritime Decision Aid Tools Desktop tests") + addFindSubmarineTests(findSubmarineDesktopTests) + addSubSpecificationsTests(subSpecificationsDesktopTests) + addSubDepthRestrictionTests(subDepthRestribtionSuitabilityDesktopTests) + addVisibilityRangeTests(visibilityRangeAtSeaDesktopTests) + addFarthestOnCircleTests(farthestOnCircleDesktopTests) + + else: + Configuration.Logger.info("Maritime Decision Aid Tools Pro tests") + addFindSubmarineTests(findSubmarineProTests) + addSubSpecificationsTests(subSpecificationsProTests) + addSubDepthRestrictionTests(subDepthRestrictionSuitabilityProTests) + addVisibilityRangeTests(visibilityRangeAtSeaProTests) + addFarthestOnCircleTests(farthestOnCircleProTests) + + return TestSuite + + +def addFindSubmarineTests(inputTestList): + if Configuration.DEBUG == True: print(" MaritimeDecisionAidToolsTestSuite.addFindSubmarineTests") + from . import FindSubmarinesTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(FindSubmarinesTestCase.FindSubmarinesTestCase(test)) + +def addSubDepthRestrictionTests(inputTestList): + if Configuration.DEBUG == True: print(" MaritimeDecisionAidToolsTestSuite.addSubDepthRestrictionTests") + from . import SubDepthRestrictionSuitabilityTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(SubDepthRestrictionSuitabilityTestCase.SubDepthRestrictionSuitabilityTestCase(test)) + +def addSubSpecificationsTests(inputTestList): + if Configuration.DEBUG == True: print(" MaritimeDecisionAidToolsTestSuite.addSubSpecificationsTests") + from . import SubSpecificationsTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(SubSpecificationsTestCase.SubSpecificationsTestCase(test)) + +def addVisibilityRangeTests(inputTestList): + if Configuration.DEBUG == True: print(" MaritimeDecisionAidToolsTestSuite.addVisibilityRangeTests") + from . import VisibilityRangeAtSeaTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(VisibilityRangeAtSeaTestCase.VisibilityRangeAtSeaTestCase(test)) + +def addFarthestOnCircleTests(inputTestList): + if Configuration.DEBUG == True: print(" MaritimeDecisionAidToolsTestSuite.addFarthestOnCircleTests") + from . import FarthestOnCircleTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(FarthestOnCircleTestCase.FarthestOnCircleTestCase(test)) + + + \ No newline at end of file diff --git a/utils/test/suitability_tests/MilitaryAspectsOfWeatherTestSuite.py b/utils/test/suitability_tests/MilitaryAspectsOfWeatherTestSuite.py new file mode 100644 index 00000000..d6dc07d8 --- /dev/null +++ b/utils/test/suitability_tests/MilitaryAspectsOfWeatherTestSuite.py @@ -0,0 +1,97 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +MilitaryAspectsOfWeatherTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ +* Python 2.7 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the Military Aspects of Weather toolbox test cases: +* ImportWMOStationDataTestCase.py +* ImportWMOStationsTestCase.py +* ImportCRUToRasterTestCase.py +* SubsetRasterWorkspaceTestCase.py +================================================== +history: +2/9/2016 - JH - creation +================================================== +''' + +import logging +import unittest +import Configuration + +TestSuite = unittest.TestSuite() + +def getWeatherTestSuite(): + ''' Run the Military Aspects of Weather tests (Desktop only)''' + + importWMODataTests = ['test_import_wmo_station_data'] + importWMOStationsTests = ['test_import_wmo_stations'] + importCRUToRasterTests = ['test_import_cru_to_raster'] + subsetRasterWorkspaceTests = ['test_subset_raster_workspace'] + + if Configuration.DEBUG == True: print(" MilitaryAspectsOfWeatherTestSuite.getWeatherTestSuite") + + if Configuration.Platform == "DESKTOP": + Configuration.Logger.info("Military Aspects of Weather Desktop tests") + addWMOStationsTests(importWMOStationsTests) + addWMOStationDataTests(importWMODataTests) + addCRUToRasterTests(importCRUToRasterTests) + addSubsetRasterWorkspaceTests(subsetRasterWorkspaceTests) + + return TestSuite + + +def addWMOStationDataTests(inputTestList): + if Configuration.DEBUG == True: print(" MilitaryAspectsOfWeatherTestSuite.addWMOStationDataTests") + from . import ImportWMOStationDataTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(ImportWMOStationDataTestCase.ImportWMOStationDataTestCase(test)) + +def addWMOStationsTests(inputTestList): + if Configuration.DEBUG == True: print(" MilitaryAspectsOfWeatherTestSuite.addWMOStationsTests") + from . import ImportWMOStationsTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(ImportWMOStationsTestCase.ImportWMOStationsTestCase(test)) + +def addCRUToRasterTests(inputTestList): + if Configuration.DEBUG == True: print(" MilitaryAspectsOfWeatherTestSuite.addCRUToRasterTests") + from . import ImportCRUToRasterTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(ImportCRUToRasterTestCase.ImportCRUToRasterTestCase(test)) + +def addSubsetRasterWorkspaceTests(inputTestList): + if Configuration.DEBUG == True: print(" MilitaryAspectsOfWeatherTestSuite.addSubsetRasterWorkspaceTests") + from . import SubsetRasterWorkspaceTestCase + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + TestSuite.addTest(SubsetRasterWorkspaceTestCase.SubsetRasterWorkspaceTestCase(test)) + + \ No newline at end of file diff --git a/utils/test/suitability_tests/SubDepthRestrictionSuitabilityTestCase.py b/utils/test/suitability_tests/SubDepthRestrictionSuitabilityTestCase.py new file mode 100644 index 00000000..39361bf9 --- /dev/null +++ b/utils/test/suitability_tests/SubDepthRestrictionSuitabilityTestCase.py @@ -0,0 +1,100 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# SubDepthRestrictionSuitabilityTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +# * Python 2.7 or Python 3.4 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 3/1/2016 - JH - initial creation +# ================================================== + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class SubDepthRestrictionSuitabilityTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Sub Depth Restriction Suitability tool + in the Maritime Decision Aid toolbox''' + + maritimeGDB = None + bathymetry = None + subDepthOutput = None + + def setUp(self): + if Configuration.DEBUG == True: print(" SubDepthRestrictionSuitabilityTestCase.setUp") + + UnitTestUtilities.checkArcPy() + Configuration.maritimeDataPath = DataDownload.runDataDownload(Configuration.suitabilityPaths, Configuration.maritimeGDBName, Configuration.maritimeURL) + if(Configuration.maritimeScratchGDB == None) or (not arcpy.Exists(Configuration.maritimeScratchGDB)): + Configuration.maritimeScratchGDB = UnitTestUtilities.createScratch(Configuration.maritimeDataPath) + + self.maritimeDataGDB = os.path.join(Configuration.maritimeDataPath, "Maritime Decision Aid Tools.gdb") + + self.bathymetry = os.path.join(self.maritimeDataGDB, "SoCalDepthsGEBCO") + self.subDepthOutput = os.path.join(Configuration.maritimeScratchGDB, "SubDepth") + UnitTestUtilities.checkFilePaths([Configuration.maritimeDataPath, Configuration.maritime_DesktopToolboxPath, Configuration.maritime_ProToolboxPath]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" SubDepthRestrictionSuitabilityTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.maritimeScratchGDB) + + def test_sub_depth_restriction_suitability_desktop(self): + arcpy.AddMessage("Testing Sub Depth Restriction Suitability (Desktop).") + self.test_sub_depth_restriction_suitability(Configuration.maritime_DesktopToolboxPath) + + def test_sub_depth_restriction_suitability_pro(self): + arcpy.AddMessage("Testing Sub Depth Restriction Suitability (Pro).") + self.test_sub_depth_restriction_suitability(Configuration.maritime_ProToolboxPath) + + def test_sub_depth_restriction_suitability(self, toolboxPath): + try: + if Configuration.DEBUG == True: print(" SubDepthRestrictionSuitabilityTestCase.test_sub_depth_restriction_suitability") + + arcpy.ImportToolbox(toolboxPath, "mdat") + runToolMessage = "Running tool (Sub Depth Restriction Suitability)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.CheckOutExtension("Spatial") + arcpy.SubDepthRestrictionSuitability_mdat(self.bathymetry, Submarine_Depth_Navigability=self.subDepthOutput) + + subs = int(arcpy.GetCount_management(self.subDepthOutput).getOutput(0)) + self.assertEqual(subs, int(856)) + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + + finally: + arcpy.CheckInExtension("Spatial") + + + + + \ No newline at end of file diff --git a/utils/test/suitability_tests/SubSpecificationsTestCase.py b/utils/test/suitability_tests/SubSpecificationsTestCase.py new file mode 100644 index 00000000..5577cb52 --- /dev/null +++ b/utils/test/suitability_tests/SubSpecificationsTestCase.py @@ -0,0 +1,81 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# SubSpecificationsTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +# * Python 2.7 or Python 3.4 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 3/1/2016 - JH - initial creation +# ================================================== + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class SubSpecificationsTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Sub Specifications tool + in the Maritime Decision Aid toolbox''' + + maritimeDataGDB = None + subSpecsTable = None + + def setUp(self): + if Configuration.DEBUG == True: print(" SubSpecificationsTestCase.setUp") + + UnitTestUtilities.checkArcPy() + self.maritimeDataGDB = os.path.join(Configuration.maritimeDataPath, "Maritime Decision Aid Tools.gdb") + self.subSpecsTable = os.path.join(self.maritimeDataGDB, "Sub_Specs") + UnitTestUtilities.checkFilePaths([Configuration.maritimeDataPath, Configuration.maritime_DesktopToolboxPath, Configuration.maritime_ProToolboxPath]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" SubSpecificationsTestCase.tearDown") + + def test_sub_specifications_desktop(self): + arcpy.AddMessage("Testing Sub Specifications (Desktop).") + self.test_sub_specifications(Configuration.maritime_DesktopToolboxPath) + + def test_sub_specifications_pro(self): + arcpy.AddMessage("Testing Sub Depth Restriction Suitability (Desktop).") + self.test_sub_specifications(Configuration.maritime_ProToolboxPath) + + def test_sub_specifications(self, toolboxPath): + try: + if Configuration.DEBUG == True: print(" SubSpecificationsTestCase.test_sub_specifications") + + arcpy.ImportToolbox(toolboxPath, "mdat") + runToolMessage = "Running tool (Sub Specifications)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.SubSpecifications_mdat(self.subSpecsTable) + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + \ No newline at end of file diff --git a/utils/test/suitability_tests/SubsetRasterWorkspaceTestCase.py b/utils/test/suitability_tests/SubsetRasterWorkspaceTestCase.py new file mode 100644 index 00000000..2e3f9ff8 --- /dev/null +++ b/utils/test/suitability_tests/SubsetRasterWorkspaceTestCase.py @@ -0,0 +1,85 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# SubsetRasterWorkspaceTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ +# * Python 2.7 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 2/10/2016 - JH - initial creation +# ================================================== + + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class SubsetRasterWorkspaceTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Subset Raster Workspace tool + in the Military Aspects of Weather toolbox''' + + sourceWorkspace = None + targetWorkspace = None + + def setUp(self): + if Configuration.DEBUG == True: print(" SubsetRasterWorkspaceTestCase.setUp") + UnitTestUtilities.checkArcPy() + + # DO NOT run data download again; dependent data is needed from ImportCRUToRasterTestCase + self.sourceWorkspace = os.path.join(Configuration.suitabilityDataPath, "CRURasters.gdb") + self.targetWorkspace = os.path.join(Configuration.suitabilityDataPath, "SubsetRasters.gdb") + + UnitTestUtilities.checkFilePaths([Configuration.suitabilityDataPath, Configuration.maow_ToolboxPath, self.sourceWorkspace, self.targetWorkspace]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" SubsetRasterWorkspaceTestCase.tearDown") + + def test_subset_raster_workspace(self): + try: + if Configuration.DEBUG == True: print(" SubsetRasterWorkspaceTestCase.test_subset_raster_workspace") + arcpy.AddMessage("Testing Subset Raster Workspace (Desktop)") + + arcpy.ImportToolbox(Configuration.maow_ToolboxPath, "maow") + runToolMessage = "Running tool (Subset Raster Workspace)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + inputAreaPath = os.path.join(self.sourceWorkspace, "AOI") + inputArea = arcpy.FeatureSet(inputAreaPath) + arcpy.SubsetRasterWorkspace_maow(inputArea, self.sourceWorkspace, self.targetWorkspace) + + dtr_feb_output = os.path.join(self.targetWorkspace, "dtr_feb") + self.assertTrue(arcpy.Exists(dtr_feb_output)) + dtr_desc = arcpy.Describe(dtr_feb_output) + self.assertEqual(dtr_desc.bandCount, int(1)) + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + + \ No newline at end of file diff --git a/utils/test/suitability_tests/VisibilityRangeAtSeaTestCase.py b/utils/test/suitability_tests/VisibilityRangeAtSeaTestCase.py new file mode 100644 index 00000000..e6d8f75f --- /dev/null +++ b/utils/test/suitability_tests/VisibilityRangeAtSeaTestCase.py @@ -0,0 +1,99 @@ +# coding: utf-8 +# ----------------------------------------------------------------------------- +# Copyright 2015 Esri +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ----------------------------------------------------------------------------- + +# ================================================== +# VisibilityRangeAtSeaTestCase.py +# -------------------------------------------------- +# requirements: +# * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +# * Python 2.7 or Python 3.4 +# +# author: ArcGIS Solutions +# company: Esri +# +# ================================================== +# history: +# 3/1/2016 - JH - initial creation +# ================================================== + +import unittest +import arcpy +import os +import UnitTestUtilities +import Configuration +import DataDownload + +class VisibilityRangeAtSeaTestCase(unittest.TestCase): + ''' Test all tools and methods related to the Visibility Range At Sea tool + in the Maritime Decision Aid toolbox''' + + maritimeDataGDB = None + visibleRange = None + vessel = None + shipLocation = None + + def setUp(self): + if Configuration.DEBUG == True: print(" VisibilityRangeAtSeaTestCase.setUp") + + UnitTestUtilities.checkArcPy() + Configuration.maritimeDataPath = DataDownload.runDataDownload(Configuration.suitabilityPaths, Configuration.maritimeGDBName, Configuration.maritimeURL) + if(Configuration.maritimeScratchGDB == None) or (not arcpy.Exists(Configuration.maritimeScratchGDB)): + Configuration.maritimeScratchGDB = UnitTestUtilities.createScratch(Configuration.maritimeDataPath) + + self.maritimeDataGDB = os.path.join(Configuration.maritimeDataPath, "Maritime Decision Aid Tools.gdb") + + self.visibleRange = os.path.join(Configuration.maritimeScratchGDB, "visRangeOutput") + self.vessel = os.path.join(Configuration.maritimeScratchGDB, "vesselOutput") + self.shipLocation = os.path.join(self.maritimeDataGDB, "Vessel") + + UnitTestUtilities.checkFilePaths([Configuration.maritimeDataPath, Configuration.maritime_DesktopToolboxPath, Configuration.maritime_ProToolboxPath]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" VisibilityRangeAtSeaTestCase.tearDown") + UnitTestUtilities.deleteScratch(Configuration.maritimeScratchGDB) + + def test_visibility_range_at_sea_desktop(self): + arcpy.AddMessage("Testing Visibility Range At Sea (Desktop).") + self.test_visibility_range_at_sea(Configuration.maritime_DesktopToolboxPath) + + def test_visibility_range_at_sea_pro(self): + arcpy.AddMessage("Testing Visibility Range At Sea (Pro).") + self.test_visibility_range_at_sea(Configuration.maritime_ProToolboxPath) + + def test_visibility_range_at_sea(self, toolboxPath): + try: + if Configuration.DEBUG == True: print(" VisibilityRangeAtSeaTestCase.test_visibility_range_at_sea") + + arcpy.ImportToolbox(toolboxPath, "mdat") + runToolMessage = "Running tool (Visibility Range At Sea)" + arcpy.AddMessage(runToolMessage) + Configuration.Logger.info(runToolMessage) + + arcpy.HorizonVisibility_mdat(self.shipLocation, "#", self.visibleRange, self.vessel) + + visibleRangeCount = int(arcpy.GetCount_management(self.visibleRange).getOutput(0)) + self.assertEqual(visibleRangeCount, int(1)) + + vesselCount = int(arcpy.GetCount_management(self.vessel).getOutput(0)) + self.assertEqual(vesselCount, int(1)) + + + except arcpy.ExecuteError: + UnitTestUtilities.handleArcPyError() + + except: + UnitTestUtilities.handleGeneralError() + \ No newline at end of file diff --git a/utils/test/suitability_tests/__init__.py b/utils/test/suitability_tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/utils/test/visibility_tests/AllVisibilityTestSuite.py b/utils/test/visibility_tests/AllVisibilityTestSuite.py new file mode 100644 index 00000000..8799b8d8 --- /dev/null +++ b/utils/test/visibility_tests/AllVisibilityTestSuite.py @@ -0,0 +1,55 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +AllVisibilityTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the visibility toolbox test suites: +* VisibilityAndRangeToolsTestSuite.py +* SunPositionAnalysisToolsTestSuite.py +* VisibilityDataPrepToolsTestSuite.py +* RangeRingTestSuite.py + +================================================== +history: +12/4/2015 - JH - original writeup +04/07/2016 - mf - added Range Rings test suite +================================================== +''' + +import unittest +import Configuration +from . import SunPositionAnalysisToolsTestSuite +from . import RangeRingTestSuite + +def getVisibilityTestSuites(): + ''' This pulls together all of the toolbox test suites in this folder ''' + if Configuration.DEBUG == True: + print(" AllVisibilityTestSuite.getVisibilityTestSuites") + Configuration.Logger.info("Adding Visibility Tests including: ") + testSuite = unittest.TestSuite() + + testSuite.addTests(SunPositionAnalysisToolsTestSuite.getSunPositionTestSuite()) + testSuite.addTests(RangeRingTestSuite.getRangeRingTestSuite()) + return testSuite diff --git a/visibility/test/test_viz_and_range/FindLocalPeaksTestCase.py b/utils/test/visibility_tests/FindLocalPeaksTestCase.py similarity index 88% rename from visibility/test/test_viz_and_range/FindLocalPeaksTestCase.py rename to utils/test/visibility_tests/FindLocalPeaksTestCase.py index d5bcdd7a..4a6ea3f5 100644 --- a/visibility/test/test_viz_and_range/FindLocalPeaksTestCase.py +++ b/utils/test/visibility_tests/FindLocalPeaksTestCase.py @@ -17,22 +17,21 @@ import logging import arcpy import unittest -import TestUtilities -import UnitTestCase +import Configuration import UnitTestUtilities -class FindLocalPeaksTestCase(UnitTestCase.UnitTestCase): +class FindLocalPeaksTestCase(unittest.TestCase): - visGDB = os.path.join(TestUtilities.vis_GeodatabasePath, "test_vis_and_range_inputs.gdb") + visGDB = os.path.join(Configuration.vis_GeodatabasePath, "test_vis_and_range_inputs.gdb") inputPolygonFC = os.path.join(visGDB, "samplePolygonArea") inputSurface = os.path.join(visGDB, "Jbad_SRTM_USGS_EROS") - outputPointsFC = os.path.join(TestUtilities.vis_ScratchPath, "LocalPeaks") + outputPointsFC = os.path.join(Configuration.vis_ScratchPath, "LocalPeaks") def setUp(self): UnitTestCase.UnitTestCase.setUp(self) - testObjects = [TestUtilities.visandRangeToolbox, self.visGDB, self.inputPolygonFC, self.inputSurface] + testObjects = [Configuration.visandRangeToolbox, self.visGDB, self.inputPolygonFC, self.inputSurface] UnitTestUtilities.checkGeoObjects(testObjects) - UnitTestUtilities.createScratch(TestUtilities.vis_ScratchPath) + UnitTestUtilities.createScratch(Configuration.vis_ScratchPath) def test_local_peaks(self): try: @@ -43,7 +42,7 @@ def test_local_peaks(self): raise Exception("LicenseError") print("Importing Visibility and Range Toolbox...") - arcpy.ImportToolbox(TestUtilities.visandRangeToolbox, "VandR") + arcpy.ImportToolbox(Configuration.visandRangeToolbox, "VandR") arcpy.env.overwriteOutput = True inputFeatureCount = int(arcpy.GetCount_management(self.inputPolygonFC).getOutput(0)) diff --git a/utils/test/visibility_tests/RangeRingTestSuite.py b/utils/test/visibility_tests/RangeRingTestSuite.py new file mode 100644 index 00000000..b2f0321f --- /dev/null +++ b/utils/test/visibility_tests/RangeRingTestSuite.py @@ -0,0 +1,92 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +RangeRingTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the @@@@@@@ toolbox test suites: + + +================================================== +history: +3/30/2016 - mf - original coding +================================================== +''' + +import unittest +import Configuration +from . import RangeRingUtilsTestCase + + +def getRangeRingTestSuite(): + ''' Range Rings test suite ''' + + desktopTestList = ['test_RingMaker_init', + 'test_RingMaker_sortList_empty', + 'test_RingMaker_sortList_isSorted', + 'test_RingMaker_addFieldsToTable', + 'test_RingMaker_makeTempTable', + 'test_RingMaker_makeRingsFromDistances', + 'test_RingMaker_saveRingsAsFeatures', + 'test_RingMaker_makeRadials', + 'test_RingMaker_saveRadialsAsFeatures', + 'test_rangeRingsFromMinMax', + 'test_rangeRingsFromList', + 'test_rangeRingsFromInterval'] + + proTestList = ['test_RingMaker_init', + 'test_RingMaker_sortList_empty', + 'test_RingMaker_sortList_isSorted', + 'test_RingMaker_addFieldsToTable', + 'test_RingMaker_makeTempTable', + 'test_RingMaker_makeRingsFromDistances', + 'test_RingMaker_saveRingsAsFeatures', + 'test_RingMaker_makeRadials', + 'test_RingMaker_saveRadialsAsFeatures', + 'test_rangeRingsFromMinMax', + 'test_rangeRingsFromList', + 'test_rangeRingsFromInterval'] + + if Configuration.DEBUG == True: + print(" RangerRingTestSuite.getRangeRingTestSuite") + + suite = unittest.TestSuite() + if Configuration.Platform == "PRO": + Configuration.Logger.info("Range Rings Pro tests") + suite = addTests(suite, proTestList) + else: + Configuration.Logger.info("Range Rings Desktop tests") + suite = addTests(suite, desktopTestList) + return suite + + +def addTests(suite, inputTestList): + ''' Add the list of tests to the test suite ''' + if Configuration.DEBUG == True: + print(" RangeRingTestSuite.addTests") + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + suite.addTest(RangeRingUtilsTestCase.RangeRingUtilsTestCase(test)) + return suite diff --git a/utils/test/visibility_tests/RangeRingUtilsTestCase.py b/utils/test/visibility_tests/RangeRingUtilsTestCase.py new file mode 100644 index 00000000..bdb2d002 --- /dev/null +++ b/utils/test/visibility_tests/RangeRingUtilsTestCase.py @@ -0,0 +1,301 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +RangeRingUtilsTestCase.py +-------------------------------------------------- +requirements: ArcGIS X.X, Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: unittest test case for Range Rings +================================================== +history: +03/30/2016 - mf - initial coding +04/07/2016 - mf - fit RR tests into s-g-t unit test stuff +================================================== +''' +import os +import sys +import arcpy +import unittest +import datetime +import logging +import Configuration +import UnitTestUtilities +import DataDownload + +# ============================================================================ +# Add RangeRingUtils.py module to python path +currentPath = os.path.dirname(__file__) +pathToRRUtils= os.path.normpath(os.path.join(currentPath, r"../../../visibility/toolboxes/scripts")) +sys.path.insert(0, pathToRRUtils) +import RangeRingUtils +# ============================================================================ + +class RangeRingUtilsTestCase(unittest.TestCase): + ''' Test all methods and classes in RangeRingUtils.py ''' + + def setUp(self): + ''' setup for tests''' + if Configuration.DEBUG == True: print(" RangeRingsUtilsTestCase.setUp") + + UnitTestUtilities.checkArcPy() + self.proToolboxPath = os.path.join(Configuration.vis_ToolboxesPath, + "Visibility and Range Tools.tbx") + self.desktopToolboxPath = os.path.join(Configuration.vis_ToolboxesPath, + "Visibility and Range Tools_10.4.tbx") + self.srWebMerc = arcpy.SpatialReference(3857) #WGS_1984_Web_Mercator + self.srWGS84 = arcpy.SpatialReference(4326) #GCS_WGS_1984 + self.srWAZED = arcpy.SpatialReference(54032) #World_Azimuthal_Equidistant + self.deleteme = [] + + self.DataGDB = None + self.rrDataPath = os.path.join(Configuration.visibilityPaths, 'data') + if (self.DataGDB == None) or (not arcpy.Exists(self.DataGDB)): + self.DataGDB = UnitTestUtilities.createScratch(self.rrDataPath) + + UnitTestUtilities.checkFilePaths([self.proToolboxPath, + self.desktopToolboxPath, + Configuration.visibilityPaths, + self.rrDataPath, + self.DataGDB]) + + + #create a temp point feature class + ptCoords = [[0.0, 0.0], [10.0, 10.0], [3.0, 3.0], [5.5, 1.5]] + tempfcPath = os.path.join("in_memory", "tempfc") + if arcpy.Exists(tempfcPath): + arcpy.Delete_management(tempfcPath) + self.pointGeographic = arcpy.CreateFeatureclass_management(os.path.dirname(tempfcPath), + os.path.basename(tempfcPath), + "POINT", "#", "DISABLED", + "DISABLED", self.srWGS84)[0] + with arcpy.da.InsertCursor(self.pointGeographic, ["SHAPE@XY"]) as cursor: + for (x, y) in ptCoords: + cursor.insertRow([(x, y)]) + del cursor + self.deleteme.append(self.pointGeographic) + return + + def tearDown(self): + ''' cleanup after tests''' + if Configuration.DEBUG == True: print(" RangeRingsUtilsTestCase.tearDown") + del self.pointGeographic + for i in self.deleteme: + if arcpy.Exists(i): + arcpy.Delete_management(i) + return + + def test_RingMaker_init(self): + ''' test class''' + print("RangeRingsUtilsTestCase.test_RingMaker_init") + ringDistanceList = [10.0, 20.0, 30.0, 40.0] + rm = RangeRingUtils.RingMaker(self.pointGeographic, + ringDistanceList, + "METERS", + self.srWAZED) + self.assertEquals(rm.ringCount, len(ringDistanceList)) + self.assertEquals(rm.ringMin, 10.0) + self.assertEquals(rm.ringMax, 40.0) + return + + #TODO: test init with empty ring list (no values) + #TODO: test init with negative rings (bad values) + #TODO: test init with empty point features (empty) + #TODO: test init with polyline or polygon inputs (wrong type) + + def test_RingMaker_sortList_empty(self): + ''' test RingMaker's internal _sortList method if it handles an empty list''' + print("RangeRingsUtilsTestCase.test_RingMaker_sortList_emtpy") + rm = RangeRingUtils.RingMaker(self.pointGeographic, [10.0, 20.0], "METERS", self.srWAZED) + outList = rm._sortList([]) + self.assertIsNone(outList) + return + + def test_RingMaker_sortList_isSorted(self): + ''' test Ringmaker's internal _sortedList method if it sorts a list''' + print("RangeRingsUtilsTestCase.test_sortList_isSorted") + l = [7, 5, 9, 3, 8, 1, 6, 2, 4, 0] + rm = RangeRingUtils.RingMaker(self.pointGeographic, [10.0, 20.0], "METERS", self.srWAZED) + outList = rm._sortList(l) + self.assertEqual(outList, sorted(l)) + return + + def test_RingMaker_addFieldsToTable(self): + ''' test RingMaker's internal _addFieldsToTable method''' + print("RangeRingsUtilsTestCase.test_RingMaker_addFieldsToTable") + fc = arcpy.CreateFeatureclass_management("in_memory", "fcTestFields", "POINT")[0] + numFieldsBefore = len(arcpy.ListFields(fc)) + + fields = {"a":"DOUBLE", "b":"TEXT"} + rm = RangeRingUtils.RingMaker(self.pointGeographic, [10.0, 20.0], "METERS", self.srWAZED) + newfc = rm._addFieldsToTable(fc, fields) + numFieldsAfter = len(list(arcpy.ListFields(newfc))) + + self.assertEqual(numFieldsAfter, numFieldsBefore + 2) + self.deleteme.append(fc) + return + + def test_RingMaker_makeTempTable(self): + ''' test RingMaker's internal method''' + print("RangeRingsUtilsTestCase.test_RingMaker_makeTempTable") + rm = RangeRingUtils.RingMaker(self.pointGeographic, [10.0, 20.0], "METERS", self.srWAZED) + tempTab = rm._makeTempTable("tempTab", {"a":"TEXT"}) + self.assertTrue(arcpy.Exists(tempTab)) + self.deleteme.append(tempTab) + return + + def test_RingMaker_makeRingsFromDistances(self): + ''' test RingMaker's internal method''' + print("RangeRingsUtilsTestCase.test_RingMaker_makeRingsFromDistances") + ringDistanceList = [10.0, 20.0, 30.0, 40.0] + ringCountEstimate = len(ringDistanceList) * int(arcpy.GetCount_management(self.pointGeographic).getOutput(0)) + rm = RangeRingUtils.RingMaker(self.pointGeographic, ringDistanceList, "METERS", self.srWAZED) + rm.makeRingsFromDistances() + ringCountActual = int(arcpy.GetCount_management(rm.ringFeatures).getOutput(0)) + self.assertEqual(ringCountEstimate, ringCountActual) + return + + def test_RingMaker_makeRadials(self): + ''' test RingMaker's internal method''' + print("RangeRingsUtilsTestCase.test_RingMaker_makeRadials") + ringDistanceList = [10.0, 20.0, 30.0, 40.0] + rm = RangeRingUtils.RingMaker(self.pointGeographic, ringDistanceList, + "METERS", self.srWAZED) + radialsToMake = 8 + radialCountEstimate = radialsToMake * int(arcpy.GetCount_management(self.pointGeographic).getOutput(0)) + rm.makeRadials(radialsToMake) + radialCountActual = int(arcpy.GetCount_management(rm.radialFeatures).getOutput(0)) + self.assertEqual(radialCountEstimate, radialCountActual) + return + + def test_RingMaker_saveRingsAsFeatures(self): + ''' test RingMaker's internal method''' + print("RangeRingsUtilsTestCase.test_RingMaker_saveRingsAsFeatures") + ringDistanceList = [10.0, 20.0, 30.0, 40.0] + rm = RangeRingUtils.RingMaker(self.pointGeographic, ringDistanceList, + "METERS", self.srWAZED) + rm.makeRingsFromDistances() + tempRings = os.path.join(self.DataGDB, "tempRings") + if arcpy.Exists(tempRings): arcpy.Delete_management(tempRings) + ringFeatures = rm.saveRingsAsFeatures(tempRings) + self.assertTrue(arcpy.Exists(ringFeatures)) + self.deleteme.append(ringFeatures) + return + + def test_RingMaker_saveRadialsAsFeatures(self): + ''' test saving raidal features to feature class''' + print("RangeRingsUtilsTestCase.test_RingMaker_saveRadialsAsFeatures") + ringDistanceList = [10.0, 20.0, 30.0, 40.0] + rm = RangeRingUtils.RingMaker(self.pointGeographic, ringDistanceList, + "METERS", self.srWAZED) + rm.makeRadials(4) + tempRadials = os.path.join(self.DataGDB, "tempRadials") + if arcpy.Exists(tempRadials): arcpy.Delete_management(tempRadials) + radialFeatures = rm.saveRadialsAsFeatures(tempRadials) + self.assertTrue(arcpy.Exists(radialFeatures)) + self.deleteme.append(radialFeatures) + return + + #=== TEST TOOL METHODS ========================================== + + def test_rangeRingsFromMinMax(self): + ''' testing the tool method ''' + print("RangeRingsUtilsTestCase.test_rangeRingsFromMinMax") + numCenters = int(arcpy.GetCount_management(self.pointGeographic).getOutput(0)) + numRadials = 8 + rings = os.path.join(self.DataGDB, "newRings") + radials = os.path.join(self.DataGDB, "newRadials") + rr = RangeRingUtils.rangeRingsFromMinMax(self.pointGeographic, + 100.0, + 1000.0, + "METERS", + numRadials, + rings, + radials, + self.srWAZED) + outRings = rr[0] + outRadials = rr[1] + + self.assertTrue(arcpy.Exists(outRings)) + self.assertEqual(int(arcpy.GetCount_management(outRings).getOutput(0)), numCenters * 2) + + self.assertTrue(arcpy.Exists(outRadials)) + self.assertEqual(int(arcpy.GetCount_management(outRadials).getOutput(0)), numRadials * numCenters) + + self.deleteme.append(rings) + self.deleteme.append(radials) + return + + def test_rangeRingsFromList(self): + ''' testing rangeRingsFromList method''' + print("RangeRingsUtilsTestCase.test_rangeRingsFromList") + numCenters = int(arcpy.GetCount_management(self.pointGeographic).getOutput(0)) + numRadials = 8 + rings = os.path.join(self.DataGDB, "newRings") + radials = os.path.join(self.DataGDB, "newRadials") + ringList = [1.0, 3.0, 9.0, 27.0, 81.0, 243.0, 729.0] + rr = RangeRingUtils.rangeRingsFromList(self.pointGeographic, + ringList, + "METERS", + numRadials, + rings, + radials, + self.srWAZED) + outRings = rr[0] + outRadials = rr[1] + + self.assertTrue(arcpy.Exists(outRings)) + self.assertEqual(int(arcpy.GetCount_management(outRings).getOutput(0)), len(ringList) * numCenters) + + self.assertTrue(arcpy.Exists(outRadials)) + self.assertEqual(int(arcpy.GetCount_management(outRadials).getOutput(0)), numRadials * numCenters) + + self.deleteme.append(rings) + self.deleteme.append(radials) + return + + def test_rangeRingsFromInterval(self): + ''' testing rangeRingsFromInterval method''' + print("RangeRingsUtilsTestCase.test_rangeRingsFromInterval") + numCenters = int(arcpy.GetCount_management(self.pointGeographic).getOutput(0)) + numRadials = 8 + rings = os.path.join(self.DataGDB, "newRings") + radials = os.path.join(self.DataGDB, "newRadials") + numRings = 4 + distanceBetween = 200.0 + rr = RangeRingUtils.rangeRingsFromInterval(self.pointGeographic, + numRings, + distanceBetween, + "METERS", + numRadials, + rings, + radials, + self.srWAZED) + outRings = rr[0] + outRadials = rr[1] + + self.assertTrue(arcpy.Exists(outRings)) + self.assertEqual(int(arcpy.GetCount_management(outRings).getOutput(0)), 4 * numCenters) + + self.assertTrue(arcpy.Exists(outRadials)) + self.assertEqual(int(arcpy.GetCount_management(outRadials).getOutput(0)), numRadials * numCenters) + + self.deleteme.append(rings) + self.deleteme.append(radials) + return diff --git a/utils/test/visibility_tests/SunPositionAnalysisToolsTestSuite.py b/utils/test/visibility_tests/SunPositionAnalysisToolsTestSuite.py new file mode 100644 index 00000000..2c1962db --- /dev/null +++ b/utils/test/visibility_tests/SunPositionAnalysisToolsTestSuite.py @@ -0,0 +1,73 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +SunPositionAnalysisToolsTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the test cases for the +Sun Position Analysis Tools toolboxes: +* SunPositionAndHillshadeTestCase.py + +================================================== +history: +10/29/2015 - JH - wired up SunPositionAnalysisToolsTestSuite to run SunPositionAndHillshadeTestCase in Pro or Desktop +================================================== +''' + +import os +import unittest +import logging +from . import SunPositionAndHillshadeTestCase +import Configuration + +''' Test suite for all tools in the Sun Position Analysis Tools toolbox ''' + +def getSunPositionTestSuite(): + + desktopTestList = ["test_sun_position_analysis_desktop"] + + proTestList = ["test_sun_position_analysis_pro"] + + if Configuration.DEBUG == True: + print(" SunPositionAnalysisTestSuite.getSunPositionTestSuite") + + suite = unittest.TestSuite() + if Configuration.Platform == "PRO": + Configuration.Logger.info("Sun Position Analysis Tools Pro tests") + suite = addTests(suite, proTestList) + else: + Configuration.Logger.info("Sun Position Analysis Tools Desktop tests") + suite = addTests(suite, desktopTestList) + return suite + +def addTests(suite, inputTestList): + ''' Add the list of tests to the test suite ''' + if Configuration.DEBUG == True: + print(" SunPositionAnalysisTestSuite.addTests") + for test in inputTestList: + print("adding test: " + str(test)) + Configuration.Logger.info(test) + suite.addTest(SunPositionAndHillshadeTestCase.SunPositionAndHillshadeTestCase(test)) + return suite + \ No newline at end of file diff --git a/visibility/test/test_sun_position/SunPositionAndHillshadeTestCase.py b/utils/test/visibility_tests/SunPositionAndHillshadeTestCase.py similarity index 55% rename from visibility/test/test_sun_position/SunPositionAndHillshadeTestCase.py rename to utils/test/visibility_tests/SunPositionAndHillshadeTestCase.py index ef6b5051..df3be644 100644 --- a/visibility/test/test_sun_position/SunPositionAndHillshadeTestCase.py +++ b/utils/test/visibility_tests/SunPositionAndHillshadeTestCase.py @@ -21,28 +21,58 @@ import datetime import os import unittest -import TestUtilities +import Configuration import UnitTestUtilities -import UnitTestCase - -class SunPositionAndHillshadeTestCase(UnitTestCase.UnitTestCase): - - inputGDB = os.path.join(TestUtilities.vis_GeodatabasePath, "test_sun_position.gdb") - inputArea = os.path.join(inputGDB, "inputArea") - inputSurface = os.path.join(inputGDB, "Jbad_SRTM_USGS_EROS") - compareResults = os.path.join(inputGDB, "compareResults") - +import DataDownload + +class SunPositionAndHillshadeTestCase(unittest.TestCase): + + proToolboxPath = os.path.join(Configuration.vis_ToolboxesPath, "Sun Position Analysis Tools.tbx") + desktopToolboxPath = os.path.join(Configuration.vis_ToolboxesPath, "Sun Position Analysis Tools_10.4.tbx") + + inputGDB = None + inputArea = None + inputSurface = None + compareResults = None + + sunPosUrl = "http://www.arcgis.com/sharing/content/items/bf6a04b4c9a3447b91e9c0b4074ca1e4/data" + sunPosDataPath = None + sunPosGDBPath = None + scratchGDB = None + def setUp(self): - UnitTestCase.UnitTestCase.setUp(self) - testObjects = [TestUtilities.sunPosToolbox, self.inputGDB, self.inputArea, self.inputSurface, self.compareResults] - UnitTestUtilities.checkGeoObjects(testObjects) - UnitTestUtilities.createScratch(TestUtilities.vis_ScratchPath) - - def test_sun_position_analysis(self): + if Configuration.DEBUG == True: print(" SunPositionAndHillshadeTestCase.setUp") + UnitTestUtilities.checkArcPy() + + name = "test_sun_position.gdb" + self.sunPosDataPath = DataDownload.runDataDownload(Configuration.visibilityPaths, name, self.sunPosUrl) + if (self.scratchGDB == None) or (not arcpy.Exists(self.scratchGDB)): + self.scratchGDB = UnitTestUtilities.createScratch(self.sunPosDataPath) + + UnitTestUtilities.checkFilePaths([self.proToolboxPath, self.desktopToolboxPath, Configuration.visibilityPaths, self.sunPosDataPath]) + # set up inputs + self.sunPosGDBPath = os.path.join(self.sunPosDataPath, name) + self.inputArea = os.path.join(self.sunPosGDBPath, r"inputArea") + self.inputSurface = os.path.join(self.sunPosGDBPath, r"Jbad_SRTM_USGS_EROS") + self.compareResults = os.path.join(self.sunPosGDBPath, r"compareResults") + UnitTestUtilities.checkGeoObjects([self.inputArea, self.inputSurface, self.compareResults]) + + def tearDown(self): + if Configuration.DEBUG == True: print(" SunPositionAndHillshadeTestCase.tearDown") + UnitTestUtilities.deleteScratch(self.scratchGDB) + + def test_sun_position_analysis_pro(self): + arcpy.AddMessage("Testing Sun Position Analysis (Pro).") + self.test_sun_position_analysis(self.proToolboxPath) + + def test_sun_position_analysis_desktop(self): + arcpy.AddMessage("Testing Sun Position Analysis (Desktop).") + self.test_sun_position_analysis(self.desktopToolboxPath) + + def test_sun_position_analysis(self, toolboxPath): try: - arcpy.AddMessage("Testing Sun Position Analysis (unit).") print("Importing toolbox... ") - arcpy.ImportToolbox(TestUtilities.sunPosToolbox, "sunpos") + arcpy.ImportToolbox(toolboxPath) arcpy.env.overwriteOutput = True # Inputs @@ -55,20 +85,23 @@ def test_sun_position_analysis(self): print("Set date...") utcAfghanistan = r'(UTC+4:30) Afghanistan' print("Set UTCAfg...") - outHillshade = os.path.join(TestUtilities.vis_ScratchPath, "outputHS") + # outHillshade = os.path.join(Configuration.vis_ScratchPath, "outputHS") + outHillshade = os.path.join(self.scratchGDB, "outputHS") print("Set output hillshade...") # Testing - arcpy.AddMessage("Running tool (Sun Position and Hillshade)") - # arcpy.SunPositionAnalysis_sunpos(TestUtilities.vis_inputArea, TestUtilities.vis_inputSurface, dtCompare, utcAfghanistan, outHillshade) + runToolMsg = "Running tool (Sun Position and Hillshade)" + arcpy.AddMessage(runToolMsg) + Configuration.Logger.info(runToolMsg) arcpy.SunPositionAnalysis_sunpos(self.inputArea, self.inputSurface, dtCompare, utcAfghanistan, outHillshade) - - print("Comparing expected values with tool results from " + str(dtCompare) + " in " + str(utcAfghanistan)) + + compareMessage = "Comparing expected values with tool results from " + str(dtCompare) + " in " + str(utcAfghanistan) + Configuration.Logger.info(compareMessage) compareResults = self.compareResults arcpy.CheckOutExtension("Spatial") diff = Minus(Raster(outHillshade),Raster(compareResults)) - diff.save(os.path.join(TestUtilities.vis_ScratchPath, "diff")) + diff.save(os.path.join(self.scratchGDB, "diff")) arcpy.CalculateStatistics_management(diff) rasMinimum = float(arcpy.GetRasterProperties_management(diff,"MINIMUM").getOutput(0)) rasMaximum = float(arcpy.GetRasterProperties_management(diff,"MAXIMUM").getOutput(0)) @@ -79,7 +112,7 @@ def test_sun_position_analysis(self): self.assertEqual(rasMaximum, float(0)) self.assertEqual(rasMinimum, float(0)) self.assertEqual(rasUnique, int(1)) - + # if (rasMaximum == float(0)) and (rasMinimum == float(0)) and (rasUnique == int(1)): # print("No differences between tool output and expected results.") # print("Test Passed") @@ -92,38 +125,12 @@ def test_sun_position_analysis(self): # + "Difference Std. Deviation: " + str(rasSTD) + "\n"\ # + "Difference Number of Unique Values: " + str(rasUnique) + "\n" # raise ValueDifferenceError(msg) - + except arcpy.ExecuteError: UnitTestUtilities.handleArcPyError() - # # Get the arcpy error messages - # msgs = arcpy.GetMessages() - # arcpy.AddError(msgs) - # print(msgs) - - # # return a system error code - # sys.exit(-1) except: UnitTestUtilities.handleGeneralError() - # # Get the traceback object - # tb = sys.exc_info()[2] - # tbinfo = traceback.format_tb(tb)[0] - - # # Concatenate information together concerning the error into a message string - # pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n"\ - # + str(sys.exc_info()[1]) - # msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # # Return python error messages for use in script tool or Python Window - # arcpy.AddError(pymsg) - # arcpy.AddError(msgs) - - # # Print Python error messages for use in Python / Python Window - # print(pymsg + "\n") - # print(msgs) - - # # return a system error code - # sys.exit(-1) finally: arcpy.CheckInExtension("Spatial") diff --git a/utils/test/visibility_tests/VisibilityAndRangeToolsTestSuite.py b/utils/test/visibility_tests/VisibilityAndRangeToolsTestSuite.py new file mode 100644 index 00000000..d1a67853 --- /dev/null +++ b/utils/test/visibility_tests/VisibilityAndRangeToolsTestSuite.py @@ -0,0 +1,47 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +VisibilityAndRangeToolsTestSuite.py +-------------------------------------------------- +requirments: +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the test cases for the +Visibility and Range Tools toolboxes: +* FindLocalPeaksTestCase.py + +================================================== +history: + - - +================================================== +''' +import unittest +import Configuration +from . import RangeRingUtilsTestCase + + +def getVisibilityAndRangeTestSuite(): + '''Collecting all test cases from Visibility and Range''' + if Configuration.DEBUG == True: + print(" getVisibilityAndRangeTestSuite") + + return \ No newline at end of file diff --git a/utils/test/visibility_tests/VisibilityDataPrepToolsTestSuite.py b/utils/test/visibility_tests/VisibilityDataPrepToolsTestSuite.py new file mode 100644 index 00000000..1c8c2cdf --- /dev/null +++ b/utils/test/visibility_tests/VisibilityDataPrepToolsTestSuite.py @@ -0,0 +1,33 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2015 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +VisibilityDataPrepToolsTestSuite.py +-------------------------------------------------- +* ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ +* Python 2.7 or Python 3.4 +author: ArcGIS Solutions +company: Esri +================================================== +description: +This test suite collects all of the test cases for the +Visibility Data Prep Tools toolboxes: +================================================== +history: + - - +================================================== +''' diff --git a/utils/test/visibility_tests/__init__.py b/utils/test/visibility_tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/visibility/README.md b/visibility/README.md index 6612603b..4c2fa99d 100644 --- a/visibility/README.md +++ b/visibility/README.md @@ -15,12 +15,14 @@ Tools to determine what you can or cannot see from a location. ## Sun Position Analysis Tools Analyze sun position and hillshade based on a date and time. +Supports the [Sun Position Analysis](http://solutions.arcgis.com/defense/templates/sun-position-analysis/) template. * Sun Position and Hillshade ## Visibility and Range Tools Tools to help basic visibility and distance analysis from locations. +Supports the [Visibility and Range](http://solutions.arcgis.com/defense/templates/visibility-and-range/) template. * Visibility Services * Fast Visibility By Circle @@ -48,6 +50,7 @@ These tools are part of the [Visibility and Range Template](http://www.arcgis.co ## Visibility Data Prep Tools Tools use to update position data for Visibility and Range Template +Supports the [Visibility and Range](http://solutions.arcgis.com/defense/templates/visibility-and-range/) template. * Update Defensive Position Domain diff --git a/visibility/test/build.xml b/visibility/test/build.xml deleted file mode 100644 index 0791113b..00000000 --- a/visibility/test/build.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/visibility/test/test_sun_position/build.xml b/visibility/test/test_sun_position/build.xml deleted file mode 100644 index 31261e74..00000000 --- a/visibility/test/test_sun_position/build.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/visibility/test/test_viz_and_range/TemplateConfigTest.py b/visibility/test/test_viz_and_range/TemplateConfigTest.py deleted file mode 100644 index e23c670b..00000000 --- a/visibility/test/test_viz_and_range/TemplateConfigTest.py +++ /dev/null @@ -1,98 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# TemplateConfigTest.py -# Description: Common objects/methods used by test scripts -# Requirements: ArcGIS Desktop Standard -# ---------------------------------------------------------------------------- - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -try: - print("Testing ArcPy") - arcpy.AddMessage("ArcPy works") - - # WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors - # print "Deleting Scratch Workspace (Workaround)" - # TestUtilities.deleteScratch() - - if not arcpy.Exists(TestUtilities.scratchGDB): - TestUtilities.createScratch() - - print("Testing Necessary Paths") - - print("Running from: " + str(TestUtilities.currentPath)) - - paths2Check = [] - paths2Check.extend([TestUtilities.geodatabasePath, TestUtilities.scratchPath, TestUtilities.toolboxesPath]) - - for path2check in paths2Check : - if os.path.exists(path2check) : - print("Valid Path: " + path2check) - else : - print("ERROR: Necessary Path not found: " + path2check ) - raise Exception('Bad Path') - - # WORKAROUND - # print "Creating New Scratch Workspace (Workaround)" - # TestUtilities.createScratch() - - print("Testing Necessary Geo Objects") - - objects2Check = [] - objects2Check.extend([TestUtilities.toolbox, TestUtilities.inputGDB, TestUtilities.outputGDB, TestUtilities.defaultGDB]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - print("--> Invalid Object: " + str(object2Check) ) - arcpy.AddError("Bad Input") - raise Exception('Bad Input') - else : - print("Valid Object: " + desc.Name ) - - print("Test Successful") - -except arcpy.ExecuteError: - # Get the arcpy error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - print(msgs) - - # return a system error code - sys.exit(-1) - -except: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - print(pymsg + "\n") - print(msgs) - - # return a system error code - sys.exit(-1) \ No newline at end of file diff --git a/visibility/test/test_viz_and_range/TestModelHighestPoint.py b/visibility/test/test_viz_and_range/TestModelHighestPoint.py deleted file mode 100644 index ec033452..00000000 --- a/visibility/test/test_viz_and_range/TestModelHighestPoint.py +++ /dev/null @@ -1,121 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelHighestPoint.py -# Description: Automatic Test of Highest Point Model -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: HighestPoint") - - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - # Raise a custom exception - raise Exception("LicenseError") - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - # Verify the expected configuration exists - inputPolygonFC = os.path.join(TestUtilities.inputGDB, "samplePolygonArea") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - outputPointsFC = os.path.join(TestUtilities.outputGDB, "HighestPoint") - toolbox = TestUtilities.toolbox - - # Check For Valid Input - objects2Check = [] - objects2Check.extend([inputPolygonFC, inputSurface, toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - raise Exception("Bad Input") - else : - print("Valid Object: " + desc.Name ) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "VandR") - - inputFeatureCount = int(arcpy.GetCount_management(inputPolygonFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPolygonFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - ########################################################3 - # Execute the Model under test: - arcpy.HighestPoints_VandR(inputPolygonFC, inputSurface, outputPointsFC) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputPointsFC < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - finally: - # Check in the 3D Analyst extension - arcpy.CheckInExtension("Spatial") - - -RunTest() \ No newline at end of file diff --git a/visibility/test/test_viz_and_range/TestModelLocalPeaks.py b/visibility/test/test_viz_and_range/TestModelLocalPeaks.py deleted file mode 100644 index e7efee9c..00000000 --- a/visibility/test/test_viz_and_range/TestModelLocalPeaks.py +++ /dev/null @@ -1,123 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelLocalPeaks.py -# Description: Automatic Test of Local Peaks Model -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: LocalPeaks") - - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - # Raise a custom exception - raise Exception("LicenseError") - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - # Verify the expected configuration exists - inputPolygonFC = os.path.join(TestUtilities.inputGDB, "samplePolygonArea") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - outputPointsFC = os.path.join(TestUtilities.outputGDB, "LocalPeaks") - toolbox = TestUtilities.toolbox - - # Check For Valid Input - objects2Check = [] - objects2Check.extend([inputPolygonFC, inputSurface, toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - raise Exception("Bad Input") - else : - print("Valid Object: " + desc.Name) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "VandR") - - inputFeatureCount = int(arcpy.GetCount_management(inputPolygonFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPolygonFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - numberOfPeaks = 3 - - ########################################################3 - # Execute the Model under test: - arcpy.FindLocalPeaks_VandR(inputPolygonFC, numberOfPeaks, inputSurface, outputPointsFC) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputPointsFC < 3) : - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - finally: - # Check in the 3D Analyst extension - arcpy.CheckInExtension("Spatial") - - -RunTest() \ No newline at end of file diff --git a/visibility/test/test_viz_and_range/TestModelLowestPoint.py b/visibility/test/test_viz_and_range/TestModelLowestPoint.py deleted file mode 100644 index 1a40ea27..00000000 --- a/visibility/test/test_viz_and_range/TestModelLowestPoint.py +++ /dev/null @@ -1,121 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelLowestPoint.py -# Description: Automatic Test of Lowest Point Model -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: LowestPoint") - - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - # Raise a custom exception - raise Exception("LicenseError") - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - # Verify the expected configuration exists - inputPolygonFC = os.path.join(TestUtilities.inputGDB, "samplePolygonArea") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - outputPointsFC = os.path.join(TestUtilities.outputGDB, "LowestPoint") - toolbox = TestUtilities.toolbox - - # Check For Valid Input - objects2Check = [] - objects2Check.extend([inputPolygonFC, inputSurface, toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - raise Exception("Bad Input") - else : - print("Valid Object: " + desc.Name) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "VandR") - - inputFeatureCount = int(arcpy.GetCount_management(inputPolygonFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPolygonFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - ########################################################3 - # Execute the Model under test: - arcpy.LowestPoint_VandR(inputPolygonFC, inputSurface, outputPointsFC) - ########################################################3 - - # Verify the results - outputFeatureCount = int(arcpy.GetCount_management(outputPointsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputPointsFC)) - print("Output Feature Count: " + str(outputFeatureCount)) - - if (outputPointsFC < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCount)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - finally: - # Check in the 3D Analyst extension - arcpy.CheckInExtension("Spatial") - - -RunTest() \ No newline at end of file diff --git a/visibility/test/test_viz_and_range/TestModelRadialLineOfSight.py b/visibility/test/test_viz_and_range/TestModelRadialLineOfSight.py deleted file mode 100644 index 220acf5c..00000000 --- a/visibility/test/test_viz_and_range/TestModelRadialLineOfSight.py +++ /dev/null @@ -1,123 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelRadialLineOfSight.py -# Description: Automatic Test of Radial Line Of Sight Model -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: TestModelRadialLineOfSight") - - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - # Raise a custom exception - raise Exception("LicenseError") - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - # Verify the expected configuration exists - inputPointsFC = os.path.join(TestUtilities.inputGDB, "RlosObserverWebMerc") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - outputVizFC = os.path.join(TestUtilities.outputGDB, "RlosVizOutput") - toolbox = TestUtilities.toolbox - - # Check For Valid Input - objects2Check = [] - objects2Check.extend([inputPointsFC, inputSurface, toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - raise Exception("Bad Input") - else : - print("Valid Object: " + desc.Name) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "VandR") - - inputFeatureCount = int(arcpy.GetCount_management(inputPointsFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPointsFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - forceVisibilityToInfinity = False - - ########################################################3 - # Execute the Model under test: - arcpy.RadialLineOfSight_VandR(inputPointsFC, inputSurface, outputVizFC, forceVisibilityToInfinity) - ########################################################3 - - # Verify the results - outputFeatureCountViz = int(arcpy.GetCount_management(outputVizFC).getOutput(0)) - print("Output FeatureClass: " + str(outputVizFC)) - print("Output Feature Count: " + str(outputFeatureCountViz)) - - if (outputFeatureCountViz < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCountViz)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - finally: - # Check in the 3D Analyst extension - arcpy.CheckInExtension("Spatial") - - -RunTest() \ No newline at end of file diff --git a/visibility/test/test_viz_and_range/TestModelRangeFan.py b/visibility/test/test_viz_and_range/TestModelRangeFan.py deleted file mode 100644 index 95f860e5..00000000 --- a/visibility/test/test_viz_and_range/TestModelRangeFan.py +++ /dev/null @@ -1,131 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelRangeFan.py -# Description: Automatic Test of Range Fan Model -# Requirements: ArcGIS Desktop Standard with Spatial Analyst Extension -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: RangeFans") - - if arcpy.CheckExtension("Spatial") == "Available": - arcpy.CheckOutExtension("Spatial") - else: - # Raise a custom exception - raise Exception("LicenseError") - - # WORKAROUND - print "Creating New Scratch Workspace (Workaround)" - TestUtilities.createScratch() - - # Verify the expected configuration exists - inputPointsFC = os.path.join(TestUtilities.inputGDB, "sampleRangePoints") - inputSurface = os.path.join(TestUtilities.inputGDB, "Jbad_SRTM_USGS_EROS") - outputRangeFansFC = os.path.join(TestUtilities.outputGDB, "RangeFans") - outputRangeVizFC = os.path.join(TestUtilities.outputGDB, "RangeViz") - toolbox = TestUtilities.toolbox - sr = arcpy.SpatialReference(32642) #WGS_1984_UTM_Zone_42N using factoryCode - - # Check For Valid Input - objects2Check = [] - objects2Check.extend([inputPointsFC, inputSurface, toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - raise Exception("Bad Input") - else : - print("Valid Object: " + desc.Name) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "VandR") - - inputFeatureCount = int(arcpy.GetCount_management(inputPointsFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPointsFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - maximumRange = 1000.0 - bearing = 150.0 - traversal = 22.0 - - ########################################################3 - # Execute the Model under test: - arcpy.RangeFan_VandR(inputPointsFC, maximumRange, bearing, traversal, inputSurface, outputRangeFansFC, outputRangeVizFC, sr) - ########################################################3 - - # Verify the results - outputFeatureCountFans = int(arcpy.GetCount_management(outputRangeFansFC).getOutput(0)) - print("Output FeatureClass: " + str(outputRangeFansFC)) - print("Output Feature Count: " + str(outputFeatureCountFans)) - - outputFeatureCountViz = int(arcpy.GetCount_management(outputRangeVizFC).getOutput(0)) - print("Output FeatureClass: " + str(outputRangeVizFC)) - print("Output Feature Count: " + str(outputFeatureCountViz)) - - if (outputFeatureCountFans < 1) or (outputFeatureCountViz < 1): - print("Invalid Output Feature Count: " + str(outputFeatureCountFans) + ":" + str(outputFeatureCountViz)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - finally: - # Check in the 3D Analyst extension - arcpy.CheckInExtension("Spatial") - - -RunTest() \ No newline at end of file diff --git a/visibility/test/test_viz_and_range/TestModelRangeRings.py b/visibility/test/test_viz_and_range/TestModelRangeRings.py deleted file mode 100644 index 3fa547f1..00000000 --- a/visibility/test/test_viz_and_range/TestModelRangeRings.py +++ /dev/null @@ -1,119 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright 2013 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ -# Name: TestModelRangeRings.py -# Description: Automatic Test of Range Rings Model -# Requirements: ArcGIS Desktop Standard -#------------------------------------------------------------------------------ - -import arcpy -import os -import sys -import traceback - -import TestUtilities - -def RunTest(): - try: - arcpy.AddMessage("Starting Test: RangeRings") - - # WORKAROUND - print("Creating New Scratch Workspace (Workaround)") - TestUtilities.createScratch() - - # Verify the expected configuration exists - inputPointsFC = os.path.join(TestUtilities.inputGDB, "sampleRangePoints") - outputRangeRingsFC = os.path.join(TestUtilities.outputGDB, "RangeRings") - outputRangeRadialsFC = os.path.join(TestUtilities.outputGDB, "RangeRadials") - toolbox = TestUtilities.toolbox - - # Check For Valid Input - objects2Check = [] - objects2Check.extend([inputPointsFC, toolbox]) - for object2Check in objects2Check : - desc = arcpy.Describe(object2Check) - if desc == None : - raise Exception("Bad Input") - else : - print("Valid Object: " + desc.Name) - - # Set environment settings - print("Running from: " + str(TestUtilities.currentPath)) - print("Geodatabase path: " + str(TestUtilities.geodatabasePath)) - - arcpy.env.overwriteOutput = True - arcpy.env.scratchWorkspace = TestUtilities.scratchGDB - arcpy.ImportToolbox(toolbox, "VandR") - - inputFeatureCount = int(arcpy.GetCount_management(inputPointsFC).getOutput(0)) - print("Input FeatureClass: " + str(inputPointsFC)) - print("Input Feature Count: " + str(inputFeatureCount)) - - if (inputFeatureCount < 1) : - print("Invalid Input Feature Count: " + str(inputFeatureCount)) - - numberOfRings = 5 - ringInterval = 1000.0 - distanceUnits = "METERS" - numberOfRadials = 8 - - ########################################################3 - # Execute the Model under test: - arcpy.RangeRings_VandR(inputPointsFC, numberOfRings, ringInterval, distanceUnits, numberOfRadials, outputRangeRingsFC, outputRangeRadialsFC) - ########################################################3 - - # Verify the results - outputFeatureCountRings = int(arcpy.GetCount_management(outputRangeRingsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputRangeRingsFC)) - print("Output Feature Count: " + str(outputFeatureCountRings)) - - outputFeatureCountRadials = int(arcpy.GetCount_management(outputRangeRadialsFC).getOutput(0)) - print("Output FeatureClass: " + str(outputRangeRadialsFC)) - print("Output Feature Count: " + str(outputFeatureCountRadials)) - - if (outputFeatureCountRings < 1) or (outputFeatureCountRadials < 1) : - print("Invalid Output Feature Count: " + str(outputFeatureCountRings) + ":" + str(outputFeatureCountRadials)) - raise Exception("Test Failed") - - # WORKAROUND: delete scratch db - print("Deleting Scratch Workspace (Workaround)") - TestUtilities.deleteScratch() - - print("Test Successful") - - except arcpy.ExecuteError: - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - - except Exception as e: - # Get the traceback object - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # return a system error code - sys.exit(-1) - -RunTest() \ No newline at end of file diff --git a/visibility/test/test_viz_and_range/build.xml b/visibility/test/test_viz_and_range/build.xml deleted file mode 100644 index 585af053..00000000 --- a/visibility/test/test_viz_and_range/build.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/visibility/test/versions.xml b/visibility/test/versions.xml deleted file mode 100644 index 5098ed3e..00000000 --- a/visibility/test/versions.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - OUTPUTS: ${dir.arcgisdesktop}, ${dir.arcpy} - Checks system environment variable and sets the above values depending on version detected. - Sets the correct ArcPy and ArcGIS Folder location depending on version detected. - IMPORTANT: If Python is not installed at the default location, - you will need to edit the task "SET_CUSTOM_PYTHON_LOCATION" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/visibility/toolboxes/Visibility and Range Tools.tbx b/visibility/toolboxes/Visibility and Range Tools.tbx index d424b7ad..9577b855 100644 Binary files a/visibility/toolboxes/Visibility and Range Tools.tbx and b/visibility/toolboxes/Visibility and Range Tools.tbx differ diff --git a/visibility/toolboxes/Visibility and Range Tools_10.4.tbx b/visibility/toolboxes/Visibility and Range Tools_10.4.tbx index 0bb48a2e..b24b7240 100644 Binary files a/visibility/toolboxes/Visibility and Range Tools_10.4.tbx and b/visibility/toolboxes/Visibility and Range Tools_10.4.tbx differ diff --git a/visibility/toolboxes/layers/RangeRingInputObservers.lyr b/visibility/toolboxes/layers/RangeRingInputObservers.lyr new file mode 100644 index 00000000..1977375e Binary files /dev/null and b/visibility/toolboxes/layers/RangeRingInputObservers.lyr differ diff --git a/visibility/toolboxes/scripts/RangeRingFromMinMaxTable.py b/visibility/toolboxes/scripts/RangeRingFromMinMaxTable.py new file mode 100644 index 00000000..e3662408 --- /dev/null +++ b/visibility/toolboxes/scripts/RangeRingFromMinMaxTable.py @@ -0,0 +1,130 @@ +# coding: utf-8 +''' +------------------------------------------------------------------------------ +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +------------------------------------------------------------------------------ + +================================================== +RangeRingFromMinMaxTable.py +-------------------------------------------------- +requirments: ArcGIS 10.3.1+, ArcGIS Pro 1.2+ +author: ArcGIS Solutions +company: Esri +================================================== +description: create minimum and maximum range rings +from values in an input table +================================================== +history: +4/2/2016 - mf - original coding +4/11/2016 - mf - update handling of empty spatial ref +================================================== +''' + +# IMPORTS ========================================== +import os +import sys +import traceback +import arcpy +from arcpy import env +import RangeRingUtils + +# LOCALS =========================================== +deleteme = [] # intermediate datasets to be deleted +debug = True # extra messaging during development + +# FUNCTIONS ======================================== + +inputCenterFeatures = arcpy.GetParameterAsText(0) +inputTable = arcpy.GetParameterAsText(1) +inputSelectedType = arcpy.GetParameterAsText(2) +inputNumberOfRadials = arcpy.GetParameterAsText(3) +outputRingFeatures = arcpy.GetParameterAsText(4) +outputRadialFeatures = arcpy.GetParameterAsText(5) +optionalSpatialReference = arcpy.GetParameter(6) +optionalSpatialReferenceAsText = arcpy.GetParameterAsText(6) +#Weapon Table Options +inputTypeNameField = arcpy.GetParameterAsText(7) +inputTypeMinRangeField = arcpy.GetParameterAsText(8) +inputTypeMaxRangeField = arcpy.GetParameterAsText(9) + +if optionalSpatialReferenceAsText == "#" or optionalSpatialReferenceAsText == "": + optionalSpatialReference = None + +def main(): + ''' Call to tool method ''' + try: + # get/set environment + env.overwriteOutput = True + #get min and max range for selected weapon + cursorFields = [inputTypeNameField, inputTypeMinRangeField, inputTypeMaxRangeField] + with arcpy.da.SearchCursor(inputTable, cursorFields) as cursor: + for row in cursor: + if str(inputSelectedType) == str(row[0]): + inputMinimumRange = row[1] + inputMaximumRange = row[2] + + if optionalSpatialReferenceAsText == "#" or optionalSpatialReferenceAsText == "": + optionalSpatialReference = None + + # Call tool method + rr = RangeRingUtils.rangeRingsFromMinMax(inputCenterFeatures, + inputMinimumRange, + inputMaximumRange, + "METERS", + inputNumberOfRadials, + outputRingFeatures, + outputRadialFeatures, + optionalSpatialReference) + + # Set output + arcpy.SetParameter(4, rr[0]) + arcpy.SetParameter(5, rr[1]) + + except arcpy.ExecuteError: + # Get the tool error messages + msgs = arcpy.GetMessages() + arcpy.AddError(msgs) + print(msgs) + + except: + # Get the traceback object + tb = sys.exc_info()[2] + tbinfo = traceback.format_tb(tb)[0] + + # Concatenate information together concerning the error into a message string + pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) + msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" + + # Return python error messages for use in script tool or Python Window + arcpy.AddError(pymsg) + arcpy.AddError(msgs) + + # Print Python error messages for use in Python / Python Window + print(pymsg + "\n") + print(msgs) + + finally: + if debug == False and len(deleteme) > 0: + # cleanup intermediate datasets + if debug == True: arcpy.AddMessage("Removing intermediate datasets...") + for i in deleteme: + if debug == True: arcpy.AddMessage("Removing: " + str(i)) + arcpy.Delete_management(i) + if debug == True: arcpy.AddMessage("Done") + + + +# MAIN ============================================= +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/visibility/toolboxes/scripts/RangeRingMinMax.py b/visibility/toolboxes/scripts/RangeRingMinMax.py new file mode 100644 index 00000000..304436b3 --- /dev/null +++ b/visibility/toolboxes/scripts/RangeRingMinMax.py @@ -0,0 +1,115 @@ +# coding: utf-8 +''' +------------------------------------------------------------------------------ +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +------------------------------------------------------------------------------ + +================================================== +RangeRingMinMax.py +-------------------------------------------------- +requirments: ArcGIS 10.3.1+, ArcGIS Pro 1.2+ +author: ArcGIS Solutions +company: Esri +================================================== +description: build two range rings from a minimum and +maximum distances. +================================================== +history: +3/29/2016 - mf - design & original coding +4/11/2016 - mf - update handling of empty spatial ref +================================================== +''' + +# IMPORTS ========================================== +import sys +import traceback +import arcpy +from arcpy import env +import RangeRingUtils + +# LOCALS =========================================== +deleteme = [] # intermediate datasets to be deleted +debug = True # extra messaging during development + +# FUNCTIONS ======================================== + +inputCenterFeatures = arcpy.GetParameterAsText(0) +inputMinimumRange = float(arcpy.GetParameterAsText(1)) +inputMaximumRange = float(arcpy.GetParameterAsText(2)) +inputDistanceUnits = arcpy.GetParameterAsText(3) +inputNumberOfRadials = int(arcpy.GetParameterAsText(4)) +outputRingFeatures = arcpy.GetParameterAsText(5) +outputRadialFeatures = arcpy.GetParameterAsText(6) +optionalSpatialReference = arcpy.GetParameter(7) +optionalSpatialReferenceAsText = arcpy.GetParameterAsText(7) + +if optionalSpatialReferenceAsText == "#" or optionalSpatialReferenceAsText == "": + optionalSpatialReference = None + +def main(): + ''' main... call the method, pass the inputs, get the results ''' + try: + # get/set environment + env.overwriteOutput = True + # Call tool method + + rr = RangeRingUtils.rangeRingsFromMinMax(inputCenterFeatures, + inputMinimumRange, + inputMaximumRange, + inputDistanceUnits, + inputNumberOfRadials, + outputRingFeatures, + outputRadialFeatures, + optionalSpatialReference) + # Set output + arcpy.SetParameter(5, rr[0]) + arcpy.SetParameter(6, rr[1]) + + except arcpy.ExecuteError: + # Get the tool error messages + msgs = arcpy.GetMessages() + arcpy.AddError(msgs) + print(msgs) + + except: + # Get the traceback object + tb = sys.exc_info()[2] + tbinfo = traceback.format_tb(tb)[0] + + # Concatenate information together concerning the error into a message string + pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) + msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" + + # Return python error messages for use in script tool or Python Window + arcpy.AddError(pymsg) + arcpy.AddError(msgs) + + # Print Python error messages for use in Python / Python Window + print(pymsg + "\n") + print(msgs) + + finally: + if debug == False and len(deleteme) > 0: + # cleanup intermediate datasets + if debug == True: arcpy.AddMessage("Removing intermediate datasets...") + for i in deleteme: + if debug == True: arcpy.AddMessage("Removing: " + str(i)) + arcpy.Delete_management(i) + if debug == True: arcpy.AddMessage("Done") + + +# MAIN ============================================= +if __name__ == "__main__": + main() + \ No newline at end of file diff --git a/visibility/toolboxes/scripts/RangeRingUtils.py b/visibility/toolboxes/scripts/RangeRingUtils.py new file mode 100644 index 00000000..6e2d71e1 --- /dev/null +++ b/visibility/toolboxes/scripts/RangeRingUtils.py @@ -0,0 +1,229 @@ +# coding: utf-8 +''' +----------------------------------------------------------------------------- +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +----------------------------------------------------------------------------- + +================================================== +RangeRingUtils.py +-------------------------------------------------- +requirements: ArcGIS 10.3.1+, ArcGIS Pro 1.2+ +author: ArcGIS Solutions +company: Esri +================================================== +description: Utilities to create range ring features +================================================== +history: +3/29/2016 - mf - design & original coding +================================================== +''' +import os +import sys +import traceback +import arcpy + +acceptableDistanceUnits = ['METERS', 'KILOMETERS', + 'MILES', 'NAUTICAL_MILES', + 'FEET', 'US_SURVEY_FEET'] + +srDefault = arcpy.SpatialReference(54032) # World_Azimuthal_Equidistant + +def rangeRingsFromList(centerFC, rangeList, distanceUnits, numRadials, outputRingFeatures, outputRadialFeatures, sr): + ''' Make range ring features from a center, and list of distances ''' + try: + + #if sr == "#" or sr == "" or sr == None: + if not sr: + msg = r"Using default spatial reference: " + str(srDefault.name) + arcpy.AddWarning(msg) + print(msg) + sr = srDefault + + rm = RingMaker(centerFC, rangeList, distanceUnits, sr) + + # Create Rings... + numCenterPoints = arcpy.GetCount_management(centerFC).getOutput(0) + numRingsPerCenter = len(rangeList) + totalNumRings = int(numCenterPoints) * int(numRingsPerCenter) + totalNumRadials = int(numCenterPoints) * int(numRadials) + arcpy.AddMessage("Making rings " + str(totalNumRings) + " (" + str(numRingsPerCenter) + " for " + str(numCenterPoints) + " centers)...") + rm.makeRingsFromDistances() + outRings = rm.saveRingsAsFeatures(outputRingFeatures) + + # Create Radials... + arcpy.AddMessage("Making radials " + str(totalNumRadials) + " (" + str(numRadials) + " for " + str(numCenterPoints) + " centers)...") + rm.makeRadials(numRadials) + outRadials = rm.saveRadialsAsFeatures(outputRadialFeatures) + + return [outRings, outRadials] + except arcpy.ExecuteError: + # Get the tool error messages + msgs = arcpy.GetMessages() + arcpy.AddError(msgs) + print(msgs) + + except: + # Get the traceback object + tb = sys.exc_info()[2] + tbinfo = traceback.format_tb(tb)[0] + + # Concatenate information together concerning the error into a message string + pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + \ + "\nError Info:\n" + str(sys.exc_info()[1]) + msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" + + # Return python error messages for use in script tool or Python Window + arcpy.AddError(pymsg) + arcpy.AddError(msgs) + # Print Python error messages for use in Python / Python Window + print(pymsg + "\n") + print(msgs) + +def rangeRingsFromMinMax(centerFC, rangeMin, rangeMax, distanceUnits, numRadials, outputRingFeatures, outputRadialFeatures, sr): + ''' Make range ring features from only two distances, a minimum and a maximum ''' + rangeList = [min(rangeMin, rangeMax), max(rangeMin, rangeMax)] + return rangeRingsFromList(centerFC, rangeList, distanceUnits, numRadials, outputRingFeatures, outputRadialFeatures, sr) + +def rangeRingsFromInterval(centerFC, numRings, distBetween, distanceUnits, numRadials, outputRingFeatures, outputRadialFeatures, sr): + ''' Classic range rings from number of rings, and distance between rings ''' + rangeList = [x * distBetween for x in range(1, numRings + 1)] + return rangeRingsFromList(centerFC, rangeList, distanceUnits, numRadials, outputRingFeatures, outputRadialFeatures, sr) + + + +class RingMaker: + ''' + Core class for making range rings. + ''' + + def __init__(self, center, inputRangeList, distanceUnits, sr): + ''' initialize rings ''' + + self.intermediateDataToDelete = [] + + # project center to sr, and keep it as a list of PointGeometries object + originalGeom = arcpy.CopyFeatures_management(center, arcpy.Geometry()) + newGeom = [] + for g in originalGeom: + newGeom.append(g.projectAs(sr)) + self.center = newGeom + + self.rangeList = self._sortList(inputRangeList) + if distanceUnits == None or distanceUnits == "#" or distanceUnits == "": + self.distanceUnits = sr.linearUnitName + else: + self.distanceUnits = distanceUnits + + if not sr == None or not sr == "#" or not sr == "": + self.sr = sr + else: + self.sr = srDefault + + self.ringFeatures = None + self.radialFeatures = None + self.ringCount = len(self.rangeList) + self.ringMin = min(self.rangeList) + self.ringMax = max(self.rangeList) + + def __del__(self): + ''' clean up rings ''' + for i in self.intermediateDataToDelete: + if arcpy.Exists(i): + arcpy.Delete_management(i) + + def _sortList(self, listToSort): + ''' sort list of distances ''' + if len(listToSort) == 0: + print("Empty distance list") + return None + return sorted(listToSort) + + def _addFieldsToTable(self, tab, fields): + ''' add fields from dictionary: {'':'type'} ''' + for f in list(fields.keys()): + arcpy.AddField_management(tab, f, fields[f]) + return tab + + def _makeTempTable(self, name, fields): + ''' make a temporary, in_memory table ''' + tab = os.path.join("in_memory", name) + arcpy.CreateTable_management(os.path.dirname(tab), + os.path.basename(tab)) + self.intermediateDataToDelete.append(tab) + if fields: + newtab = self._addFieldsToTable(tab, fields) + else: + print("no fields to add") + newtab = tab + return newtab + + def makeRingsFromDistances(self): + ''' make geodesic rings from distance list ''' + # make a table for TableToEllipse + fields = {'x':'DOUBLE', 'y':'DOUBLE', 'Range':'DOUBLE'} + inTable = self._makeTempTable("ringTable", fields) + cursor = arcpy.da.InsertCursor(inTable, ['x', 'y', 'Range']) + #self.center is a list of PointGeometry + for i in self.center: + pt = i.firstPoint + for r in self.rangeList: + cursor.insertRow([pt.X, pt.Y, r * 2]) + del cursor + self.intermediateDataToDelete.append(inTable) + outFeatures = os.path.join("in_memory", "outRings") + arcpy.TableToEllipse_management(inTable, outFeatures, + 'x', 'y', 'Range', 'Range', + self.distanceUnits, + '#', '#', '#', self.sr) + exp = r"!Range! / 2.0" + arcpy.CalculateField_management(inTable, 'Range', exp, 'PYTHON_9.3') + self.intermediateDataToDelete.append(outFeatures) + self.ringFeatures = outFeatures + return outFeatures + + def makeRadials(self, numRadials): + ''' make geodesic radials from number of radials ''' + segmentAngle = 360.0/float(numRadials) + segmentAngleList = [] + a = 0.0 + while a < 360.0: + segmentAngleList.append(a) + a += segmentAngle + + fields = {'x':'DOUBLE', 'y':'DOUBLE', 'Bearing':'DOUBLE', 'Range':'DOUBLE'} + tab = self._makeTempTable("radTable", fields) + cursor = arcpy.da.InsertCursor(tab, ['x', 'y', 'Bearing', 'Range']) + for i in self.center: + pt = i.firstPoint + for r in segmentAngleList: + cursor.insertRow([pt.X, pt.Y, r, self.ringMax]) + del cursor + self.intermediateDataToDelete.append(tab) + outRadialFeatures = os.path.join("in_memory", "outRadials") + arcpy.BearingDistanceToLine_management(tab, outRadialFeatures, 'x', 'y', + 'Range', self.distanceUnits, 'Bearing', "DEGREES", + "GEODESIC", "#", self.sr) + self.intermediateDataToDelete.append(outRadialFeatures) + self.radialFeatures = outRadialFeatures + return outRadialFeatures + + def saveRingsAsFeatures(self, outputFeatureClass): + ''' save rings to featureclass ''' + arcpy.CopyFeatures_management(self.ringFeatures, outputFeatureClass) + return outputFeatureClass + + def saveRadialsAsFeatures(self, outputFeatureClass): + ''' save radials to featureclass ''' + arcpy.CopyFeatures_management(self.radialFeatures, outputFeatureClass) + return outputFeatureClass diff --git a/visibility/toolboxes/scripts/RangeRings.py b/visibility/toolboxes/scripts/RangeRings.py deleted file mode 100644 index e2141dae..00000000 --- a/visibility/toolboxes/scripts/RangeRings.py +++ /dev/null @@ -1,201 +0,0 @@ - - -#------------------------------------------------------------------------------ -# Copyright 2014 Esri -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------ - -import os, sys, traceback, math, decimal -import arcpy -from arcpy import env - -input_centers = arcpy.GetParameterAsText(0) -numberOfRings = int(arcpy.GetParameterAsText(1)) -ringInterval = float(arcpy.GetParameterAsText(2)) -outputRings = arcpy.GetParameterAsText(3) -distanceUnits = arcpy.GetParameterAsText(4) -numberOfRadials = int(arcpy.GetParameterAsText(5)) -bearingUnits = arcpy.GetParameterAsText(6) -outputRadials = arcpy.GetParameterAsText(7) -buildRadials = True -delete_me = [] - -try: - currentOverwriteOutput = env.overwriteOutput - env.overwriteOutput = True - installInfo = arcpy.GetInstallInfo("desktop") - installDirectory = installInfo["InstallDir"] - GCS_WGS_1984 = os.path.join(installDirectory,r"Coordinate Systems", r"Geographic Coordinate Systems", r"World",r"WGS 1984.prj") - - # Get SR of Input Centers - inputCentersSR = arcpy.Describe(input_centers).spatialReference - - result = arcpy.GetCount_management(input_centers) - arcpy.AddMessage("Using " + str(result) + " centers ...") - - # create temp table - tempTable = os.path.join(env.scratchWorkspace,"tempTable") - delete_me.append(tempTable) - arcpy.CreateTable_management(os.path.dirname(tempTable),os.path.basename(tempTable)) - arcpy.AddField_management(tempTable,"POINT_X","DOUBLE") - arcpy.AddField_management(tempTable,"POINT_Y","DOUBLE") - arcpy.AddField_management(tempTable,"Range","DOUBLE") - arcpy.AddField_management(tempTable,"RingID","LONG") - arcpy.AddField_management(tempTable,"RingRadius","DOUBLE") - - # if zero radials, don't build them - if numberOfRadials < 1: buildRadials = False - - # Add XY - arcpy.AddXY_management(input_centers) - - # build ring values - arcpy.AddMessage("Building ring table ...") - getRows = arcpy.SearchCursor(input_centers) - addRows = arcpy.InsertCursor(tempTable) - y = 1 - for getRow in getRows: - pointX = getRow.POINT_X - pointY = getRow.POINT_Y - x = 1 - while x <= numberOfRings: - addRow = addRows.newRow() - addRow.POINT_X = pointX - addRow.POINT_Y = pointY - rd = float(x) * ringInterval - # print "row: " + str(x) + " " + str(pointX) + " " + str(pointY) + " " + str(rd) - arcpy.AddMessage("row: " + str(x) + " " + str(pointX) + " " + str(pointY) + " " + str(rd)) - addRow.Range = rd - addRow.RingRadius = rd * 2.0 - addRow.RingID = y - addRows.insertRow(addRow) - x += 1 - y += 1 - del addRow - del addRows - del getRow - del getRows - - results = arcpy.GetCount_management(tempTable) - - # build ellipses - arcpy.AddMessage("Constructing " + str(results) + " ring features ...") - arcpy.TableToEllipse_management(tempTable,outputRings,"POINT_X","POINT_Y","RingRadius","RingRadius",distanceUnits,"#","#","#",inputCentersSR) - - # Join fields - tempTableOIDFieldName = arcpy.Describe(tempTable).OIDFieldName - ringOIDFieldName = arcpy.Describe(outputRings).OIDFieldName - arcpy.JoinField_management(outputRings,ringOIDFieldName,tempTable,tempTableOIDFieldName,["Range","RingID"]) - - # Delete junk field - arcpy.DeleteField_management(outputRings,"RingRadius") - - - # create radials temp table - if buildRadials == True: - arcpy.AddMessage("Using " + str(numberOfRadials) + " radials ...") - tempRadialTable = os.path.join(env.scratchWorkspace,"tempRadialTable") - delete_me.append(tempRadialTable) - arcpy.CreateTable_management(os.path.dirname(tempRadialTable),os.path.basename(tempRadialTable)) - arcpy.AddField_management(tempRadialTable,"POINT_X","DOUBLE") - arcpy.AddField_management(tempRadialTable,"POINT_Y","DOUBLE") - arcpy.AddField_management(tempRadialTable,"Azimuth","DOUBLE") - arcpy.AddField_management(tempRadialTable,"Range","DOUBLE") - arcpy.AddField_management(tempRadialTable,"RingID","LONG") - - maxRadialRange = ringInterval * numberOfRings - radialInterval = 360.0/numberOfRadials - radialList = [] - r = 1 - while r <= numberOfRadials: - radialList.append(r * radialInterval) - r += 1 - - arcpy.AddMessage("Building radial table ...") - getRows = arcpy.SearchCursor(input_centers) - addRows = arcpy.InsertCursor(tempRadialTable) - y = 1 - for getRow in getRows: - pointX = getRow.POINT_X - pointY = getRow.POINT_Y - for radialAzimuth in radialList: - addRow = addRows.newRow() - addRow.POINT_X = pointX - addRow.POINT_Y = pointY - addRow.Range = maxRadialRange - addRow.Azimuth = radialAzimuth - addRow.RingID = y - addRows.insertRow(addRow) - y += 1 - del addRow - del addRows - del getRow - del getRows - - results = arcpy.GetCount_management(tempRadialTable) - - # build ellipses - arcpy.AddMessage("Constructing " + str(results) + " radial features ...") - arcpy.BearingDistanceToLine_management(tempRadialTable,outputRadials,"POINT_X","POINT_Y","Range",distanceUnits,"Azimuth",bearingUnits,"RHUMB_LINE","RingID",inputCentersSR) - - # Join fields - tempRadialTableOIDFieldName = arcpy.Describe(tempRadialTable).OIDFieldName - radialOIDFieldName = arcpy.Describe(outputRadials).OIDFieldName - #arcpy.JoinField_management(outputRadials,radialOIDFieldName,tempRadialTable,tempRadialTableOIDFieldName,["Azimuth","Range","RingID"]) - - else: - arcpy.AddMessage("Zero radials to build ...") - - - # set output - arcpy.SetParameter(3,outputRings) - if buildRadials == True: - arcpy.SetParameter(7,outputRadials) - - # cleanup - arcpy.AddMessage("Removing scratch datasets:") - for ds in delete_me: - arcpy.AddMessage(str(ds)) - arcpy.Delete_management(ds) - - env.overwriteOutput = currentOverwriteOutput - -except arcpy.ExecuteError: - error = True - # Get the tool error messages - msgs = arcpy.GetMessages() - arcpy.AddError(msgs) - #print msgs #UPDATE - print(msgs) - -except: - # Get the traceback object - error = True - tb = sys.exc_info()[2] - tbinfo = traceback.format_tb(tb)[0] - - # Concatenate information together concerning the error into a message string - pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) - msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" - - # Return python error messages for use in script tool or Python Window - arcpy.AddError(pymsg) - arcpy.AddError(msgs) - - # Print Python error messages for use in Python / Python Window - #print pymsg + "\n" #UPDATE - print(pymsg + "\n") - #print msgs #UPDATE - print(msgs) - - \ No newline at end of file diff --git a/visibility/toolboxes/scripts/RangeRingsFromInterval.py b/visibility/toolboxes/scripts/RangeRingsFromInterval.py new file mode 100644 index 00000000..2bd1feab --- /dev/null +++ b/visibility/toolboxes/scripts/RangeRingsFromInterval.py @@ -0,0 +1,115 @@ +# coding: utf-8 +''' +------------------------------------------------------------------------------ +Copyright 2016 Esri +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +------------------------------------------------------------------------------ + +================================================== +RangeRingsFromInterval.py +-------------------------------------------------- +requirments: ArcGIS 10.3.1+, ArcGIS Pro 1.2+ +author: ArcGIS Solutions +company: Esri +================================================== +description: build range rings from number of rings +and an interval distance between rings. +================================================== +history: +4/1/2016 - mf - original coding +4/11/2016 - mf - update handling of empty spatial ref +================================================== +''' + +# IMPORTS ========================================== +import os +import sys +import traceback +import arcpy +from arcpy import env +import RangeRingUtils + +# LOCALS =========================================== +deleteme = [] # intermediate datasets to be deleted +debug = True # extra messaging during development + +# FUNCTIONS ======================================== + +inputCenterFeatures = arcpy.GetParameterAsText(0) +inputNumberOfRings = int(arcpy.GetParameterAsText(1)) +inputDistanceBetween = float(arcpy.GetParameterAsText(2)) +inputDistanceUnits = arcpy.GetParameterAsText(3) +inputNumberOfRadials = int(arcpy.GetParameterAsText(4)) +outputRingFeatures = arcpy.GetParameterAsText(5) +outputRadialFeatures = arcpy.GetParameterAsText(6) +optionalSpatialReference = arcpy.GetParameter(7) +optionalSpatialReferenceAsText = arcpy.GetParameterAsText(7) + +if optionalSpatialReferenceAsText == "#" or optionalSpatialReferenceAsText == "": + optionalSpatialReference = None + +def main(): + try: + # get/set environment + env.overwriteOutput = True + + # Call tool method + + rr = RangeRingUtils.rangeRingsFromInterval(inputCenterFeatures, + inputNumberOfRings, + inputDistanceBetween, + inputDistanceUnits, + inputNumberOfRadials, + outputRingFeatures, + outputRadialFeatures, + optionalSpatialReference) + # Set output + arcpy.SetParameter(5, rr[0]) + arcpy.SetParameter(6, rr[1]) + + except arcpy.ExecuteError: + # Get the tool error messages + msgs = arcpy.GetMessages() + arcpy.AddError(msgs) + print(msgs) + + except: + # Get the traceback object + tb = sys.exc_info()[2] + tbinfo = traceback.format_tb(tb)[0] + + # Concatenate information together concerning the error into a message string + pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) + msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages() + "\n" + + # Return python error messages for use in script tool or Python Window + arcpy.AddError(pymsg) + arcpy.AddError(msgs) + + # Print Python error messages for use in Python / Python Window + print(pymsg + "\n") + print(msgs) + + finally: + if debug == False and len(deleteme) > 0: + # cleanup intermediate datasets + if debug == True: arcpy.AddMessage("Removing intermediate datasets...") + for i in deleteme: + if debug == True: arcpy.AddMessage("Removing: " + str(i)) + arcpy.Delete_management(i) + if debug == True: arcpy.AddMessage("Done") + +# MAIN ============================================= +if __name__ == "__main__": + main() + \ No newline at end of file