/3.1 (Extension.1 Name: "Sp-coord" FirstRootClassName: "PMenu" Roots: 2 Roots: 4 Roots: 6 Roots: 8 Roots: 13 Roots: 14 Roots: 15 Roots: 16 Roots: 17 Roots: 18 Roots: 19 Roots: 20 Roots: 21 Roots: 22 Roots: 23 Version: 31 About: "Special Coordinate Transformations" InstallScript: 16 UninstallScript: 22 ExtVersion: 1 ) (PMenu.2 Help: "Convert to and from HRAP coordinates and work with XMRG files." Tag: "hrap" Child: 3 Label: "HRAP" ) (Choice.3 Help: "Generate a point shape file of HRAP center points. User chooses between HRAP, polar, stereographic, or geographic coordinates for output." Label: "Create HRAP Center Points" Click: "coord.generatehrapcenters" Shortcut: "Keys.None" ) (Butn.4 Help: "Converte point, line, or polygon shapefiles from geographic (lon-lat) coordinates to HRAP coordinates." Tag: "gh" Icon: 5 Click: "coord.shpgeotohrap" ) (AVIcon.5 Name: "geotohrap.gif" Data: 4e442049 6d616765 00010012 000f0000 Data: 010e7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 00000000 007f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 007f7f7f 7f7f7f7f Data: 7f7f7f00 7f7f7f7f 7f7f007f 7f7f7f7f Data: 7f7f7f7f 007f7f7f 7f7f7f7f 007f7f00 Data: 00007f7f 7f007f7f 7f7f7f7f 7f7f007f Data: 7f7f007f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 00000000 007f7f00 7f7f007f 7f7f007f Data: 7f7f7f7f 7f7f7f7f 007f7f7f 007f7f7f Data: 007f7f7f 7f7f7f7f 7f007f7f 7f7f007f Data: 7f7f007f 7f7f7f7f 7f7f007f 7f7f7f7f Data: 00000000 007f7f7f 7f7f7f00 7f7f7f7f Data: 7f7f007f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 007f7f7f 007f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f007f 7f7f007f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 00000300 00000000 00550000 aa0000ff Data: 00240000 24550024 aa0024ff 00490000 Data: 49550049 aa0049ff 006d0000 6d55006d Data: aa006dff 00920000 92550092 aa0092ff Data: 00b60000 b65500b6 aa00b6ff 00db0000 Data: db5500db aa00dbff 00ff0000 ff5500ff Data: aa00ffff 55000055 00555500 aa5500ff Data: 55240055 24555524 aa5524ff 55490055 Data: 49555549 aa5549ff 556d0055 6d55556d Data: aa556dff 55920055 92555592 aa5592ff Data: 55b60055 b65555b6 aa55b6ff 55db0055 Data: db5555db aa55dbff 55ff0055 ff5555ff Data: aa55ffff aa0000aa 0055aa00 aaaa00ff Data: aa2400aa 2455aa24 aaaa24ff aa4900aa Data: 4955aa49 aaaa49ff aa6d00aa 6d55aa6d Data: aaaa6dff aa9200aa 9255aa92 aaaa92ff Data: aab600aa b655aab6 aaaab6ff aadb00aa Data: db55aadb aaaadbff aaff00aa ff55aaff Data: aaaaffff ff0000ff 0055ff00 aaff00ff Data: ff2400ff 2455ff24 aaff24ff ff4900ff Data: 4955ff49 aaff49ff ff6d00ff 6d55ff6d Data: aaff6dff ff9200ff 9255ff92 aaff92ff Data: ffb600ff b655ffb6 aaffb6ff ffdb00ff Data: db55ffdb aaffdbff ffff00ff ff55ffff Data: aaffffff 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00020008 00050018 00000000 ) (Butn.6 Help: "Convert point shapefile from geographic (lon-lat) coordinates to HRAP coordinates." Tag: "ga" Icon: 7 Click: "coord.shpgeotoalbpt" ) (AVIcon.7 Name: "geotoalb.gif" Data: 4e442049 6d616765 00010012 000f0000 Data: 010e7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 00000000 007f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 007f7f7f 7f7f7f7f Data: 7f7f7f00 7f7f7f7f 7f7f007f 7f7f7f7f Data: 7f7f7f7f 007f7f7f 7f7f7f7f 007f7f00 Data: 00007f7f 7f007f7f 7f7f7f7f 7f7f007f Data: 7f7f007f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 00000000 007f7f00 7f7f7f00 00007f7f Data: 7f7f7f7f 7f7f7f7f 007f7f7f 007f7f7f Data: 007f7f7f 7f7f7f7f 7f007f7f 7f7f007f Data: 7f7f007f 7f7f7f7f 7f7f007f 7f7f7f7f Data: 00000000 007f7f7f 7f7f7f00 7f7f7f7f Data: 7f7f007f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 007f7f7f 007f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f007f 7f7f007f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 00000300 00000000 00550000 aa0000ff Data: 00240000 24550024 aa0024ff 00490000 Data: 49550049 aa0049ff 006d0000 6d55006d Data: aa006dff 00920000 92550092 aa0092ff Data: 00b60000 b65500b6 aa00b6ff 00db0000 Data: db5500db aa00dbff 00ff0000 ff5500ff Data: aa00ffff 55000055 00555500 aa5500ff Data: 55240055 24555524 aa5524ff 55490055 Data: 49555549 aa5549ff 556d0055 6d55556d Data: aa556dff 55920055 92555592 aa5592ff Data: 55b60055 b65555b6 aa55b6ff 55db0055 Data: db5555db aa55dbff 55ff0055 ff5555ff Data: aa55ffff aa0000aa 0055aa00 aaaa00ff Data: aa2400aa 2455aa24 aaaa24ff aa4900aa Data: 4955aa49 aaaa49ff aa6d00aa 6d55aa6d Data: aaaa6dff aa9200aa 9255aa92 aaaa92ff Data: aab600aa b655aab6 aaaab6ff aadb00aa Data: db55aadb aaaadbff aaff00aa ff55aaff Data: aaaaffff ff0000ff 0055ff00 aaff00ff Data: ff2400ff 2455ff24 aaff24ff ff4900ff Data: 4955ff49 aaff49ff ff6d00ff 6d55ff6d Data: aaff6dff ff9200ff 9255ff92 aaff92ff Data: ffb600ff b655ffb6 aaffb6ff ffdb00ff Data: db55ffdb aaffdbff ffff00ff ff55ffff Data: aaffffff 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00020008 00050018 00000000 ) (ToolMenu.8 Help: "Click on a point in an HRAP display and the longitude/latitude of that point is returned." Tag: "hgtool" Icon: 9 Cursor: "Cursors.Default" Apply: "coord.hraptolltool" Child: 10 Child: 11 ) (AVIcon.9 Name: "hraptogeo.gif" Data: 4e442049 6d616765 00010012 000f0000 Data: 010e7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 007f7f7f 007f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f007f 7f7f007f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 007f7f7f 007f7f7f Data: 7f7f7f00 7f7f7f7f 7f7f0000 0000007f Data: 7f7f7f7f 007f7f7f 7f7f7f7f 007f7f7f Data: 007f7f7f 7f007f7f 7f7f7f7f 7f7f007f Data: 7f7f007f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 007f7f7f 007f7f00 7f000000 00007f7f Data: 7f7f7f7f 7f7f7f7f 007f7f00 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 7f007f7f 7f007f7f Data: 7f7f7f7f 7f7f7f7f 7f7f007f 7f7f7f00 Data: 7f7f7f7f 7f7f7f7f 7f7f7f00 7f7f7f7f Data: 7f007f7f 0000007f 7f7f7f7f 7f7f7f7f Data: 7f7f7f00 7f7f7f00 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 7f000000 00007f7f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 00000300 00000000 00550000 aa0000ff Data: 00240000 24550024 aa0024ff 00490000 Data: 49550049 aa0049ff 006d0000 6d55006d Data: aa006dff 00920000 92550092 aa0092ff Data: 00b60000 b65500b6 aa00b6ff 00db0000 Data: db5500db aa00dbff 00ff0000 ff5500ff Data: aa00ffff 55000055 00555500 aa5500ff Data: 55240055 24555524 aa5524ff 55490055 Data: 49555549 aa5549ff 556d0055 6d55556d Data: aa556dff 55920055 92555592 aa5592ff Data: 55b60055 b65555b6 aa55b6ff 55db0055 Data: db5555db aa55dbff 55ff0055 ff5555ff Data: aa55ffff aa0000aa 0055aa00 aaaa00ff Data: aa2400aa 2455aa24 aaaa24ff aa4900aa Data: 4955aa49 aaaa49ff aa6d00aa 6d55aa6d Data: aaaa6dff aa9200aa 9255aa92 aaaa92ff Data: aab600aa b655aab6 aaaab6ff aadb00aa Data: db55aadb aaaadbff aaff00aa ff55aaff Data: aaaaffff ff0000ff 0055ff00 aaff00ff Data: ff2400ff 2455ff24 aaff24ff ff4900ff Data: 4955ff49 aaff49ff ff6d00ff 6d55ff6d Data: aaff6dff ff9200ff 9255ff92 aaff92ff Data: ffb600ff b655ffb6 aaffb6ff ffdb00ff Data: db55ffdb aaffdbff ffff00ff ff55ffff Data: aaffffff 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00020008 00050018 00000000 ) (Tool.10 Help: "Click on a point in an HRAP display and the longitude/latitude of that point is returned." Tag: "hgtool" Icon: 9 Cursor: "Cursors.Default" Apply: "coord.hraptolltool" ) (Tool.11 Help: "Click on a point in a geographic display and the corresponding HRAP coordinates are returned." Icon: 12 Cursor: "Cursors.Default" Apply: "coord.lltohraptool" ) (AVIcon.12 Name: "geotohrap.gif" Data: 4e442049 6d616765 00010012 000f0000 Data: 010e7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 00000000 007f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 007f7f7f 7f7f7f7f Data: 7f7f7f00 7f7f7f7f 7f7f007f 7f7f7f7f Data: 7f7f7f7f 007f7f7f 7f7f7f7f 007f7f00 Data: 00007f7f 7f007f7f 7f7f7f7f 7f7f007f Data: 7f7f007f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 00000000 007f7f00 7f7f007f 7f7f007f Data: 7f7f7f7f 7f7f7f7f 007f7f7f 007f7f7f Data: 007f7f7f 7f7f7f7f 7f007f7f 7f7f007f Data: 7f7f007f 7f7f7f7f 7f7f007f 7f7f7f7f Data: 00000000 007f7f7f 7f7f7f00 7f7f7f7f Data: 7f7f007f 7f7f007f 7f7f7f7f 7f7f7f7f Data: 7f7f7f7f 007f7f7f 007f7f7f 7f7f7f7f Data: 7f7f7f7f 7f7f007f 7f7f007f 7f7f7f7f Data: 7f7f7f7f 7f7f7f7f 7f7f7f7f 7f7f7f7f Data: 00000300 00000000 00550000 aa0000ff Data: 00240000 24550024 aa0024ff 00490000 Data: 49550049 aa0049ff 006d0000 6d55006d Data: aa006dff 00920000 92550092 aa0092ff Data: 00b60000 b65500b6 aa00b6ff 00db0000 Data: db5500db aa00dbff 00ff0000 ff5500ff Data: aa00ffff 55000055 00555500 aa5500ff Data: 55240055 24555524 aa5524ff 55490055 Data: 49555549 aa5549ff 556d0055 6d55556d Data: aa556dff 55920055 92555592 aa5592ff Data: 55b60055 b65555b6 aa55b6ff 55db0055 Data: db5555db aa55dbff 55ff0055 ff5555ff Data: aa55ffff aa0000aa 0055aa00 aaaa00ff Data: aa2400aa 2455aa24 aaaa24ff aa4900aa Data: 4955aa49 aaaa49ff aa6d00aa 6d55aa6d Data: aaaa6dff aa9200aa 9255aa92 aaaa92ff Data: aab600aa b655aab6 aaaab6ff aadb00aa Data: db55aadb aaaadbff aaff00aa ff55aaff Data: aaaaffff ff0000ff 0055ff00 aaff00ff Data: ff2400ff 2455ff24 aaff24ff ff4900ff Data: 4955ff49 aaff49ff ff6d00ff 6d55ff6d Data: aaff6dff ff9200ff 9255ff92 aaff92ff Data: ffb600ff b655ffb6 aaffb6ff ffdb00ff Data: db55ffdb aaffdbff ffff00ff ff55ffff Data: aaffffff 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00020008 00050018 00000000 ) (Script.13 Name: "coord.generatehrapcenters" SourceCode: "'********************************************************\n' Name: coord.generatehrapcenters\n'\n' Purpose: Create a shape file with the centers of HRAP cells.\n' The user may choose to create this shapefile in latitude/longitude \n' coordinates or another coordinate system. The conversion from \n' HRAP coordinates to latitude/longitude coordinates is included \n' in this program because this projection transformation is not \n' supported by ArcView. If a user wishes to convert the resulting\n' lat/lon shapefile to another coordinate systems the Projector! \n' extension can be used. \n'\n' Two options are available for defining the region of cells to be \n' created:\n' (1) Define the latitude and longitude extent of the region \n' to be mapped\n' (2) Specify the lower left (SW) corner of the grid to be created \n' and the number of colums and rows of cells to be created. \n'\n' Dependencies:\n'\n' Output: Shapefile with user specified name.\n'**********************************************************************\n\n\ntheview = av.getactivedoc\ndirname=av.getproject.getworkdir\n\nintypes={\"HRAP Extent\",\"Lat-lon Extent\"}\nintype=msgbox.choiceasstring(intypes,\"Which type of input will you provide?\",\"HRAP Points\")\nif (intype=nil) then\n exit \nend\n \n'--- determine the extent of interest in HRAP coordinates\nif (intype=intypes.get(1)) then 'lat-lon\n llextent=msgbox.multiinput(\"Decimal degrees (West Longitudes as negative!)\",\"Define Extent of Interest\",{\"West Most Longitude\",\"East Most Longitude\",\"Southern Most Latitude\",\"Northern Most Latitude\"},{}) \n if (llextent=nil) then\n exit\n end\n lowlat=llextent.get(2).asnumber\n highlat=llextent.get(3).asnumber\n lowlon=llextent.get(0).asnumber\n highlon=llextent.get(1).asnumber\n 'msgbox.info(lowlat.asstring++highlat.asstring++lowlon.asstring++highlon.asstring,\"\")\n if ((lowlat>highlat) or (lowlon>highlon)) then\n msgbox.error(\"Incompatible inputs.\",\"Exiting\")\n exit\n end\n 'msgbox.info(lowlat.asstring++highlat.asstring++lowlon.asstring++highlon.asstring, \"\")\n 'exit\n latlist={lowlat,lowlat,highlat,highlat}\n lonlist={lowlon,highlon,lowlon,highlon}\n '--- determine HRAP extent of interest\n i = 0\n hrapxmin=100000\n hrapymin=100000\n hrapxmax=0\n hrapymax=0\n for each lat in latlist\n lon=lonlist.get(i)\n hraplist=av.run(\"coord.lltohrap\",{lon,lat})\n hrapx=hraplist.get(0)\n hrapy=hraplist.get(1)\n 'msgbox.info(hrapx.asstring++hrapy.asstring,\"\")\n if (hrapxhrapxmax) then\n hrapxmax=hrapx\n end\n if (hrapy>hrapymax) then\n hrapymax=hrapy\n end\n i = i + 1\n end\n hrapxmax=hrapxmax.truncate\n hrapxmin=hrapxmin.truncate\n hrapymax=hrapymax.truncate\n hrapymin=hrapymin.truncate\n numcols = hrapxmax - hrapxmin + 1\n numrows = hrapymax - hrapymin + 1\n 'msgbox.info(hrapxmax.asstring++hrapymax.asstring++hrapxmin.asstring++hrapymin.asstring,\"\")\n 'exit\n \nelse\n '--- enter the lower left HRAP and the number of columns and rows\n hrapextent=msgbox.multiinput(\"HRAP Extent\",\"Define Extent of Interest\",{\"Lower Left HRAPX\",\"Lower Left HRAPY\",\"Num Columns\",\"Num Rows\"},{\"\",\"\",\"\",\"\"}) \n if (hrapextent=nil) then\n exit\n end\n hrapxmin = hrapextent.get(0).asnumber\n hrapymin = hrapextent.get(1).asnumber\n numcols = hrapextent.get(2).asnumber\n numrows = hrapextent.get(3).asnumber\n\nend\n\ncoordtypes={\"HRAP Coordinates\",\"Polar Stereographic Coor dinates\",\"Lat-lon Coordinates\"}\ncoordtype=msgbox.choiceasstring(coordtypes,\"What coordinates are desired for the output shapefile?\",\"HRAP Points\")\nif (coordtype=nil) then\n exit \nend\ndirname=av.getproject.getworkdir\noutFN=dirname.maketmp(\"theme\",\"shp\")\n'--- create a point coverage of outlets\noutfname=FileDialog.put(outFN,\"*.shp\",\"Output File Name\")\nif (outfname=nil) then\n exit\nend\n'msgbox.info(outfname,\"\")\noutFTab=ftab.makenew(outfname,Point)\nofieldlist=list.make\nidfield=field.make(\"id\",#field_long,7,0)\nhr apxfield=field.make(\"hrapx\",#field_short,4,0)\nhrapyfield=field.make(\"hrapy\",#field_short,4,0)\nlonfield=field.make(\"lon\",#field_float,9,4)\nlatfield=field.make(\"lat\",#field_float,7,4)\nofieldlist.add(idfield)\nofieldlist.add(hrapxfield)\nofieldlist.add(hrapyfield)\nofieldlist.add(latfield)\nofieldlist.add(lonfield)\noutftab.addfields(ofieldlist)\n\noshpfield=outftab.findfield(\"shape\")\nouttheme=ftheme.make(outftab)\ntheview.addtheme(outtheme)\n\nid=0\nfor each r in 0..(numrows-1)\n for each c in 0..(numcols-1)\n \n i d = id + 1\n px = hrapxmin + c + 0.5\n py = hrapymin + r + 0.5\n \n newrec=outftab.addrecord\n outftab.setvalue(idfield,newrec,id)\n outftab.setvalue(hrapxfield,newrec,px.truncate)\n outftab.setvalue(hrapyfield,newrec,py.truncate)\n lonlatlist=av.run(\"coord.hraptoll\",{px,py})\n lon=lonlatlist.get(0)\n lat=lonlatlist.get(1)\n outftab.setvalue(lonfield,newrec,lon)\n outftab.setvalue(latfield,newrec,lat)\n if (coordtype=coordtypes.get(0)) then 'if hrap output\n newpt=point.make(px,py)\n elseif (coordtype=coordtypes.get(1)) then 'if polar stereographic output\n px = (px - 401)*4762.5\n py = (py - 1601)*4762.5\n newpt=point.make(px,py)\n else 'if lon/lat output\n newpt=point.make(lon,lat)\n end\n outftab.setvalue(oshpfield,newrec,newpt)\n end \nend \n'if (coordtype=coordtypes.get(0)) then\noutftab.seteditable(false)\n\n\n" ) (Script.14 Name: "coord.hraptoll" SourceCode: "'-----------------------------------------\n' Name: coord.hraptoll\n' Purpose: Convert x,y coordinates from HRAP\n' to longitude,latitude \n' Inputs: lat\n'-----------------------------------------\n'---------------------------------\n' Define HRAP projection constants\n'---------------------------------\nstdlat = 60.asradians\nstdlon = -105\nearthr = 6371200.0\nmesh = 4762.5\nhrapxor = 401\nhrapyor = 1601\n\nhrapx=self.get(0)\nhrapy=self.get(1)\n\nx = (hrapx - hrapxor)*mesh\ny = (hrapy - hrapyor)*mesh\n \nbigr = ((x*x) + (y* y))^0.5\narg = bigr/(earthr*(1 + (stdlat.sin)))\nlat = 90.0 - (2*(arg.atan.asdegrees))\nif ((x<0) and (y<0)) then\n ang=((((y/x).atan.asdegrees)*(-1)) + 180)*(-1)\nelseif ((x<0) and (y>0)) then\n ang=((y/x).atan.asdegrees) + 180\nelse\n ang=(y/x).atan.asdegrees\nend\n'msgbox.info(x.asstring++y.asstring,\"\")\n'msgbox.info(\"ang\"++ang.asstring,\"\")\nif (y>0) then \n ang = 270.0-stdlon-ang\nelse\n ang = -90.0-stdlon-ang\nend\nif (ang < 180) then\n lon = -1 * ang\nelse\n lon = 360.0 - ang\nend\n\nreturn {lon,lat}\n" ) (Script.15 Name: "coord.hraptolltool" SourceCode: "'----------------------------------------------------------\n' Name: coord.hraptolltool\n' \n' Description: Report the latitude and longitude of a point clicked with \n' the mouse. Program assumes view units being clicked are in \n' HRAP coordinates. \n'\n' History: Created Nov 17, 1999 by Seann Reed\n'-----------------------------------------------------------\ntheView = av.GetActiveDoc\n\np = theView.GetDisplay.ReturnUserPoint\nxcoord=p.getx\nycoord=p.gety\nlllist=av.run(\"coord.hraptoll\",{xcoord,ycoord})\n \nmsgbox .info(\"Longitude:\"++lllist.get(0).asstring++\"Latitude:\"++lllist.get(1).asstring,Script.The.GetName)\n \n\n\n" ) (Script.16 Name: "coord.install" SourceCode: "'-------------------------------------------------------\n'-------------------------------------------------------\n' Name: coord.install\n'\n' Description: Install the coordinate transformation Extension. \n'\n' History: Created by Seann Reed on 11/18/1999\n'-------------------------------------------------------\n'-------------------------------------------------------\n\n\nif (av.GetProject = nil) then \n return nil\nend\nmsgbox.report(\"Special Coordinate Transformations\"+nl+\"Copyright 1999\"+nl+\"Developed by the Hydrologic Research Lab\"+nl+\"of the National Weather Service\",\"Sp-coord\")\n\n' Install menus buttons and tools in the View GUI.\n' The SELF object is the ArcView Extension\nviewGUI = av.GetProject.FindGUI( \"View\" )\n\nif (viewGUI <> nil) then \n \n ' Add menus \n viewGUI.GetMenuBar.Add( self.get(0), viewGUI.GetMenuBar.GetControls.count ) \n viewGUI.getbuttonbar.add(self.get(1), viewGUI.getbuttonbar.getcontrols.count )\n viewGUI.getbuttonbar.add(self.get(2), viewGUI.getbuttonbar.getcontrols.count )\n viewGUI.get toolbar.add( self.get(3), viewGUI.GetToolBar.GetControls.count )\n \nend\nviewGUI.setmodified(true)\n \n'' 79. /nonawips/gis/threshr/avefiles/threshr.install of 26 lines," ) (Script.17 Name: "coord.lltohrap" SourceCode: "'-----------------------------------------\n' Name: coord.lltohrap\n' Purpose: Convert coordinates from \n' longitude,latitude (radians) to\n' HRAP x,y coordinates\n' Inputs: longitude, latitude in radians\n' Returns: hrapx, hrapy\n'-----------------------------------------\n'---------------------------------\n' Define HRAP projection constants\n'---------------------------------\nstdlat = 60.asradians\nclon = 15.asradians\nearthrad = 6371.2\nsizeat60 = 4.7625\nhrapxor = 401\nhrapyor = 1601\n\nlon=self.get(0)\nlat=self.get(1) \nlon=lon.asradians\nlat=lat.asradians\n\nscalefact = (1+(stdlat.sin))/(1+(lat.sin))\nR = earthrad*(lat.cos)*scalefact\nx = R*((lon+clon).cos)\ny = R*((lon+clon).sin)\nhrapx = x/sizeat60+hrapxor\nhrapy = y/sizeat60+hrapyor\n\nreturn {hrapx,hrapy}\n" ) (Script.18 Name: "coord.lltohraptool" SourceCode: "'----------------------------------------------------------\n' Name: coord.lltohraptool\n' \n' Description: Report the HRAP coordinates of a point clicked with \n' the mouse. Program assumes view units being clicked are in \n' geographic (lon-lat) coordinates. \n'\n' History: Created Nov 17, 1999 by Seann Reed\n'-----------------------------------------------------------\ntheView = av.GetActiveDoc\n\np = theView.GetDisplay.ReturnUserPoint\nxcoord=p.getx\nycoord=p.gety\noutlist=av.run(\"coord.lltohrap\",{xcoord,ycoord })\n \nmsgbox.info(\"HRAPX:\"++outlist.get(0).asstring++\"HRAPY:\"++outlist.get(1).asstring,Script.The.GetName)\n" ) (Script.19 Name: "coord.make" SourceCode: "'-------------------------------------------------------\n'-------------------------------------------------------\n' Name: coord.make\n'\n' Description: Make the coordinate transformation extension. \n'\n' History: Created by Seann Reed on 11/18/1999\n'-------------------------------------------------------\n'-------------------------------------------------------\n' Create the extension object\n' NOTE - add dependencies to last empty list - if applicable\ntheproject=av.getproject\noutdir=theproject.getworkdir\nex tfilename=Filename.merge(outdir.asstring,\"coord.avx\")\ntheavx = Extension.Make( extfilename, \"Sp-coord\",av.FindScript(\"coord.install\"), av.FindScript(\"coord.uninstall\"), {})\n' Set other properties \n'theavx.SetProjectSaveScript( av.FindScript( \"ProjectSave\" ))\ntheavx.SetAbout(\"Special Coordinate Transformations\")\ntheavx.SetExtVersion(1)\nviewGUI=av.findGUI(\"View\")\n\n'msgbox.info(\"gothere1\",\"\")\n'--------------------------------\n'--- Add View Menus\n'-------------------------------- \nvmencontrols=viewGUI.getmenuba r.getcontrols\nfor each c in vmencontrols\n ctag=c.gettag\n if (ctag=nil) then\n continue\n end\n if (ctag=\"hrap\") then\n theavx.add(c.clone)\n end\nend\n'msgbox.info(\"gothere1\",\"\")\n\n'--------------------------------\n'--- Add View Buttons\n'-------------------------------- \nvbuttoncontrols=viewGUI.getbuttonbar.getcontrols \nfor each c in vbuttoncontrols \n ctag=c.gettag\n if (ctag=nil) then\n continue\n end\n if (ctag=\"gh\") then\n theavx.add(c.clone)\n end\n if (ctag=\"ga\") then\n theavx.add(c.c lone)\n end\nend\n\n'--------------------------------\n'--- Add View Tools\n'-------------------------------- \nvtoolcontrols=viewGUI.gettoolbar.getcontrols\nfor each t in viewGUI.gettoolbar\n if (t.Is( ToolMenu )) then \n if (t.getcontrols.get(0).gettag=\"hgtool\") then \n theavx.add(t.clone)\n end\n end\nend \n\n'--------------------------------\n'--- Add Scripts\n'--------------------------------\n\n' Note: this assumes that each script you want to include is in a SEd \n' Include all scripts with the first 5 letters \"coord.\"\nfor each d in av.GetProject.GetDocs \n if (d.Is(SEd)) then \n if (d.getname.left(5)=\"coord\") then\n theavx.Add(d.GetScript) \n end \n if (d.getname.left(4)=\"util\") then\n theavx.Add(d.GetScript) \n end \n end\nend\n\n\ntheavx.setAbout(\"Special Coordinate Transformations\")\ntheavx.setExtVersion(1)\ntheavx.commit\n\n\n'' 82. /nonawips/gis/threshr/avefiles/threshr.make of 51 lines," ) (Script.20 Name: "coord.shpgeotoalbpt" SourceCode: "'--------------------------------------------------------------\n'--------------------------------------------------------------\n' Name: coord.geotoalbpt \n' Headline: \n' Self:\n' Returns:\n' Description: Project a point shapefile from geographic coordinates \n' to an Albers equal area projection with the following parameters\"\n'\n' central meridian -96.0\n' lower standard parallel 29.5\n' upper standard parallel 45.5\n' reference latitude 23.0\n' false easting 0\n' false northing 0\n' spheroid GRS80\n' \n'--- -----------------------------------------------------------\n'--------------------------------------------------------------\ntheProject=av.GetProject\ntheView=av.GetActiveDoc\n\n'--- identify theme to be projected \nptthemelist=av.run(\"util.getthms\",{theview,false,Ftheme,\"POINT\"})\nif (ptthemelist=nil) then\n exit\nend\nintheme=msgbox.choiceasstring(ptthemelist,\"Identify Theme to project.\",\"aaa.ptgeotoalb\")\nif (intheme=nil) then\n exit \nend\n\ninftab=intheme.getftab\n'unitlist = {\"Decimal Degrees\",\"Degrees-Minutes\"}\n' inunits = msgbox.choiceasstring(unitlist,\"Select Input Units\",\"Units\") \n'---\n'define output projection\n'---\ndefaults={\"-96.0\",\"29.5\",\"45.5\",\"23.0\",\"0\",\"0\",\"#spheroid_grs80\"}\ninlist=defaults\nalbprj=albers.make(rect.makenull)\nalbprj.setcentralmeridian(inlist.get(0).asnumber)\nalbprj.setlowerstandardparallel(inlist.get(1).asnumber)\nalbprj.setupperstandardparallel(inlist.get(2).asnumber)\nalbprj.setreferencelatitude(inlist.get(3).asnumber)\nalbprj.setfalseeasting(inlist.get(4).asnumber)\nalbprj.setfalsenorthing(inl ist.get(5).asnumber)\nalbprj.setspheroid(inlist.get(6).asenum)\n \n'--- READ AND PROCESS DATA\ndirname=av.getproject.getworkdir\noutfname=dirname.maketmp(\"theme\",\"shp\")\nOutFileName=FileDialog.Put(outfname,\"*.shp\",\"Output Shape File\" )\nif(OutFileName=Nil)then\n exit\nend\nOutFileName.SetExtension(\"shp\")\nOutFTab=FTab.MakeNew(OutFileName,point)\noutFtab.SetEditable(true)\noutTheme=Ftheme.make(outftab)\n'--- copy fields from original shape file\ninfields=inftab.getfields\nnumfields=infields.count\noutfields=list.make\nfor e ach f in 1..(numfields-1)\n outfields.add(infields.get(f).clone)\nend\noutftab.addfields(outfields)\n \noutshpField=outFtab.findfield(\"shape\")\ninshpField=inftab.findfield(\"shape\")\nfor each rec in inftab\n newrec=outftab.addrecord\n p=inftab.returnvalue(inshpField,rec) \n pp=p.returnprojected(albprj)\n outFtab.Setvalue(outshpField,newrec,pp)\n for each outfield in outfields\n infield=inftab.findfield(outfield.getname)\n inval=inftab.returnvalue(infield,rec)\n outftab.setvalue(outfield,newr ec,inval)\n end \nend\ntheView.addtheme(outTheme)\noutftab.seteditable(false) \n" ) (Script.21 Name: "coord.shpgeotohrap" SourceCode: "'----------------------------------------------------------\n' Name: coord.shpgeotohrap \n'\n' Description: Projects point, polyline, or polygon \n' shapefiles from geographic coordinates to HRAP coordinates.\n' Does not support multipoint shapefiles as of Nov. 16,1999 \n'\n' Requires: Fthemes in a view in geographic coordinates.\n'----------------------------------------------------------\n\n'get the active document, which should be a view\n\ntheView=av.GetActiveDoc\n\nif (theView.Is(View).Not) then\n MsgBox.Error(\"Thi s script must be run from a view. Exiting\",\"Error\")\n return nil\nend\n\n'build a list of fthemes from the active theme list, we will project these\nthms=List.Make\nfor each t in theView.GetActiveThemes\n if (t.Is(Ftheme)) then\n thms.Add(t)\n end\nend\n\n'if no themes active let the user know and quit\n\nif (thms.Count = 0) then\n System.Beep\n MsgBox.Error(\"Please make at least one feature theme active!\",\"Error\")\n return nil\nend\n\n'check to see if we want to recalculate area, perimeter, length fields\n\n'recalc = M sgbox.YesNo(\"Recalculate area, perimeter and length fields\"++\n' \"(if present) using\"++outputunits+\"?\",Script.The.GetName,true)\n\nrecalc = true\n \n'check to see if we want to put results into a view\n \nif (MsgBox.YesNo(\"Add projected shapefile(s) as theme(s) to a view?\",\n Script.The.GetName,true)) then\n 'make a list of views\n viewlist = List.Make\n for each d in av.GetProject.GetDocs\n if (d.Is(View)) then\n viewlist.Add(d)\n end\n end 'for each d\n \n 'provide a choice for a new view\n viewlist.Add(\"\")\n \n AddToView = MsgBox.ListAsString(viewlist,\"Add Theme to:\", \n Script.The.GetName)\n \n if (AddToView <> nil) then\n if (AddToView = \"\") then\n AddToView = View.Make\n AddToView.GetWin.Open\n end\n end\nelse 'don't add to view\n AddtoView = nil\nend\n\n'step through each active theme\n\nFor each thm in thms\n \n 'get a filename for the new shapefile\n outfname=av.getproject.getworkdir.maketmp(\"theme\",\"shp\")\n outputfile = FileDialog.Put(outfname,\"*.shp\",\"Project\"++thm.getname)\n \n 'if Canceled, then skip this theme\n \n if (outputfile = nil) then\n continue\n \n end\n\n ' determine shapefile type \n \n thmftab = thm.GetFtab\n 'make a copy of the ftab and then replace each of the shape records\n outFTab = thmFtab.Export(outfname, Shape, false)\n outshapef=outftab.findfield(\"shape\")\n outftab.seteditable(true)\n if (thmftab.getshapeclass.getclassname=\"POINT\") then\n '--- this is where the projection actually occurs \n for each rec in outFtab\n p = outftab.returnvalue(outshapef,rec)\n hraplist=av.run(\"coord.lltohrap\",{p.getx,p.gety})\n 'msgbox.info(p.getx.asstring++p.gety.asstring++hraplist.get(0).asstring++hraplist.get(1).asstring,\"\")\n newp = Point.Make(hraplist.get(0),hraplist.get(1))\n outftab.setvalue(outshapef,rec,newp) \n end \n elseif (thmftab.getshapeclass.getclassname=\"POLYLINE\") then\n for each rec in outFtab\n pl = outftab.returnvalue(outs hapef,rec)\n pllist = pl.aslist\n 'newpllist=list.make\n for each plist in pllist\n 'newplist=list.make\n pcount=0\n for each p in plist\n hraplist=av.run(\"coord.lltohrap\",{p.getx,p.gety})\n newp = Point.Make(hraplist.get(0),hraplist.get(1))\n plist.set(pcount,newp)\n pcount=pcount+1\n end\n 'newpllist.add(newplist)\n end\n newpl=polyline.make(pllist)\n outftab.setvalue(outshapef,rec,newpl )\n end\n elseif (thmftab.getshapeclass.getclassname=\"POLYGON\") then\n for each rec in outFtab\n ply = outftab.returnvalue(outshapef,rec)\n pl = ply.aspolyline\n pllist = pl.aslist\n 'newpllist=list.make\n for each plist in pllist\n 'newplist=list.make\n pcount=0\n for each p in plist\n hraplist=av.run(\"coord.lltohrap\",{p.getx,p.gety})\n newp = Point.Make(hraplist.get(0),hraplist.get(1))\n plist.set(pcount,newp)\n pcount=pcount+1\n end\n 'newpllist.add(newplist)\n end\n newply=polygon.make(pllist)\n outftab.setvalue(outshapef,rec,newply)\n end\n else\n msgbox.info(\"Sorry! Projection of\"++thmftab.getshapeclass.getclassname++\"not supported.\",Script.The.GetName)\n exit\n end\n \n 'recalculate area, perim, length fields if asked to\n \n 'if (recalc) then\n' \n' 'find the fields we need to recalculate\n' newareafield = newftab.Findfield(\"Area\")\n' newperimfie ld = newftab.Findfield(\"Perimeter\")\n' newlengthfield = newftab.Findfield(\"Length\")\n' \n' newftab.SetEditable(True)\n' if (shapetype = #FIELD_SHAPEPOLY) then\n' if (newareafield <> nil) then\n' newftab.Calculate(\"[Shape].ReturnArea\",newareafield)\n' end\n' if (newperimfield <> nil) then\n' newftab.Calculate(\"[Shape].ReturnLength\",newperimfield)\n' end\n' elseif (shapetype = #FIELD_SHAPELINE) then\n' if (newlengthfield <> nil) then\n' newftab.Calculate(\"[Shape ].ReturnLength\",newlengthfield)\n' end\n' end\n' newftab.SetEditable(false)\n' end 'if recalc\n \n if (addtoView <> nil) then\n 'create a theme and add it to the specifiedView\n newthm=Ftheme.make(outftab)\n AddToView.AddTheme(newthm)\n 'put this theme in the same order as it was in the original view\n 'newplace = AddtoView.GetThemes.Count\n 'AddToView.GetThemes.Shuffle(newthm,newplace)\n end\n outftab.seteditable(false)\n \nend 'for each thm\n\nif (addtoView <> nil) then\n \n 'brin g the View to the front\n\n AddToView.InvalidateTOC(nil)\n AddToView.GetWin.Activate\nend\n" ) (Script.22 Name: "coord.uninstall" SourceCode: "'-------------------------------------------------------\n'-------------------------------------------------------\n' Name: coord.uninstall\n'\n' Description: Uninstall the special coordinate transformation \n' extension. \n'\n' History: Created by Seann Reed on 11/18/1999\n'-------------------------------------------------------\n'-------------------------------------------------------\n' Don't uninstall if there is no project\nif (av.GetProject = nil) then \n return nil\nend\n' Clean up even if the project is clo sing\n' don't uninstall extension objects if project is closing\nif (av.GetProject.IsClosing) then \n return nil\nend\n' Remove objects owned by the extension from the project\nviewGUI=av.FindGUI(\"View\")\nif(viewGUI<>nil) then\n viewGUI.GetMenuBar.Remove(self.get(0))\n viewGUI.GetbuttonBar.Remove(self.get(1))\n viewGUI.GetbuttonBar.Remove(self.get(2))\n viewGUI.GetToolBar.Remove(self.get(3))\nend\n\n" ) (Script.23 Name: "util.getthms" SourceCode: "'*****************************************\n' Name: Basin.GetThms, Active or All.\n' Headline: \n' Self: {TheView,ThmAct,ThmType,ShpType}\n' ThmAct=True, for active thms, False, all thms.\n' ThmType=[FTheme,GTheme,DbTheme]\n' ShpType=[Poly,Line,Point,Mpoint]\n' Returns: \n' Description: Get Thms of specified type. \n' Topics:\n' Search Keys:\n' Requires:\n' History: 4/1/97\n'*****************************************\nTheView=SELF.Get(0)\nThmAct=SELF.Get(1) 'Active/ALL, Boolean.\nThmType=SELF.Get(2) 'GTheme,FTheme or o thers.\nInfoTitle=\"Theme Identification\"\nIsFThm=False\nThmTypeName=ThmType.GetClassName\nif(ThmTypeName=\"FTheme\")then\n ShpType=SELF.Get(3) \n IsFThm=True\n if(ShpType=\"POLY\")then\n ShpTypeEnum=\"#FIELD_SHAPEPOLY\".AsEnum\n elseif(ShpType=\"LINE\")then\n ShpTypeEnum=\"#FIELD_SHAPELINE\".AsEnum\n elseif(ShpType=\"POINT\")then\n ShptypeEnum=\"#FIELD_SHAPEPOINT\".AsEnum \n elseif(ShpType=\"MPOINT\")then\n ShpTypeEnum=\"#FIELD_SHAPEMULTIPOINT\".AsEnum \n else \n msgbox.info(\"Use POLY,LINE,POINT or MPOINT as 3rd ar gument\",InfoTitle)\n return nil \n end \nend\nif(ThmAct)then\n TheThms=TheView.GetActiveThemes\nelse \n TheThms=TheView.GetThemes\nend \nif(theThms.Count=0)then\n msgbox.info(\"No active themes found in the view:\"++TheView.GetName,InfoTitle)\n return nil\nend\nThmList=List.Make\nfor each Thm in TheThms\n if(Thm.Is(ThmType))then\n if(IsFthm)then 'for an FTheme, further chk its shape type\n FType=Thm.GetFtab.FindField(\"Shape\").GetType\n if(FType=ShpTypeEnum)then\n ThmList.Add(Thm)\n end \n else\n ThmList.Add(Thm)\n end \n end\nend \nif(ThmList.Count=0)then\n if(ThmAct)then\n msgbox.info(\"No Active\"++ThmTypeName++\"theme is found in the view:\"++TheView.GetName,InfoTitle)\n else\n msgbox.info(\"No\"++ThmTypeName++\"is found in the view:\"++TheView.GetName,InfoTitle)\n end\n return nil\nelse\n return ThmList 'Normal return\nend\n" )