Creating Impact Area ShapeFiles - Hazard Services
Creating a Shapefile for Pre-defined Impact Areas
Purpose:
This jobsheet covers using baselines to create shapefile for pre-defined impact areas (like dam breaks and burnscars), and exporting them using a Python conversion script.Tasks:
REQUIRED SCRIPT: baseline2shape.py
- [NO ACTION] Looking Ahead: This process involves drawing a baseline in CAVE, then calling a conversion script to export the baseline. The script will require information about which baseline to export, the filename/directory to save to, and a name for the new shape.
- Download the required python script, and save it to a memorable location
- [FOCAL POINT WORKSHOP] Execute the following command in your terminal, to retrieve the file to your desktop:
cp /data2/HazSvcsFPWorkshop/DataScripts/baseline2shape.py ~/Desktop/;
- [FOCAL POINT WORKSHOP] Execute the following command in your terminal, to retrieve the file to your desktop:
- In the D2D perspective, launch the baselines tool by clicking on its icon in the D2D toolbar, or selecting "Baselines" from the "Tools" menu
- Zoom out to see all the baselines and their endpoints by using the middle-mouse scroll wheel
- Choose a baseline to use for drawing
- Make a note of which baseline you're using, as this will be important later when exporting its coordinates
- Form a rudimentary polygon with your baseline as follows:
- Left-click and drag on the vertices to move them
- Middle-click on a portion of the baseline to create additional vertices (you must have at least three vertices)
- Use zoom and other aides like maps to help better localize your polygon to an area of interest
- It is not necessary to close the shape, but keep in mind that the unconnected ends will be bridged when converted to a shapefile
- Once satisfied with the shape of your baseline, open a terminal on your Linux, by right-clicking on the desktop and selecting "Open Terminal"
- Prepare to export the baseline to a shapefile by making sure a good directory exists to output them to
- [FOCAL POINT WORKSHOP]: For simplicity, make your own directory the desktop with a command like:
mkdir -p ~/Desktop/myLLLShapes/damBreak
- [FOR OPERATIONAL USE]: One best practice is to use a path outside of /awips2 to store shapefiles, like /localapps/HazardServices/LLL/shapefiles/damBreak/MyExampleDam ...where LLL is your CWA
- [FOCAL POINT WORKSHOP]: For simplicity, make your own directory the desktop with a command like:
- [DO NOT EXECUTE COMMAND YET] Prepare to run a conversion command (below) which turns your baseline into a shapefile. The command below accomplishes this after appropriate substitutions are made to the color-coded expressions
/awips2/python/bin/python baseline2shape.py ${outputFilePath} ${baselineName} ${shapeName}
- ${outputFilePath}: Substitute with the full path for the shapefile to create (including the name)
- EXAMPLES:
- [FOCAL POINT WORKSHOP]: ~/Desktop/myLLLShapes/damBreak/MyExampleDam
- Operational Recommendation: /localapps/HazrdServices/LLL/shapefiles/damBreak/MyExampleDam ...where LLL should be your CWA
- Use a full path, ending in the desired filename (no .shp or other extension needed), to save the files in the place you want them
- EXAMPLES:
- ${baselineName}: Substitute with the name of the baseline you used
- EXAMPLE: A (or B , C, D, etc)
- Only the letter is needed, no quotes or other surrounding characters
- ${shapeName}: Substitute with the name you want for your shape in the database
- EXAMPLE: "My Example Dam"
- Wrap in quotes, especially if you use spaces in the name
- WHAT NAME TO USE? This will be the name added to your maps table as well as a default name in products, however you'll have a chance to specify an alternate in MetaData files later
- FULL EXAMPLE OF COMMAND:
/awips2/python/bin/python baseline2shape.py ~/Desktop/myShapes/damBreak/MyExampleDam A "My Example Dam"
- ${outputFilePath}: Substitute with the full path for the shapefile to create (including the name)
- After typing a customized version of the command above in your terminal to suit your shape, hit ENTER to execute the conversion command
- If successful, there should be NO message displayed
- You're finished creating your shapefiles!
- Remember the output directory you used... that will be a crucial input when using ingestShapeFile script to load your shapefile into AWIPS