Issue #1091 Code cleanup and update of online help files.

Change-Id: Ifa3a34c46b17f86dcb3d52c25b9d498f35f967e2

Former-commit-id: 0a65facc3537a5ad1002aa6c78cf5537bea7cc0b
This commit is contained in:
Ron Anderson 2012-09-25 16:05:53 -05:00
parent de6dd650a8
commit 4373858ac6
13 changed files with 666 additions and 796 deletions

View file

@ -27,9 +27,8 @@ from Maps import *
# just the Wyoming counties. Edit areas are automatically generated"
# and named WY_countyName.
WYcounties = ShapeTable('County')
WYcounties.filter(lambda x : x['STATE'] == "WY")
WYcounties.name = 'WYCounties'
WYcounties.editAreaName = ['STATE','COUNTYNAME']
WYcounties.filter(lambda x : x['state'] == "WY")
WYcounties.editAreaName = ['state','countyname']
WYcounties.groupName = 'WYCounties'
maps.append(WYcounties)
@ -37,12 +36,7 @@ maps.append(WYcounties)
# The following few lines removes the maps that are not wanted.
maps.remove(CWAmzones)
maps.remove(Mzones)
maps.remove(hsmz)
maps.remove(Basins)
maps.remove(rfc)
maps.remove(lakes)
maps.remove(interstates)
maps.remove(highways)
# The following renames the CWAzones map to "MyCWAZones".
CWAzones.name = "MyCWAZones"

View file

@ -27,9 +27,8 @@ from Maps import *
# just the Wyoming counties. Edit areas are automatically generated"
# and named WY_countyName.
WYcounties = ShapeTable('County')
WYcounties.filter(lambda x : x['STATE'] == "WY")
WYcounties.name = 'WYCounties'
WYcounties.editAreaName = ['STATE','COUNTYNAME']
WYcounties.filter(lambda x : x['state'] == "WY")
WYcounties.editAreaName = ['state','countyname']
WYcounties.groupName = 'WYCounties'
maps.append(WYcounties)

View file

@ -25,23 +25,11 @@ from Maps import *
# The following changes the configuration of the CWAzones maps. It overrides
# every possible item that can be overridden.
# Rename by name of the CWAzones map
CWAzones.name = "MyCWAZones"
# Change the filter to only include "OH" (Ohio) zones
CWAzones.filter(lambda x : x['STATE'] == "OH")
CWAzones.filter(lambda x : x['state'] == "OH")
# We don't want any edit areas to be automatically generated, so we
# turn off the edit area name.
CWAzones.editAreaName = []
# Expand the map by 2 degrees in the east and south, and 1.5 degrees
# in the west
CWAzones.expandDomain = (0, 2, 2, 1.5)
# The following changes the configuration of the Cities map. Instead
# of filtering off of the population field, it will produce
# a map of the given cities.
cityset = ['Akron', 'Denver', 'Boulder', 'Loveland', 'Longmont']
cities.filter(lambda x : x['NAME'] in cityset)
# Change the edit area naming to be state_zone (e.g. OH_123)
CWAzones.editAreaName = ['state', 'zone']
# Change the edit area group name to be OH_Zones
CWAzones.groupName = 'OH_Zones'

View file

@ -22,12 +22,9 @@
# You must include the following line
from Maps import *
# The following few lines removes the maps that are not wanted. The
# The following few lines removes the edit areas that are not wanted. The
# names are the Python variable names. The following removes the
# CWA marine zones, marine zones, lakes, interstates, and highway maps.
# CWA marine zones, marine zones.
maps.remove(CWAmzones)
maps.remove(Mzones)
maps.remove(lakes)
maps.remove(interstates)
maps.remove(highways)

View file

@ -11,7 +11,7 @@
<h1 CLASS="3Heading">
<a NAME="Top"></a>Map Files - Map Background Shapefile Handling</h1>
<div CLASS="3Heading">March 29, 2012</div>
<div CLASS="3Heading">September 25, 2012</div>
<h1 CLASS="3Heading">
@ -24,13 +24,16 @@
<hr WIDTH="100%">
<h2>
<a NAME="Overview"></a>Overview</h2>
AWIPS2 handles shapefiles differently than AWIPS1 did. The MapFiles.py file
is no longer used. Instead, a postgres <i>maps</i> database in conjunction with xml
configuration are now in use. Maps.py has been converted to Maps.java for
shapefile access and processing. Consequently, there is a change to how local
maps are added to the system. Also, currently the functionality that generates
edit areas from site level shapefiles has not yet been implemented. It is slated
to be implemented as DR9441.
<p>
AWIPS2 handles map backgrounds differently than AWIPS1 did. The Maps.py file
is no longer used for creating map backgrounds. Instead, a PostGIS <i>maps</i> database is used
in conjunction with xml configuration. Consequently, there is a change to how local
maps are added to the system. These maps are available across all perspective in CAVE and are
not specific to GFE.
</p>
<p>
<a href="mapConfig.html">Maps.py</a> and <a href="localMapsConfig.html">localMaps.py</a> are now only used to generate edit areas from maps database tables.
</p>
<hr WIDTH="100%">
<h2><a NAME="Updating"></a>Updating Map Shapefiles</h2>
<p><ol>

View file

@ -1,144 +0,0 @@
<!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR"
content="Mozilla/4.79 [en] (X11; U; Linux 2.4.9-31smp i686) [Netscape]">
<meta name="Author" content="Mark Mathewson">
<title>Map Background Configuration</title>
</head>
<body bgcolor="#ffffff">
<h1 class="3Heading">
<a name="Top"></a>localMapFiles.py - Map Background Shapefile Naming
File
Overrides</h1>
<div class="3Heading">January 18, 2006<br>
</div>
<h1 class="3Heading"></h1>
<h2>
<a name="Organization"></a>Organization</h2>
<a href="#Overview">Overview</a>
<br>
<a href="#Format">localMapFiles.py Format</a>
<br>
&nbsp;&nbsp;&nbsp; <a href="#Adding">Adding a New Map Background</a>
<br>
&nbsp;&nbsp;&nbsp; <a href="#Upd">Updating a map shapefile</a>
<br>
<a href="#Placement">Placement of the localMapFiles.py file</a>
<br>
<a href="#Updating">Updating Map Shapefiles</a>
<br>
<hr width="100%">
<h2><a name="Overview"></a>Overview</h2>
The localMapFiles.py file is used for overriding the defined shapefile
names in the <a href="MapFiles.html">MapFiles.py</a> file.&nbsp; It is
the primary mechansism for reconfiguring the map backgrounds when
updated
shapefiles are installed.&nbsp; Explicit shapefile names should be
defined in the localMapFiles.py file and should be equated to a
mnemonic, e.g., CountyMapName, that is used in Maps.py and localMaps.py.<br>
<p><b><font color="#ff0000">See the <a
href="serverConfiguration.html#ServerDatabaseConfigurationModificationOptions">server
configuration overview</a> for information on how to make changes that
are supported to the map backgrounds.<br>
</font></b></p>
<p><b><font color="#ff0000">NOTE: Starting with software releases in
January 2006, GFESuite is installed with separate GFE CORE and Map
Shapefile components.&nbsp; For AWIPS releases, the map shapefile
component will not normally be provided.&nbsp;&nbsp; WFOs will be
responsible for downloading from NOAA1 their own set of shapefiles, and
defining them through localMapFiles.py.&nbsp;&nbsp;&nbsp; If the map
configuration is not correct during the installation time, then the
install will fail.&nbsp;&nbsp;&nbsp; Even though the GFE CORE and Map
Shapefile components will not both be delivered for AWIPS,&nbsp; the
etc/BASE/MapFiles.py will still point to the Map Shapefile set of
shapefiles.&nbsp; This makes it imperative for sites to have their own
localMapFiles.py to point to their inventory of maps.<br>
</font></b></p>
<p></p>
<hr width="100%">
<h2><a name="Format"></a>localMaps.py Format</h2>
<a href="EXAMPLElocalMapFiles.py">Example localMapFiles.py
configuration
file</a>
<br>
&nbsp;
<h3><a name="Adding"></a>Adding a New Map Background</h3>
A new map background can be added through <a
href="localMapsConfig.html">localMaps.py</a>,
but it is highly recommended that you use the localMapFiles.py method
to define
the shapefile name.&nbsp; This will allow you to update the shapefile
at
a later time and only have to change the localMapFiles.py file.
<p>Here is an example of adding a shapefile for time zone.&nbsp; The
variable
name, by convention, should include the "MapName"&nbsp;as part of the
variable:
</p>
<p><tt>TimeZoneMapName = 'tz_13se02'</tt>
<br>
<tt></tt>&nbsp;
</p>
<h3><a name="Upd"></a>Updating a map Shapefile</h3>
Updating the definition of the map shapefile when a shapefile is
updated
is very simple, just repeat the definition that is contained in
MapFiles.py
and change the filename of the map.&nbsp; In this example, the zone
shapefile
is being updated to a September 13, 2002 version:
<p><tt>ZoneMapName = 'z_13sep02'</tt><tt></tt>
</p>
<p></p>
<hr width="100%">
<h2><a name="Placement"></a>Placement of the localMapFiles.py file</h2>
The localMapFiles.py file should always be placed in the ***/etc/SITE
directory
as explained <a href="serverConfiguration.html#LocationofFiles">here</a>.
<p>
</p>
<hr width="100%">
<h2><a name="Updating"></a>Updating Map Shapefiles</h2>
The procedure to update map shapefiles is outlined below:
<ol>
<li>
Download the new shapefiles from the AWIPS Map GIS catalog.</li>
<ul>
<li>If you are on AWIPS, then you should sftp to the NOAA1 server using the appropriate (NWS-supplied) username and password.&nbsp; Then "cd" to pub/maps
where the shapefiles are located.&nbsp; Then download the desired
shapefiles.<br>
</li>
</ul>
<li>
unzip them into a directory, or uncompress them as necessary.&nbsp; If
they have a *.Z extension, you can use the uncompress command.&nbsp; If
they have a *.gz extension, then you use the gzip -d&nbsp;
command.&nbsp;
When you are finished, verify that you have a *.shp, *.shx, and *.dbf
file.</li>
<li>
gzip -9 each portion of the map&nbsp; (.shp, .shx, .dbf) using the
command
<b><tt>gzip -9 *.shp *.shx *.dbf</tt></b></li>
<li>
Place the updated shapefiles into the <i>release</i>/data/maps
directory,
where <i>release</i> is the software installation directory, nominally
/awips/GFESuite/primary for AWIPS installations (thus your map
shapefiles are put
into /awips/GFESuite/primary/data/maps).&nbsp; <br>
</li>
<li>
Modify your localMapFiles.py file and redefine the reference name, such
as CountyMapName, to point to the new shapefile.</li>
<li>
Restart the ifpServer.</li>
</ol>
<div class="Body">&nbsp;<a href="#Top">Back To Top</a>
<br>
&nbsp;<a href="GFESuite.html#TableOfContents">Back To TOC</a></div>
</body>
</html>

View file

@ -12,7 +12,7 @@
<h1 class="3Heading">
<a name="Top"></a>localMaps.py - Map Background Configuration Override
File</h1>
<div class="3Heading">January 18, 2006<br>
<div class="3Heading">September 25, 2012<br>
</div>
<h2><a name="Organization"></a>Organization</h2>
<a href="#Overview">Overview</a>
@ -21,13 +21,13 @@ File</h1>
<br>
&nbsp;&nbsp;&nbsp; <a href="#Header">Header</a>
<br>
&nbsp;&nbsp;&nbsp; <a href="#Adding">Adding a New Map Background</a>
&nbsp;&nbsp;&nbsp; <a href="#Adding">Adding new edit areas</a>
<br>
&nbsp;&nbsp;&nbsp; <a href="#Removing">Removing a map defined in
&nbsp;&nbsp;&nbsp; <a href="#Removing">Removing edit areas defined in
Maps.py</a>
<br>
&nbsp;&nbsp;&nbsp; <a href="#Modifying">Modifying the characteristics
of an existing map</a>
of existing edit areas</a>
<br>
<a href="#Placement">Placement of the localMaps.py file</a>
<br>
@ -35,22 +35,13 @@ of an existing map</a>
<br>
<hr width="100%">
<h2><a name="Overview"></a>Overview</h2>
The localMaps.py file provides a mechansism for a site to override
entries
in the supplied <a href="mapConfig.html">Maps.py</a> file. New map
backgrounds
may be added, maps may be removed from the list, and existing map
attributes
may be changed.&nbsp; Refer to the <a href="mapConfig.html">Maps.py</a>
for the definition of the map background attributes and how they are
used.
This document will explain how to add, remove, and modify maps.
<p>The <a href="MapFiles.html">MapFiles</a> and <a
href="localMapFiles.html">localMapFiles</a>
are used to define the actual shapefile names to be used.&nbsp; These
should
NOT be hard-coded into your localMaps file.
</p>
The localMaps.py file provides a mechanism for a site to override entries
in the supplied <a href="mapConfig.html">Maps.py</a> file. New edit areas
may be added, edit areas may be removed from the list, and existing edit area
attributes may be changed.
Refer to the <a href="mapConfig.html">Maps.py</a>
for the definition of the edit area attributes and how they are used.
This document will explain how to add, remove, and modify edit areas.
<p><b><font color="#ff0000">See the <a
href="serverConfiguration.html#ServerDatabaseConfigurationModificationOptions">server
configuration overview</a> for information on how to make changes that
@ -61,94 +52,68 @@ are supported to the map backgrounds.</font></b>
<h2><a name="Format"></a>localMaps.py Format</h2>
<a href="EXAMPLElocalMaps.py">Example localMaps.py configuration file</a>
<h3><a name="Header"></a>Header</h3>
The localMaps.py file must begin with the following line.&nbsp; This
line
instructs the software to import all symbols from the primary
Maps.py.&nbsp;
Failure to include this line will result in your modifications not
being
The localMaps.py file must begin with the following line. This line
instructs the software to import all symbols from the primary Maps.py.
Failure to include this line will result in your modifications not being
recognized by the software:
<p><tt>from Maps import *</tt>
<br>
&nbsp;
</p>
<h3><a name="Adding"></a>Adding a New Map Background</h3>
A new map background can be added through localMaps.py.&nbsp; Refer to
<h3><a name="Adding"></a>Adding New Edit Areas</h3>
New edit areas can be added through localMaps.py. Refer to
the syntax requirements of defining a map in the <a
href="mapConfig.html">Maps.py</a>
document.&nbsp; There is one additional line that is very important to
document. There is one additional line that is very important to
add (i.e., the append line) in order for the system to recognize the
new
map.&nbsp; It is also important NOT to duplicate the Python variable
edit areas. It is also important NOT to duplicate the Python variable
name
(i.e., the name left of the equals ("=") sign) of any Python variable
in
the <a href="mapConfig.html">Maps.py</a> file.&nbsp; For example, if a
the <a href="mapConfig.html">Maps.py</a> file. For example, if a
map is defined as "CWAzones = ..." in <a href="mapConfig.html">Maps.py</a>,
do not create a variable that says "CWAzones = ..." in the localMaps.py
file. Note that this restriction is for adding a map background. If you
are overriding the characteristics of a map background that is already
file. Note that this restriction is for adding new edit areas. If you
are overriding the characteristics of edit areas that are already
defined in Maps.py, then you will need to use the same Python variable
name.
<p>Here is an example of including a county map for the state of
Wyoming,
and having it create a set of automatic edit areas in group
<p>Here is an example of including a set of automatic edit areas for counties in Wyoming in group
WYCounties):
</p>
<p><tt>WYcounties = ShapeFile(MAPDIR)</tt>
<br>
<tt>WYcounties.filename(CountyMapName)</tt>
<br>
<tt>WYcounties.filter(lambda x : x['STATE'] == "WY")</tt>
<br>
<tt>WYcounties.name = 'WYCounties'</tt>
<br>
<tt>WYcounties.editAreaName = ['STATE','COUNTYNAME']</tt>
<br>
<tt>WYcounties.groupName = 'WYCounties'</tt>
<br>
<tt>WYcounties.expandDomain = (2, 2, 0, 0)</tt>
<br>
<tt>maps.append(WYcounties)</tt>
</p>
<p>In the above example, the map name of "WYCounties" is created,
consisting
of all counties with attribute STATE that equals "WY".&nbsp; In
addition,
edit areas will be automatically generated in the form of
<PRE>
WYcounties = ShapeTable('County')
WYcounties.filter(lambda x : x['state'] == "WY")
WYcounties.editAreaName = ['state','countyname']
WYcounties.groupName = 'WYCounties'
maps.append(WYcounties)
</PRE>
<p>In the above example, edit areas will be generated for
all counties where attribute STATE equals "WY". The generated edit areas will have names of the form
STATE_COUNTYNAME
and will be part of the WYCounties edit area group.&nbsp; The very last
line appends this new map definition to the list of maps to be
generated.&nbsp;
The map clip region will be expanded by 2 degrees to the north and
east.
and will be part of the WYCounties edit area group. The very last
line appends this new definition to the list of edit areas to be
generated.
</p>
<p>Note that if your new map background is using a new shapefile, you
will
also need to install the shapefile and create/modify the <a
href="localMapFiles.html">localMapFiles.py</a>
file to indicate the location/name of the shapefile.&nbsp;&nbsp;
In all cases, the "filename" definition should use an existing mnemonic
(defined in MapFiles.py or redefined in localMapFiles.py) or a new
mnemonic (defined in localMapFiles.py).&nbsp;&nbsp; By using mnemonics,
it is easy to keep your maps up-to-date as you install new shapefiles.<br>
&nbsp;
will also need to import the shape file into the maps database.
Refer to section <a href="MapFiles.html">Map Files - Map Background Shapefile Handling</a>
</p>
<p><a href="EXAMPLElocalMapsAdd.py">Example localMaps.py configuration
file</a>
</p>
<h3><a name="Removing"></a>Removing a Map that is defined in Maps.py</h3>
<h3><a name="Removing"></a>Removing edit areas defined in Maps.py</h3>
Removing a map that is defined in <a href="mapConfig.html">Maps.py</a>,
but not desired is easy.&nbsp; Find the Python variable name of the map
but not desired is easy. Find the Python variable name of the map
you wish to remove by examining <a href="mapConfig.html">Maps.py</a>.&nbsp;
The python variable name is the name to the left of the "equals" ('=')
sign.
<p>For example, if you did not want ifpServer to generate the marine
<p>For example, if you did not want to generate the marine
zones,
find the marine zones definition in <a href="mapConfig.html">Maps.py</a>.&nbsp;
There are actually two maps generated. The identifiers are CWAmzones
and
Mzones.&nbsp; The following text would be included within localMaps.py:
Mzones. The following text would be included within localMaps.py:
</p>
<p><tt>maps.remove(CWAmzones)</tt>
<br>
@ -158,136 +123,65 @@ Mzones.&nbsp; The following text would be included within localMaps.py:
configuration
file</a>
</p>
<h3><a name="Modifying"></a>Modifying the characteristics of an
existing map</h3>
You can modify the following characterstics of the map:
<h3><a name="Modifying"></a>Modifying the characteristics of
existing edit areas</h3>
You can modify the following characteristics of the map definition:
<ul>
<li>filename of the map shapefile - but ONLY if it is to change the
mnemonic, e.g., CountyMapName, and not to specify and explicit
shapefile name, e.g., c_02se05.&nbsp;&nbsp; Explicit filenames are to
be specified in localMapFiles.py.<br>
</li>
<li>name of the map background (.name line)</li>
<li>name of the database table (ShapeTable parameter)</li>
<li>filtering (.filter line)</li>
<li>generation of edit areas (.editAreaName line)</li>
<li>group name of generated edit areas (.groupName)</li>
<li>change (or add) the map domain expansion</li>
<li>Adjust the precision used when filtering out points to reduce
data size</li>
</ul>
You cannot modify the following characteristic:
<ul>
<li>ShapeFile line</li>
</ul>
<h4>
Filename of the Map Background</h4>
The explicit shapefile filename of the map may be changed easily, but
it is not
changed through localMaps.py.&nbsp; Instead you should use the <a
href="localMapFiles.html#Upd">localMapFiles.py</a>
entry to indicate the filename.&nbsp; Only mnemonics should be changed
in localMaps.py.&nbsp;&nbsp; You should refer to an existing mnemonic,
such as CountyMapName, that is already defined in Maps.py, or you can
use a new mnemonic which you must define in your localMapFiles.py file.<br>
<h4>Name of the Map Background</h4>
The format of the line is identical to that found in Maps.py.&nbsp;
Simply
repeat the line you want to change and then put the new map name.&nbsp;
For example, if you want to change the CWAzones map name to MyCWAZones,
you would add the following line to localMaps.py:
<p><tt>CWAzones.name = "MyCWAZones"</tt>
Database Table Name</h4>
<p>If you want to change the name of the database table used for edit area generation, you will
need to remove the existing definition and <a href="#Adding">create a completely new map definition</a>.<br>
</p>
<h4>Filter Changes</h4>
The format of the line is identical to that found in Maps.py.&nbsp;
Simply
repeat the line you want to change and then put in the new filter
string.&nbsp;
For example, if you want to change the CWAzones filter from all zones
for
Simply repeat the line you want to change and then put in the new filter string.&nbsp;
For example, if you want to change the CWAzones filter from all zones for
the CWA to all zones for the state of Ohio, you would add the following
line to localMaps.py:
<p><tt>CWAzones.filter(lambda x : x['STATE'] == "OH")</tt>
<p><tt>CWAzones.filter(lambda x : x['state'] == "OH")</tt>
</p>
<p>You can also use any of the alternate methods of specifying the
filter
<p>You can also use any of the alternate methods of specifying the filter
as described in <a href="mapConfig.html#FilteredMap">Maps.py</a>. This
shows much more complex types of filters than this file.
</p>
<p>If you want to turn filtering off completely for a map, you will
need
to <a href="#Adding">add a completely new map definition</a>.<br>
<p>If you want to turn filtering off completely for a map, you will need
to remove the existing definition and <a href="#Adding">create a completely new map definition</a>.<br>
</p>
<p>Attributes in the shapefile are all treated as strings.&nbsp;&nbsp;
If you create a filter that needs to do number comparisons, such as a
population filter, you need to promote the string representation to a
number representation using the float() function.<br>
<p>Attribute names in the database are all stored in lower case.&nbsp;
<br>
</p>
<h4>Generation of Edit Area Changes</h4>
<h5>
Name Changes</h5>
The format of the line is identical to that found in Maps.py.&nbsp;
Simply
repeat the line you want to change and then put in the new edit area
name
definition.&nbsp; If you don't want any edit areas to be generated use
this format:
<p><tt>CWAzones.editAreaName = []</tt>
<p>
The format of the line is identical to that found in Maps.py.
Simply repeat the line you want to change and then put in the new editAreaName definition.
For example if you want the edit areas to be named using the contents of the 'cwa' attribute
of the database record you would add the following line ot localMaps.py:
<pre>
CWAzones.editAreaName = 'cwa'
</pre>
</p>
<p>If you want to specify the edit areas are to be based on the CWA,
then
use this form:
<p>
For detailed examples of editAreaName configuration refer to <a href="mapConfig.html">Maps.py</a>.
</p>
<p>
<b>Note:</b> if the generated edit area names are not unique undesirable results may occur.
</p>
<p><tt>CWAzones.editAreaName = 'CWA'<br>
</tt></p>
Refer to <a href="mapConfig.html">Maps.py</a> for alternate forms of
the editAreaName.<br>
<h5>
Group Name for the Edit Areas</h5>
The format of the line is identical to that found in Maps.py.&nbsp;
Simply
repeat the line you want to change and then put in the new group name
definition.&nbsp;
If you don't want the edit areas to be in any group use this format:
<p><tt>CWAzones.groupName = ''</tt>
<p>
To have the generated edit areas included in an edit area group simply supply the group name as a string.<br>
<pre>CWAzones.groupName = 'MyZones'</pre>
</p>
<p>If you want to specify the group name, then use this form:
</p>
<p><tt>CWAzones.groupName = 'MyZones'</tt>
<br>
&nbsp;
</p>
<h4>Domain Expansion</h4>
The format of this line is <a href="mapConfig.html#ExpandedMaps">identical
to that found in Maps.py</a>.&nbsp; Simply repeat the line you want to
change (or add a new line):
<p><tt>CWAzones.expandDomain = (0, 2, 2, 1.5)</tt>
<a name="Precision"></a></p>
<h4>Precision</h4>
The ifpServer will throw out vertex points of polyline and polygon maps
which are closer togeather than needed for the GFE. Since opinions
differ
on how close points are before they are not needed, a ShapeFile can be
assigned an optional attribute to define this. The attribute is called
precision and is an integer or None assigned like so:
<p><tt>CWAzones.precision = 3</tt>
</p>
<p>The server will then round all values in the data to this number of
decimal places. Adjacent duplicate values will then be removed. This
helps
reduce the amount of data contained in the maps making them faster to
display.
</p>
<p>By default all polygon and polyline maps will be rounded to a
precision
of 2. The above example overrides this to 3. If a site wishes to do no
rounding then precision can be set to None and this data reduction will
be skipped entirely.
</p>
<p>In summary, precision can be set to an integer greater than or equal
to zero or None. The best way to change this value is in your
localMaps.py
file. The above example could be placed into localMaps.py to change the
precision of the CWAzones map to 3.
<p>
If you don't want the edit areas to be included in a group supply an empty string:
<pre>CWAzones.groupName = ''</pre>
</p>
<p><a href="EXAMPLElocalMapsMod.py">Example localMaps.py configuration
file</a>
@ -295,18 +189,15 @@ file</a>
</p>
<hr width="100%">
<h2><a name="Placement"></a>Placement of the localMaps.py file</h2>
The localMaps.py file should always be placed in the ***/etc/SITE
directory
The localMaps.py file should always be placed in the /awips2/edex/data/utility/edex_static/site/OAX/config/gfe/
directory on dx3/dx4
as explained <a href="serverConfiguration.html#LocationofFiles">here</a>.
<p>
</p>
<hr width="100%">
<h2><a name="Updating"></a>Updating Map Shapefiles</h2>
Updating Map Shapefiles is described in the <a
href="localMapFiles.html">localMapFiles</a>
document.&nbsp;&nbsp;
The site is responsible for obtaining and installing the correct set of
map shapefiles.<br>
Map shape file updates must be imported into the maps database using the importShapeFile.sh script on dx1.
Refer to section <a href="MapFiles.html">Map Files - Map Background Shapefile Handling</a><br>
&nbsp;
<p></p>
<hr width="100%"><br>

View file

@ -6,309 +6,442 @@
<meta
content="Mozilla/4.79 [en] (X11; U; Linux 2.4.18-27.7.xsmp i686) [Netscape]"
name="GENERATOR">
<meta content="" name="Author">
<meta content="Mark Mathewson" name="Author">
<title>Map Background Configuration</title>
</head>
<body bgcolor="#ffffff">
<center>
<h1 class="3Heading"><a name="maps.py"></a>Map Background Configuration</h1>
</center>
<center>April 2, 2012<br>
</center>
<h1 class="3Heading"><a name="maps.py"></a>Maps.py - Map Background
Configuration</h1>
<div class="3Heading">September 25, 2012<br>
</div>
<h2><a name="Organization"></a><b>Organization</b></h2>
<a href="#Maps.pyFormat">Format</a>
<blockquote><a href="#SiteInformation">Site Information</a> <br>
<a href="#ShapefileNames">Shapefile Names</a> <br>
<a href="#MapDefinitions">Map Definitions</a> <br>
</blockquote>
<a href="#AWIPSstandardnames">AWIPS standard names</a>
<a href="#Maps.pyFormat">Maps.py Format</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#SiteInformation">Site Information</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#ShapefileNames">Shapefile Names</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#MapDefinitions">Map Definitions</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#PuttingitallTogetherwiththemaplist">Putting it all togetherwith the maps list</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#ImportinglocalMaps">Importing localMaps</a><br>
<br>
<a href="#ShapefileDescription">Shapefile Description</a>
<blockquote><a href="#Filenames">Filenames</a> <br>
<a href="#CatalogEntryDescription">Catalog Entry Description</a> <br>
<a href="#Attributes">Attributes</a></blockquote>
<a href="#AWIPSstandardnames">AWIPS standard names</a> <br>
<a href="#ShapefileDescription">Shapefile Description</a><br>
&nbsp;&nbsp;&nbsp;<a href="#Filenames">Filenames</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#CatalogEntryDescription">Catalog Entry Description</a> <br>
&nbsp;&nbsp;&nbsp;<a href="#Attributes">Attributes</a> <br>
<hr width="100%">
<h2><a name="Overview"></a>Overview</h2>
The Maps.java file defines the attributes of each map. The server
when
started looks through the list of maps as defined in the Maps.java file
and
generates maps. These maps may be retrieved through the server
protocol.
The map data available through the protocol includes polygons, points,
and arcs. The information contains the geographical data and the
set of attributes that define the shape.
<p>The map generation software uses shapefiles as the input.
These
shapefiles are filtered by domain (based on the site) and
attributes.
There are different attributes available for each shapefile.
Refer
to the AWIPS Map Background
Database provided by the National Weather Service for details on the
available shapefiles and the attributes contained within each
The Maps.py file defines how edit areas are generated for each map.
When activated, the server processes the list of maps defined in the Maps.py file
and generates edit areas.
<p>The edit area generation software uses the maps database tables as input.
These tables are populated by importing shape files provided by the National Weather Service.
These tables are filtered by domain (based on the site) and attributes.
There are different attributes available for each table.
Refer to the AWIPS Map Background Database provided by the National Weather Service
for details on the available shapefiles and the attributes contained within each
shapefile.
This information will be needed in order to tailor a map to your site.
This information will be needed in order to tailor edit area generation for your site.
</p>
<p>The Maps.java file also is used to define and automatically generate
edit
areas based on the shapefile polygons. The user can select which
polygons will be converted into edit areas and which edit area groups
they
will be assigned.
<p>The user can select which polygons will be converted into edit areas and
to which edit area groups they will be assigned.
</p>
<p><b><font color="#ff0000">In AWIPS1 you could override changes in Maps.py, using the <a
<p><b><font color="#ff0000">This information is provided for you to
help
you understand the format of Maps.py. You should NEVER change the
original Maps.py since your changes will be overwritten with the next
upgrade.
See the
<a href="serverConfiguration.html#ServerDatabaseConfigurationModificationOptions">server configuration overview</a>
for information on how to make changes that are supported to the map backgrounds.</font></b>
</p>
<p><b><font color="#ff0000">To override definitions in Maps.py, use the <a
href="localMapsConfig.html">localMaps.py</a>
technique. In AWIPS2, this is slated for implementation under DR9441. To override
the default map filenames, i.e., source filenames
for the shapefiles, use step 3 of the <a href="MapFiles.html">Map Files</a> method instead of the
AWIPS1 <a href="localMapFiles.html">localMapFiles.py</a> method.</font></b>
technique. </font></b>
</p>
<p><b><font color="#ff0000">To update shapefiles, refer to the <a href="MapFiles.html">MapFiles</a>
documentation, specifically the section on <a href="MapFiles.html#Updating">Updating Shapefiles</a>.
<p><b><font color="#ff0000">To update the maps database, refer to the <a
href="MapFiles.html">MapFiles</a>
documentation, specifically the section on <a
href="MapFiles.html#Updating">Updating
Shapefiles</a>.
</font></b></p>
<p>
Software releases after Jan 1, 2006 separate the map shapefile from the
CORE GFE. In some applications, such as AWIPS, the map
CORE GFE.&nbsp;&nbsp; In some applications, such as AWIPS, the map
shapefile configuration becomes the responsibility of the site since
the map shapefiles will no longer be shipped with the GFE
software. A separate install is available for non-AWIPS
purposes and is posted with the software releases. If the
associated Map Shapefile install is not installed at your site, then
associated Map Shapefile is not installed at your site, then
sites will be responsible for:<br>
<ul>
<li>creating the maps bundles that contain the map filenames for the baselined maps.<br>
</li>
<li>Downloading updated shapefiles from either GSD or from the NOAA1 web server.<br>
</li>
<li>Downloading updated shapefiles from the NOAA1 web server</li>
<li>Importing the downloaded shapefiles into the maps database</li>
<li>Creating/modifying the localMaps.py file to reference the appropriate database tables</li>
</ul>
<p></p>
</p>
<hr width="100%">
<h2><a name="Maps.pyFormat"></a><b>Format</b></h2>
<h2><a name="Maps.pyFormat"></a><b>Maps.py Format</b></h2>
<h3>
<a name="SiteInformation"></a><b>Site Information</b></h3>
EDEX reads in the site identifier, map directory, and the <a
href="serverConfig.html#GridDomainConfiguration">site's
specific grid domains</a>. Several variables are computed:
<ul>
<li>CWA - site identifier</li>
<li>MAPDIR - location for the shapefile used as input to the map
generation
routines</li>
</ul>
<h3><a name="ShapefileNames"></a>Shapefile Names</h3>
The names of the shapefiles are referenced in the <a href="MapFiles.html">maps database</a>.
Maps.py imports the <a href="siteConfig.html">siteConfig</a> file which
provides the site identifier and the <a href="serverConfig.html#GridDomainConfiguration">site's
specific grid domain</a>.
<pre>
CWA = siteConfig.GFESUITE_SITEID
</pre>
<h3><a name="MapDefinitions"></a><b>Map Definitions</b></h3>
The map definition section defines each map that is desired.
<h2>
<hr width="100%"><a name="AWIPSstandardnames"></a>AWIPS standard names</h2>
The AWIPS standard names table shows a sample filename, as loaded from
the NWS map database, and the attribute fields. The user must download
the files from the NWS map databases, unzip it, and either copy the
resulting
uncompressed files, or gzip -9 them to save space, to the appropriate
directory.
This list is an example, refer to the NWSH Map GIS page for complete
up-to-date
information. The link to the NWS Map GIS page is <a
href="http://www.awips.noaa.gov/mapdata/newcat/">http://awips.nws.noaa.gov/mapdata/newcat/</a>
<table nosave="" border="1" width="100%">
The map definition section defines each map for which edit area generation is desired.
Only a small portion of the Maps.py is shown here. Numerous examples with differing
capabilities are shown.
<h4>Basic Map with Automatically Generated Edit Areas</h4>
This definition is for a basic map, with no filtering of attributes and automatic creation
of edit areas. The edit areas will be included in the 'Misc' edit area group by default since
no edit area group is specified.
The ShapeTable object is created in the first line. The name of the maps database table
is passed as a parameter to the ShapeTable constructor.
<pre>
CWAzones = ShapeTable('zone')
CWAzones.editAreaName = ['state','zone']
</pre>
The ifpServer can automatically generate edit areas based on the
information in the shapefiles. The user specifies the "editAreaName" in
the Maps.py or localMaps.py files, and the ifpServer uses that
information to determine the name of each edit area.&nbsp;&nbsp; There
are three forms to the editAreaName line as shown:<br>
<br>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2"
cellspacing="2">
<tbody>
<tr>
<td>Shapefile Contents</td>
<td>Example File Name (without extensions)</td>
<td>Attributes</td>
</tr>
<tr>
<td>Cities</td>
<td>web_city</td>
<td>LAND_WATER, ST_FIPS, COUNTY_FIP, PL_FIPS, NAME, LON, LAT,
POP_1990,
ST, WATCH_WARN, PROG_DISC</td>
</tr>
<tr>
<td>Counties</td>
<td>c_19nv01</td>
<td>STATE, CWA, COUNTYNAME, FIPS, TIME_ZONE, FE_AREA, LON, LAT</td>
</tr>
<tr>
<td>County Warning Areas</td>
<td>w_30nv01</td>
<td>WFO, CWA, LON, LAT</td>
</tr>
<tr>
<td>Coastal and Offshore Marine Zones</td>
<td>mz15ja02</td>
<td>ID, WFO, NAME, LON, LAT, WFO_AREA</td>
</tr>
<tr>
<td>High Seas Marine Zones</td>
<td>hz02oc01</td>
<td>WFO, LON, LAT, HEADING</td>
</tr>
<tr>
<td>Interstates</td>
<td>roads</td>
<td>LENGTH, TYPE, ADMN_CLASS, TOLL_RD, RTE_NUM1, RTE_NUM2, ROUTE</td>
</tr>
<tr>
<td>Lakes</td>
<td>lk17de98</td>
<td>NAME, FEATURE, LON, LAT</td>
</tr>
<tr>
<td>NWS River Forecast Basins</td>
<td>ba18oc01</td>
<td>ID, NAME, CWA, RFC, LON, LAT</td>
</tr>
<tr>
<td>Public Forecast Zones</td>
<td>z_14ja02</td>
<td>STATE, ZONE, CWA, NAME, STATE_ZONE, TIME_ZONE, FE_AREA, LON,
LAT</td>
</tr>
<tr>
<td>River Forecast Center Regions</td>
<td>rf19fe99</td>
<td>SITE_ID, STATE, RFC_NAME, RFC_CITY, BASIN_ID</td>
</tr>
<tr>
<td>States and Territories</td>
<td>s_24ja01</td>
<td>STATE, NAME, FIPS, LON, LAT</td>
</tr>
<tr>
<td>Canadian Provinces</td>
<td>province</td>
<td>CODE, NAME</td>
</tr>
<tr>
<td>Mexican States</td>
<td>mx_state</td>
<td>CODE, NAME</td>
</tr>
<tr>
<td>Fire Weather Zones</td>
<td>fz28my02</td>
<td>STATE, ZONE, STATE_ZONE, NAME, TIME_ZONE, FE_AREA, LAT, LON</td>
</tr>
<tr>
<td>ISC Combined Public and Marine Areas</td>
<td>cm15au02</td>
<td>WFO, LON, LAT</td>
</tr>
<tr>
<td style="vertical-align: top;">Fire Weather Area of
Responsibility<br>
<td style="vertical-align: top;">mapVariable.editAreaName =
"string"<br>
</td>
<td style="vertical-align: top;">cf26ap04<br>
<td style="vertical-align: top;">Single String Format<br>
</td>
<td style="vertical-align: top;">CWA<br>
</tr>
<tr>
<td style="vertical-align: top;">mapVariable.editAreaName =
["string1", "string2", "string3"]<br>
</td>
<td style="vertical-align: top;">List of Strings Format<br>
</td>
</tr>
<tr>
<td style="vertical-align: top;">mapVariable.editAreaName =
functionName<br>
</td>
<td style="vertical-align: top;">Function Format<br>
</td>
</tr>
</tbody>
</table>
<p>The Example File Name is the name of the file matching the name in
the
AWIPS Map Catalog <a href="http://www.awips.noaa.gov/mapdata/newcat">AWIPS
Map Background Database</a>.&nbsp; Several of these files are tagged
with
a date, therefore their name will change when updated.
</p>
<p></p>
<hr width="100%">
<h2><a name="ShapefileDescription"></a>Shapefile description</h2>
<h3>
<a name="Filenames"></a>Filenames</h3>
Shapefiles provide a complete non-topological description of
2-dimensional
geometric shapes, in three files:
<p>filename.shp - shape description
<br>
filename.shx - index (shape to attributes)
<br>
filename.dbf - attributes
</p>
<p>&nbsp;The shape of each geometric (spatial) object is either a
point,
line, or polygon, and is described completely and in sequential order
by
the file *.shp. Attributes for each shape are stored sequentially in
the
same order by the file *.dbf, using the dBASE III+ Database File
Structure.
An index of shapes to attributes is maintained in the *.shx file. The
Shapefile
format is documented on-line at <a href="http://www.esri.com">http://www.esri.com</a>.
By convention, a Shapefile is associated by one prefix filename. The
contents
of the *.dbf file can be changed without damaging the index
relationship
to *.shp as long as dBASE records are not added, deleted or re-ordered.
Shapefiles can be renamed, provided that all three components are given
the same filename and the extensions are not changed. We have
restricted
the filenames to 8 characters for compatibility with DOS systems.
</p>
<p>&nbsp;Each catalog entry provides an image of the Shapefile. When
the
geographic area is not obvious, the Shapefile is shown as darker points
or lines on a lighter background. Space is conserved using the "zip"
compression
technique. Public domain software to extract *.zip files are now
available
for most operating systems and hardware environments from <a
href="ftp://ftp.uu.net/pub/archiving/zip/">ftp://ftp.uu.net/pub/archiving/zip/</a>.
for NWS users. Make sure that the *.zip file has been downloaded using
a binary transfer method. Previous archives in the *.tar.Z (UNIX) and
self-extracting
*.exe (DOS) formats have been deleted.
</p>
<p>filename.zip - compressed (zip)
<br>
filename.gif - Graphics Interchange Format
<br>
filename.txt - flat text listing of filename.dbf
<h5>Single String Format</h5>
In the example below, the name of each generated edit area is obtained
from the attribute <b>zone</b> specified in the field editAreaName. The program looks
up the value for the attribute <b>zone</b> in the database record for each polygon
and creates an edit area with that name. The example below uses the simple
format for the editAreaName, in which only one attribute is specified.
<pre>
CWAzones = ShapeTable('zone')
CWAzones.editAreaName = 'zone'
</pre>
<p>Examples of the names of the edit areas generated from the above
snippet
is shown in the following table:
<br>
&nbsp;
<table nosave="" border="1" width="100%">
<tbody>
<tr>
<td>zone value from shapefile</td>
<td>state (not used in this example)</td>
<td>Name of Edit Area</td>
</tr>
<tr>
<td>034</td>
<td>CO</td>
<td>zone034</td>
</tr>
<tr>
<td>041</td>
<td>CO</td>
<td>zone041</td>
</tr>
<tr>
<td>041</td>
<td>NE</td>
<td>zone041</td>
</tr>
</tbody>
</table>
</p>
<h3><a name="CatalogEntryDescription"></a>Catalog Entry Description</h3>
Naming Convention - a description of the name of the Shapefile. Most
data
in the catalog have a two letter prefix for the type of data and the
date
in ddmmyy format.
<br>
Location - directory in Catalog (URL)
<br>
Shapefile Type - type of shape {point, polyline, polygon}
<br>
Source - origin of shape and attribute information
<br>
Last Modified - last date shapes or attributes modified
<br>
File size information: - size of all relavant files in bytes and the
number of records in the Dbase file (.dbf)for shapefiles or number of
features
in a text file.
<p>Note that if a site's domain covers more than one state, this simple form of generating
edit area names will not work. The "NE" example above illustrates
that the same edit area name was generated even though the zones were
from different states. Also note that the naming of the edit area includes
the name "zone" only because the value of the zone value begins with a
number.
</p>
<p><span style="font-weight: bold; color: rgb(255, 0, 0);">NOTE:
Changing the default set of edit area names as supplied in the baseline
may render your text formatters and VTEC inoperable. The text
formatters and VTEC assume standard UGC-named edit areas, such as
COZ023 and UTC013.</span><br>
</p>
<h5>List of Strings Format</h5>
<p>A second, more complex form of the editAreaName involves using
a Python list. The naming of an edit area is determined by
using more than one attribute. This example uses the more complex
form for the editAreaName, in which two attributes are specified.
</p>
<pre>
CWAzones = ShapeTable('zone')
CWAzones.editAreaName = ['state','zone']
</pre>
<p>Examples of the names of the edit areas generated from the above
snippet
is shown in the following table:
<br>
&nbsp;
<h3><a name="Attributes"></a>Attributes</h3>
field - dBASE field name (1 to 10 characters)
<br>
type - field type {character, numeric, logical, date}
<br>
width,dec - field type specifications:
<br>
{character: width = # characters} {logical: width = 1} {date: width
= 8}
<br>
{numeric: width = # digits, dec = # decimal places}
<br>
Description - brief statement of field usage.
<table nosave="" border="1" width="100%">
<tbody>
<tr>
<td>zone value from shapefile</td>
<td>state (not used in this example)</td>
<td>Name of Edit Area</td>
</tr>
<tr>
<td>034</td>
<td>CO</td>
<td>CO_034</td>
</tr>
<tr>
<td>041</td>
<td>CO</td>
<td>CO_041</td>
</tr>
<tr>
<td>041</td>
<td>NE</td>
<td>NE_041</td>
</tr>
</tbody>
</table>
</p>
<p>The edit area name is determined from the value of the <b>state</b>
attribute,
followed by an underscore character, and then the value of the <b>zone</b>
attribute.
</p>
<p>Here is the software algorithm for naming of edit areas:
</p>
<ul>
<li>the value for each of the attributes is extracted from the
shapefiles.
All spaces and non-alphanumeric characters are removed from the
value.<br>
Example: "Washington Meadows" would be changed to "WashingtonMeadows"
</li>
<li>if any of the values results in an empty string, then the edit area is not generated.
</li>
<li>the values are put together with an underscore separator for each of the attributes.<br>
Example: Attribute <b>state</b> has a value of "CO", Attribute <b>zone</b> has a value of "034".
Result is CO_034.
</li>
<li>if the leading character of the result begins with a number, then the name
of the first attribute is prefixed to the string.<br>
Example: If the preceding string was 034 and its attribute was <b>zone</b>, then the resulting
edit area name becomes zone034.
</li>
</ul>
The ordering of the list of attributes can change the naming as shown
in
the following table, which assumes <b>zone</b>=034, <b>state</b>=CO, <b>wfo</b>=BOU,
<b>name</b>=Summit County/Mosquito Range/Indian Peaks:
<br>
&nbsp;
<table nosave="" border="1" width="100%">
<tbody>
<tr>
<td>editAreaName string</td>
<td>Name of Edit Area</td>
</tr>
<tr>
<td>'zone'</td>
<td>zone034</td>
</tr>
<tr>
<td>['zone','state']</td>
<td>zone034_CO</td>
</tr>
<tr>
<td>['state','zone']</td>
<td>CO_034</td>
</tr>
<tr>
<td>['wfo','name']</td>
<td>BOU_SummitCountyMosquitoRangeIndianPeaks</td>
</tr>
<tr>
<td>['zone','name','state']</td>
<td>zone034_SummitCountyMosquitoRangeIndianPeaks_CO</td>
</tr>
</tbody>
</table>
<p>Note that specification of an attribute that doesn't exist will simply
use the name in the string. For example, if you are creating edit
areas and you want them of the form ISC_xxx, where xxx is the value of the <b>wfo</b>
attribute.
The editAreaName string would be the following:
<pre>
ISCareas.editAreaName = ['ISC', 'wfo']
</pre>
</p>
<p>
<span style="font-weight: bold; color: rgb(255, 0, 0);">
NOTE: Changing the default set of edit area names as supplied in the baseline may
render your text formatters and VTEC inoperable. The text formatters
and VTEC assume standard UGC-named edit areas, such as COZ023 and UTC013.
</span>
</p>
<h5>Function Format<br>
</h5>
<p>
Occasionally there is a need to calculate a special edit area name and
the single or list of strings methods are not sufficient. The
function format requires the user to name a function and then define a
function. The function has one argument, which receives a
dictionary of attribute names and their values. The return
value of the function is a string which becomes the edit area name.
</p>
<p>
For example, lets say that we want edit area names based on the county
FIPS code. The desired format is stateCfips, such as COC013, for
Colorado County #13. The county shapefile has a 'STATE'
attribute, such as "CO", and it has a 'FIPS' attribute, such as 08013
for Colorado County #13.&nbsp;&nbsp; Using the list of strings format,
['STATE', 'C', 'FIPS'], you would end up with CO_C_08013, when we
really want COC013.
</p>
This is how the code would be implemented:
<pre>
def cwaEAN(atts):
fips = atts['fips'][-3:] #take the last three characters from the FIPS code
s = atts['state'] + "C" + fips #assemble the name
return s #return the complete edit area name
CWAcounties = ShapeTable('county')
CWAcounties.editAreaName = cwaEAN
</pre>
The "atts" dictionary looks simlilar to the following:
<pre>
{'countyname': 'Delta',
'cwa': 'MQT'
'fe_area': 'sr',
'fips': '26041',
'lat': 45.82085,
'lon': -86.909679999999994,
'state': 'MI',
'time_zone': 'E',
}
</pre>
and the final string is: MIC041<br>
<h4>Basic Map with Automatically Generated Edit Areas with group
definition</h4>
An example of a basic map with automatically generated edit areas with
group definition:
This is identical to the Basic Map with Automatically Generated Edit
Areas case except that the user has specified a group name. All of
the generated edit areas will be placed in the edit area group called
'Zones'.
<pre>
CWAzones = ShapeTable('zone')
CWAzones.editAreaName = 'zone'
CWAzones.groupName = 'Zones'
</pre>
<h4>Filtered Map with Automatically Generated Edit Areas</h4>
This definition is for a filtered map with no automatic creation of edit
areas. The filter line performs the filtering. The basic format
of this line is as follows:
<pre>
pythonMapName.filter(lambda x : x['ATTRIBUTENAME'] = AttributeValue)
</pre>
<p>where ATTRIBUTENAME is one of the <a href="#Attributes">attributes</a>
in the shapefile, and AttributeValue is the value that must match in
the
shapefile for this shape to be kept in the map. Attributes for the NWS
shapefiles can be obtained from the AWIPS Map Catalog <a
href="http://www.nws.noaa.gov/geodata/">AWIPS
Map Background Database</a>.
</p>
<pre>
CWAzones = ShapeTable('Zone')
CWAzones.filter(lambda x : x['cwa'] == CWA)
CWAzones.editAreaName = cwazones
</pre>
<p>The "lambda" function is a shortcut method of writing a function,
the code snippet below performs the identical function:
</p>
<pre>
def cwaZoneFilt(x):
return x['cwa'] == CWA
CWAzones = ShapeTable('zone')
CWAzones.filter(cwaZoneFilt)
CWAzones.editAreaName = cwazones
</pre>
<p>Since this is all Python code, there is another technique you can
use to write a filter function which is complex. Here is an example
of writing a filter that selects certain counties (Summit, Sandusky,
Huron, and Medina) from the county database table for a particular state (Ohio) and
cwa (Cleveland):
</p>
<pre>
def exampleFilt(x):
myCounties = ['Summit', 'Sandusky', 'Huron', 'Medina']
return x['countyname'] in myCounties and x['st'] == "OH" and x['cwa'] = 'CLE'
OHcounties = ShapeTable('county')
OHcounties.filter(exampleFilt)
OHcounties.editAreaName = 'countyname'
</pre>
<h4>Filtered Map with Automatically Generated Edit Areas with group
definition</h4>
This is identical to the Filtered Map with Automatically Generated Edit
Areas case except that the user has specified a group name. All
of the generated edit areas will be placed in the edit area group called 'Zones'.
<pre>
CWAzones = ShapeTable('zone')
CWAzones.filter(lambda x : x['cwa'] == CWA)
CWAzones.editAreaName = ['state','zone']
CWAzones.groupName = 'Zones'
</pre>
<h2><a name="PuttingitallTogetherwiththemaplist"></a>Putting it all
Together with the map list</h2>
In order for the system to recognize the list of defined maps, they
must be put all together in a list. The list MUST be called
maps. This example list, shows that there are three maps defined. The
entries within the list are the Python variable names (name to the left of the
equal sign on the ShapeTable line).
<pre>
maps = [ CWAcounties, Counties, CWAzones ]
</pre>
<h2><a name="ImportinglocalMaps"></a>Importing localMaps</h2>
The final section of the Maps.py file is the software that checks for a
localMaps configuration and uses it if it exists. Do not change
this
section of the file.
<pre>
# import the local maps file</tt>
try:
import localMaps
except:
pass
</pre>
<hr width="100%">
<div class="Body"><a href="#Overview">Back To Top</a>
<div class="Body"><tt>&nbsp;<a href="#Overview">Back To Top</a></tt>
<br>
<a href="GFESuite.html#TableOfContents">Back To TOC</a></div>
<tt>&nbsp;<a href="GFESuite.html#TableOfContents">Back To TOC</a></tt></div>
</body>
</html>

View file

@ -9,55 +9,43 @@
<title>Server Configuration Information</title>
</head>
<body bgcolor="#ffffff">
<h1 class="3Heading">
Server Configuration Information</h1>
<div class="3Heading">January 3, 2012<br>
</div>
<div class="3Heading">
<br>
<a name="TableofContents"></a>Table of Contents
<br>
<a href="#Overview">Overview</a>
<br>
<a href="#ServerDatabaseConfigurationModificationOptions">Server
Database
Configuration Modification Options</a>
<br>
<a href="#ServerMapConfigurationModificationOptions">Server Map
Configuration
Modification Options</a>
<br>
<a href="#LocationofFiles">Location of Files</a>
<br>
<h1 class="3Heading">Server Configuration Information</h1>
<div class="3Heading">September 25, 2012<br></div>
<div class="3Heading"><br>
<a name="TableofContents"></a>Table of Contents<br>
<a href="#Overview">Overview</a><br>
<a href="#ServerDatabaseConfigurationModificationOptions">
Server Database Configuration Modification Options</a><br>
<a href="#ServerMapConfigurationModificationOptions">
Server Map Configuration Modification Options</a><br>
<a href="#LocationofFiles">Location of Files</a><br>
<hr width="100%"></div>
<h2 class="3Heading">
<a name="Overview"></a>Overview</h2>
<h2 class="3Heading"><a name="Overview"></a>Overview</h2>
<div class="3Heading">GFE uses several configuration files:</div>
<ul>
<li class="3Heading">
<a href="siteConfig.html">siteConfig.py</a> - Defines
directory
and site variables</li>
<li class="3Heading">
<a href="serverConfig.html">serverConfig.py</a> - Contains main
database
definitions</li>
<li class="3Heading">
<a href="localConfig.html">localConfig.py</a> - Overrides for the
serverConfig.py
(Site-level file)</li>
<li class="3Heading">
<a href="localWxConfig.html">localWxConfig.py</a> - Overrides for
the weather
definition in serverConfig.py (Site-level file)</li>
<li class="3Heading">
<a href="mapConfig.html">Maps.java</a> - Defines the map backgrounds,
and
automatically generated edit areas that are available.</li>
<li class="3Heading">
<a href="MapFiles.html">Map Files - overview</a> - Defines the shapefile
names used
in the map generation.</li>
<li class="3Heading"><a href="siteConfig.html">siteConfig.py</a> -
Defines directory and site variables</li>
<li class="3Heading"><a href="serverConfig.html">serverConfig.py</a> -
Contains main database definitions</li>
<li class="3Heading"><a href="localConfig.html">localConfig.py</a> -
Overrides for the serverConfig.py (Site-level file)</li>
<li class="3Heading"><a href="localWxConfig.html">localWxConfig.py</a> -
Overrides for the weather definition in serverConfig.py (Site-level file)</li>
<li class="3Heading"><a href="mapConfig.html">Maps.py</a> -
Defines the automatically generated edit areas that are available.</li>
<li class="3Heading"><a href="localMapsConfig.html">localMaps.py</a> -
Overrides for the Maps.py file (Site-level file).</li>
<li class="3Heading"><a href="MapFiles.html">Map Files - overview</a> -
Explains how database tables are populated for use in the map and edit area generation.</li>
<li class="3Heading"><a href="VTECPartners.html">VTECPartners.py</a>
- Defines the VTEC coordination and filtering by site.</li>
<li class="3Heading"><a href="localVTECPartners.html">localVTECPartners.py</a>
@ -65,83 +53,84 @@ in the map generation.</li>
</ul>
<div class="3Heading">The <a href="localConfig.html">localConfig.py</a>
and <a href="localWxConfig.html">localWxConfig.py</a> files are
optional
and are only used to override the standard database definition defaults
optional and are only used to override the standard database definition defaults
shipped with the system.<br>
<br>
</div>
<div class="3Heading">There are several different options a site has
for
making modifications to these files. <b><font color="#ff0000">At
for making modifications to these files. <b><font color="#ff0000">At
no time should the files that are sent with the software release or
install
be modified since these will be overwritten with the next upgrade.</font></b>&nbsp;
install be modified since these will be overwritten with the next upgrade.</font></b>&nbsp;
See the section on <a href="#LocationofFiles">file locations</a> for
information
on where the configuration files should be located.
information on where the configuration files should be located.
<br>
&nbsp;</div>
<div class="3Heading">The <a href="serverConfig.html">serverConfig.py</a>
is used to define the following items:</div>
<ul>
<li class="3Heading">
the set of weather elements,</li>
<li class="3Heading">
the weather configuration (e.g., possible coverages, weather types,
intensities),</li>
<li class="3Heading">
the set of map projections,</li>
<li class="3Heading">
office grid domains and resolution,</li>
<li class="3Heading">
grid time constraint information; and</li>
<li class="3Heading">
database model configuration.</li>
<li class="3Heading">the set of weather elements,</li>
<li class="3Heading">the weather configuration (e.g., possible coverages, weather types,
intensities),
</li>
<li class="3Heading">the set of map projections,</li>
<li class="3Heading">office grid domains and resolution,</li>
<li class="3Heading">grid time constraint information; and</li>
<li class="3Heading">database model configuration.</li>
</ul>
<div class="3Heading">The <a href="localConfig.html">localConfig.py</a>
file is used:</div>
<ul>
<li class="3Heading">
to add or redefine items in the serverConfig.py file for site use.</li>
<li class="3Heading">to add or redefine items in the serverConfig.py file for site use.</li>
</ul>
<div class="3Heading">
<div class="3Heading">The <a href="localWxConfig.html">localWxConfig.py</a>
file is used:
<ul>
<li>
to add or modify the weather definition in serverConfig.py</li>
<li>to add or modify the weather definition in serverConfig.py</li>
</ul>
</div>
<div class="3Heading">
<div class="3Heading">
<div class="3Heading">The <a href="siteConfig.html">siteConfig.py</a>
file
is used:</div>
file is used:</div>
<ul>
<li class="3Heading">
to identify the main directories</li>
<li class="3Heading">
to identify the server network information</li>
<li class="3Heading">to identify the main directories</li>
<li class="3Heading">to identify the server network information</li>
<li class="3Heading">to identify the site identifier</li>
</ul>
<br>
The <a href="VTECPartners.html">VTECPartners.py</a> file
is used:<br>
The <a href="VTECPartners.html">VTECPartners.py</a> file is used:<br>
<ul>
<li>to configure the site filtering for the Merge VTEC and VTEC
Decoder processes</li>
<li>to configure the interval of active table synchronization with
adjacent sites</li>
<li>to specify the adjacent sites used for active table
synchronization<br>
</li>
<li>to configure the site filtering for the Merge VTEC and VTEC Decoder processes</li>
<li>to configure the interval of active table synchronization with adjacent sites</li>
<li>to specify the adjacent sites used for active table synchronization</li>
</ul>
The <a href="localVTECPartners.html">localVTECPartners.py</a> file
is used:<br>
The <a href="localVTECPartners.html">localVTECPartners.py</a> file is used:<br>
<ul>
<li>to override the entries in <a href="VTECPartners.html">VTECPartners.py</a>.<br>
</li>
</ul>
<div class="3Heading">The <a href="localMapsConfig.html">localMaps.py</a> file is optional
and is only used to override the standard edit area definitions shipped with the
system. There are several different options a site has for making modifications
to this file.
<b><font color="#ff0000">
At no time should the files that are sent with the software release or install be
modified since these will be overwritten with the next upgrade.
</font></b>
See the section on <a href="#LocationofFiles">file locations</a> for information on
where the configuration files should be located.</div>
<br>
The <a href="mapConfig.html">Maps.py</a> file is used to define:</div>
<ul>
<li class="3Heading">the set of edit areas that are automatically generated
from the map backgrounds.
</li>
</ul>
<div class="3Heading">The <a href="localMapsConfig.html">localMaps.py</a>
file is used:</div>
<ul>
<li class="3Heading">
to add, remove, or redefine items in the Maps.py file for site use.</li>
</ul>
<div class="3Heading">
<hr width="100%"></div>
<h2 class="3Heading">
@ -172,7 +161,6 @@ file.&nbsp;
For those cases, you will be forced to completely override the
serverConfig.py
file. See the <a href="localConfig.html">localConfig.py</a> file for
details.&nbsp;&nbsp; For VTEC configuration, you would copy <a
href="VTECPartners.html">VTECPartners.py</a> from the <a
href="#locationofFiles">original location</a> (leaving the original
one there) to the <a href="#locationofFiles">customized location</a>.<br>
@ -191,13 +179,51 @@ using the <a href="localWxConfig.html">localWxConfig.py</a>
file.&nbsp; VTEC coordination information is overridden using the <a
href="localVTECPartners.html">localVTECPartners.py</a> file.<br>
</div>
<hr width="100%"></div>
<h2 class="3Heading">
<a name="ServerMapConfigurationModificationOptions"></a>
Server Map Configuration Modification Options</h2>
Edit area generation is handled somewhat differently from the server
database configuration and is defined in a different file.
<h4 class="3Heading">No Changes From Installed Files</h4>
This option should be chosen if the <a href="mapConfig.html">Maps.py</a>
file is satisfactory and no changes are required.
<h4 class="3Heading">Partial Override of Map Backgrounds</h4>
<div class="3Heading">This option provides the site control over the
set of generated edit areas. If you want to change any item in the
<a href="mapConfig.html">Maps.py</a> file, you use the
<a href="localMapsConfig.html">localMaps.py</a>
file to add, modify, and/or remove edit areas.
</div>
<h4 class="3Heading">
Complete Override of Map Backgrounds <i><font color="#ff0000">(not
recommended)</font></i></h4>
There should be no reason to completely override the Maps.py file since
<a href="localMapsConfig.html">localMaps.py</a>
provides all of the override capability. But if you insist, you can copy the <a
href="mapConfig.html">Maps.py</a>
file from the <a href="#LocationofFiles">original location</a> (leave
the
original one there) to the <a href="#LocationofFiles">customized
location</a>.&nbsp;
Modify it in accordance with the <a href="mapConfig.html">map
configuration
manual</a>.&nbsp; Since Maps.py doesn't change frequently, all you
should
need to do is a comparison between the newly upgraded files and your
modified
files after each upgrade.
<div class="3Heading">&nbsp;</div>
<div class="3Heading">
<hr width="100%"></div>
<h2 class="3Heading">
<a name="LocationofFiles"></a>Location of Files</h2>
The location of the server configuration files are shown in the table
below:
<h2 class="3Heading"><a name="LocationofFiles"></a>Location of Files</h2>
The location of the server configuration files are shown in the table below:
<br>
<table nosave="" border="1" width="100%">
<tbody>
@ -238,6 +264,27 @@ below:
</td>
<td>/awips2/edex/data/utility/edex_static/site/SITE_ID/config/gfe</td>
</tr>
<tr>
<td>Original <a href="mapConfig.html">Maps.py</a></td>
<td>
<center>yes</center>
</td>
<td>/awips2/edex/data/utility/edex_static/base/config/gfe/Maps.py</td>
</tr>
<tr>
<td>Customized <a href="mapConfig.html">Maps.py</a></td>
<td>
<center>no</center>
</td>
<td>/awips2/edex/data/utility/edex_static/site/SITE_ID/config/gfe/Maps.py</td>
</tr>
<tr>
<td><a href="localMapsConfig.html">localMaps.py</a></td>
<td>
<center>no</center>
</td>
<td>/awips2/edex/data/utility/edex_static/site/SITE_ID/config/gfe/localMaps.py</td>
</tr>
<tr>
<td style="vertical-align: top;">Original <a
href="VTECPartners.html">VTECPartners.py</a><br>

View file

@ -44,7 +44,6 @@ CWA = siteConfig.GFESUITE_SITEID
#
#MapNameVariable = ShapeTable('the name of the map table')
#MapNameVariable.filter( -- - - - - filter string - - - - - - )
#MapNameVariable.name = 'the display name of the map'
#MapNameVariable.editAreaName = 'attribute in ShapeTable to be used to name
# 'editArea'
#MapNameVariable.groupName = 'name of the edit area group'
@ -201,104 +200,88 @@ def offshoreZoneFilter(atts):
#---------------------------------------------------------------------
# CWA Counties
CWAcounties = ShapeTable('County')
CWAcounties = ShapeTable('county')
CWAcounties.filter(lambda x : x['cwa'][0:3] == CWA or x['cwa'][3:6] == CWA)
CWAcounties.name = 'Counties_' + CWA
CWAcounties.editAreaName = ['state','countyname']
CWAcounties.groupName = 'Counties'
# FIPS for my counties - only include first WFO indicated in CWA field
FIPS = ShapeTable('County')
FIPS.name = 'FIPS_' + CWA
FIPS = ShapeTable('county')
FIPS.filter(lambda x : x['cwa'][0:3] == CWA)
FIPS.editAreaName = fips
FIPS.groupName = 'FIPS_' + CWA
# Unfiltered Counties
Counties = ShapeTable('County')
Counties.name = 'Counties'
Counties = ShapeTable('county')
Counties.editAreaName = fips
Counties.groupName = 'FIPS'
# CWA Zones
CWAzones = ShapeTable('Zone')
CWAzones = ShapeTable('zone')
CWAzones.filter(publicZoneFilter)
CWAzones.name = 'Zones_' + CWA
CWAzones.editAreaName = cwazones
CWAzones.groupName = 'Zones_' + CWA
# Unfiltered Zones
Zones = ShapeTable('Zone')
Zones.name = 'Zones'
Zones = ShapeTable('zone')
Zones.editAreaName = cwazones
Zones.groupName = 'Zones'
# Fire Wx Zones
FWCWAzones = ShapeTable('FireWxZones')
FWCWAzones = ShapeTable('firewxzones')
FWCWAzones.filter(firewxZoneFilter)
FWCWAzones.name = 'FireWxZones_' + CWA
FWCWAzones.editAreaName = fwxzones
FWCWAzones.groupName = 'FireWxZones_' + CWA
# Unfiltered Fire Wx Zones
FWZones = ShapeTable('FireWxZones')
FWZones.name = 'FireWxZones'
FWZones = ShapeTable('firewxzones')
FWZones.editAreaName = fwxzones
FWZones.groupName = 'FireWxZones'
# CWAs for all
cwas = ShapeTable('CWA')
cwas.name = 'CWA_all'
cwas = ShapeTable('cwa')
cwas.editAreaName = 'wfo'
cwas.groupName = 'WFOs'
# ISC areas for all
isc = ShapeTable('ISC')
isc.name = 'ISC_all'
isc = ShapeTable('isc')
isc.editAreaName = ['ISC','wfo']
isc.groupName = 'ISC'
# Fire Wx AOR for all
fwaor = ShapeTable('FireWxAOR')
fwaor.name = 'FireWxAOR'
fwaor = ShapeTable('firewxaor')
fwaor.editAreaName = ['FireWxAOR', 'cwa']
fwaor.groupName = 'FireWxAOR'
# Marine Zones for CWA
CWAmzones = ShapeTable('MarineZones')
CWAmzones = ShapeTable('marinezones')
CWAmzones.filter(marineZoneFilter)
CWAmzones.name = 'Marine_Zones_' + CWA
CWAmzones.editAreaName = marineZ
CWAmzones.groupName = 'MZones_' + CWA
# Marine Zones (unfiltered)
Mzones = ShapeTable('MarineZones')
Mzones.name = "Marine_Zones"
Mzones = ShapeTable('marinezones')
Mzones.editAreaName = marineZ
Mzones.groupName = 'MZones'
# States (unfiltered)
States = ShapeTable('States')
States.name = "States"
States = ShapeTable('states')
States.editAreaName = 'name'
States.groupName = 'States'
# RFC maps
rfc = ShapeTable('RFC')
rfc.name = "RFC"
rfc = ShapeTable('rfc')
rfc.editAreaName = ['ISC','site_id']
rfc.groupName = 'ISC'
# Offshore Marine Zones - unfiltered
offshore = ShapeTable('Offshore')
offshore.name = "Offshore_Marine_Zones"
offshore = ShapeTable('offshore')
offshore.editAreaName = offshoreZ
offshore.groupName = 'OffShoreMZones'
# Offshore Marine Zones - filtered by CWA
offshoreCWA = ShapeTable('Offshore')
offshoreCWA = ShapeTable('offshore')
offshoreCWA.filter(offshoreZoneFilter)
offshoreCWA.name = "Offshore_Marine_Zones_" + CWA
offshoreCWA.editAreaName = offshoreZ
offshoreCWA.groupName = 'OffShoreMZones_' + CWA

View file

@ -93,8 +93,6 @@ public class DbShapeSource {
private boolean filtered = false;
private String displayName;
private boolean hasEditAreaName = false;
private String groupName;
@ -119,8 +117,6 @@ public class DbShapeSource {
private DefaultQuery query;
private String typeName;
private SimpleFeatureType schema;
/**
@ -131,8 +127,7 @@ public class DbShapeSource {
* @throws IOException
*/
public DbShapeSource(String tableName) throws IOException {
this.tableName = tableName;
this.typeName = this.tableName.toLowerCase();
this.tableName = tableName.toLowerCase();
refCount++;
}
@ -179,14 +174,14 @@ public class DbShapeSource {
*/
public void open() throws IOException {
DataStore dataStore = getDataStore();
schema = dataStore.getSchema(typeName);
schema = dataStore.getSchema(this.tableName);
shapeField = schema.getGeometryDescriptor().getLocalName();
featureCollection = null;
featureIterator = null;
query = new DefaultQuery();
query.setTypeName(typeName);
query.setTypeName(this.tableName);
List<String> propNames = new ArrayList<String>(getAttributeNames());
propNames.add(shapeField);
query.setPropertyNames(propNames);
@ -209,7 +204,7 @@ public class DbShapeSource {
}
FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = dataStore
.getFeatureSource(typeName);
.getFeatureSource(this.tableName);
featureCollection = featureSource.getFeatures(query);
featureIterator = featureCollection.iterator();
}
@ -324,7 +319,7 @@ public class DbShapeSource {
*/
@Override
public String toString() {
return this.getDisplayName();
return this.getTableName();
}
/**
@ -362,14 +357,6 @@ public class DbShapeSource {
return this.featureCollection.size();
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String name) {
this.displayName = name;
}
public String getGroupName() {
return groupName;
}
@ -437,7 +424,7 @@ public class DbShapeSource {
public Date getLastUpdated() {
Date retVal = new Date();
String sqlQuery = "SELECT import_time FROM " + SCHEMA_NAME
+ ".map_version WHERE table_name = '" + this.typeName + "';";
+ ".map_version WHERE table_name = '" + this.tableName + "';";
try {
SqlQueryTask task = new SqlQueryTask(sqlQuery, DB_NAME);
QueryResult result = task.execute();

View file

@ -392,10 +392,7 @@ public class MapManager {
String error = "********* EDIT AREA GENERATION ERROR - MakeReferenceData *********\n"
+ "Error in generating edit areas, map #"
+ i
+ " Name: "
+ m.getDisplayName()
+ " Basename: "
+ m.getTableName();
+ " Basename: " + m.getTableName();
statusHandler.error(error, e);
_mapErrors.add(error);
} finally {
@ -487,7 +484,7 @@ public class MapManager {
return;
}
statusHandler.debug("creating: " + mapDef.getDisplayName());
statusHandler.debug("creating: " + mapDef.getTableName());
List<ReferenceData> data = createReferenceData(mapDef);
if (data.size() == 0) {
return;
@ -899,13 +896,13 @@ public class MapManager {
} catch (Exception e) {
String error = "********* EDIT AREA GENERATION ERROR - Create Reference Data *********\n"
+ "Error in generating edit areas from maps for map "
+ mapDef.getDisplayName();
+ mapDef.getTableName();
statusHandler.error(error, e);
_mapErrors.add(error);
}
statusHandler.debug("EAs: " + created);
editAreaMap.put(mapDef.getDisplayName(), created);
editAreaMap.put(mapDef.getTableName(), created);
return data;
}

View file

@ -38,7 +38,6 @@ from com.raytheon.edex.plugin.gfe.reference import DbShapeSource
class ShapeTable(JUtil.JavaWrapperClass):
def __init__(self, identifier):
self.identifier = identifier
self.name = None
self.editAreaName = None
self.groupName = None
self.javaObj = DbShapeSource(identifier)
@ -64,14 +63,10 @@ class ShapeTable(JUtil.JavaWrapperClass):
return ""
def toJavaObj(self):
self.javaObj.setDisplayName(self.name)
self.javaObj.setGroupName(self.groupName)
if self.editAreaName is not None:
self.javaObj.setHasEditAreaName(True);
return self.javaObj
def __repr__(self):
if self.name is not None:
return self.name
else:
return self.identifier
return self.identifier