/**************************************************************************** * CITYDECODER: A SPLAT! File Conversion Utility * * Copyright John A. Magliacane, KD2BD 2002 * * Last update: 13-Apr-2002 * ***************************************************************************** * * * This utility reads ASCII Metadata Cartographic Boundary Files available * * through the U.S. Census Bureau, and generates a lists of cities, states, * * and counties along with the latitude and longitude corresponding to their * * geographic centers. Such data may be (optionally) sorted and written to * * files for use with SPLAT! software. This utility takes as an argument, * * two-letter prefix plus the FIPS code for the state being processed (ie: * * "citydecoder pl34" will read files "pl34_d00.dat" and "pl34_d00a.dat", * * and produce a list of city names and geographical coordinates for the * * state of New Jersey. * * * ***************************************************************************** * * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License or any later * * version. * * * * This program is distributed in the hope that it will useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * * for more details. * * * ***************************************************************************** * To compile: gcc -Wall -O6 -s citydecoder.c -o citydecoder * *****************************************************************************/ #include #include #include int main(argc,argv) char argc, *argv[]; { int x, y, z; long attributefile_id, coordinatefile_id; char string[80], name[80], attributefilename[15], coordinatefilename[15]; double lat, lon; FILE *attributefile=NULL, *coordinatefile=NULL; if (argc==1) { fprintf(stderr,"\n*** Usage: citydecoder pl34 pl36 pl42 | sort > outputfile\n\n"); exit(1); } for (z=1; z