HW3 Flat File : Altplaces Documentation
Contents:
When you attempt to obtain a forecast, you will often use either the place name or a zip code. Once you enter this information, HAMweather 3 must then look this information up in a database so that it can properly determine what weather data to retrieve, search and process for the location you selected. The Altplace database is the core central database used in HW3 for obtaining this information. This database contains information on the city name, the actual weather zone, ICAO station to use for current conditions, FIPS, latitude and longitude of location and much more. Also the exact usage of the data may very slightly between different countries.
The altplace databases are used for both US and international locations. The individual altplace files must be stored in the a directory called 'altplaces' with in the countries subdirectory in the hw3dbs directory.
For example, the US altplace files are stored in the location:
hw3dbs/us/altplaces
and the Canadian altplace files are stored in the location:
hw3dbs/ca/altplaces
Altplace File Naming Convention:
The altplace databases for each country should be broken down into separate files based on the state/province, using the file name format:
xx-yy-altplaces.txt
where xx is the country two letter abbreviation in lowercase and yy is the state/province two letter abbreviation in lowercase.
An actual altplace file name for the US state of Virginia would look like:
us-va-altplaces.txt
And the altplace file name for Ontario, Canada would look like:
ca-on-altplaces.txt
Note: For countries that do not have states/provinces you can substitute the two letter country abbreviation in lowercase for the two letter state abrreviation. For example, for Italy you could use the file name:
it-it-altplaces.txt
Each line in the altplace file is a separate entry which contains the data for a location. An example entry may look like (This is the entry for Blacksburg, VA in the us-va-altplaces.txt altplace file):
Blacksburg|VAZ014:2|KBCB:2%KPSK:3|VAZ014|51121|RNK|24060|37.22944|-80.41417|2080|EST|-5|KFCX
The above lines gives the location name, weather forecast zone, ICAO to use for current conditions, county warning area, latitude/logitude, elevation and more.
You will notice that the actual data elements in the line are separated by a pipe ("|"). The data elements in each altplace entry are defined as follows:
RequestedPlace|ZoneEntry|CurrentConditionEntry|WxZone|FIPS|CWA|SingleZipcode|Latitude|Longitude|Elevation|TimeZoneName|TimeZoneHour|RadarICAO
| Data Field | Description | |||||||||||||||||||||||
| RequestedPlace | The name of the location (city,place,county) that the current entry/line
in the altplace file provides information for.
NOTE: This is compared to what the actual user types in for the "place". Thus, if a user may type in a location name a couple different ways then you can duplicate the entry in the altplace file with only the RequestedPlace being changed to match the alternate spelling the user may us. |
|||||||||||||||||||||||
| ZoneEntry | Determines what data is used and how displayed for the zone forecast.
The ZoneEntry can be broken down further. It may look similar to:
Where ZoneItem is either a place name, weather zone or ICAO. The ZoneCode defines what the ZoneItem is for HW3 and how it should be used. This code is used to determine how the ZoneEntry is applied. It can be a number from 0 to 5.
How the ZoneItem:ZoneCode combinations are used by HW3: ZoneCode = 0 or 1 (US and Canada Only) When ZoneCode = 0 or 1 then this tells HW3 that the ZoneItem is a place name. Note that this usage is only available for the US and Canada, and the ZoneItem (place name) is handled slightly different for both the US and Canada.
When ZoneCode = 2 or 3 then this tells HW3 that the ZoneItem is a Weather zone code. Note that this usage is only available for the US. This method is the most accurate method for finding zone forecasts for US locations, thus both the freeware and HWdb Update Service databases use this method.
ZoneCode = 4 or 5 (International)
|
|||||||||||||||||||||||
| CurrentConditionEntry |
Determines what data is used and how displayed for the current conditions.
The CurrentConditionEntrycan be broken down further. It may look similar to:
Where CurrentConditionItem is either a place name, weather zone or ICAO. The CurrentConditionCode defines what the CurrentConditionItem is for HW3 and how it should be used. This code is used to determine how the CurrentConditionEntry is applied. It can be a number from 0 to 5.
How the CurrentConditionItem:CurrentConditionCode combinations are used by HW3: CurrentConditionCode = 0 or 1: (US Only)
CurrentConditionCode = 2 or 3: (International, including US)
Multiple CurrentConditionEntries:
|
|||||||||||||||||||||||
| WxZone | (US Only) The actual Weather zone the location is located in. | |||||||||||||||||||||||
| FIPS | (US Only) The five digit State/County FIPS number the location is located in. | |||||||||||||||||||||||
| CWA | (US Only) County Warning Area | |||||||||||||||||||||||
| SingleZipcode | A Single zipcode that is located with in the Requested Place.
NOTE: Many locations have multiple zipcodes, this is simply of the many for a location. The Zipcode databases actually have all the zipcodes for a location. |
|||||||||||||||||||||||
| Latitude | The Latitude in decimal where the Requested place is located. | |||||||||||||||||||||||
| Longitude | The Longitude in decimal where the Requested Place is located. | |||||||||||||||||||||||
| Elevation | The Elevation in feet of the Requested Place. | |||||||||||||||||||||||
| TimeZoneName | The Time Zone Name/Abbreviation for the location. (should be the non Daylight savings time name. Thus EST for the eastern part of US) | |||||||||||||||||||||||
| TimeZoneHour | The time zone hour difference from GMT. | |||||||||||||||||||||||
| RadarICAO | (US & Canada only) The ICAO station name to use for the closest Nexrad Radar. |
Custom Altplace Files: (As of HW3 Beta 2)
Often you may want to add new locations that may be searched to your altplace files. But for many who subscribe to the HWdb Update Service you would rather not make updates to the HWdb databases only to have to redo your changes upon the next HWdb Update release of the database. To get around this, HW3 allows you to create custom altplace files for your moodifications that go into a subdirectory of the altplaces directory called "custom". These custom altplace files must follow the same naming conventions as normal altplace files. Also the data entries must be the same as well.
Thus if you wanted to add a custom entry for say "Cambria, VA" which is a name for an area with in Christiansburg, VA then you would create a file named "us-va-altplaces.txt" and place it in the directory hw3dbs/us/altplaces/custom. Thus the complete file path would be:
hw3dbs/us/altplaces/custom/us-va-altplaces.txt
Again the data entries with in this custom db follow the same rules as the normal altplaces files. As in our example with Cambria Virginia, it was stated that Cambria is the name given to an area within Christiansburg, Va, thus we know its going to have the same forecast information as Christionasburg so we can simply copy the Christiansburg altplace entry:
Christiansburg|VAZ014:2|KBCB:3%KPSK:3|VAZ014|51121|RNK|24073|37.12972|-80.40917|2100|EST|-5|KFCX
and put this in our custom altplace file, but change the Christiansburg to Cambria, thus giving:
Cambria|VAZ014:2|KBCB:3%KPSK:3|VAZ014|51121|RNK|24073|37.12972|-80.40917|2100|EST|-5|KFCX
Now users can type in "Cambria, VA" and the appropriate forecast will display. And you are free to update your core Altplace files as needed with out bothering your custom databases.