Programming tools and code
Embedded Systems

Geographic Information Systems (GIS)

- ShapeVoronoi. A small tool for the Win32 command
line to generate a Voronoi Diagram for a given ESRI® Shapefile. The program
is invoked by shpvoronoi [-v|-debug|-sf percent] input.shp output.shp.
Where
- -v only prints the version number of shpvoronoi and then exits,
- -debug prints additional information during the process,
- -sf percent specifies a "frame". By default, the Voronoi Diagram will not extend over the bounding box edges of the original shape file, which might not be
desirable for you. You can therefore specify how much bigger you want the Voronoi Diagram than the Shapefile, e.g. by specifying "50" you would make the
dimensions of the Voronoi Diagram 50% larger than its corresponding shapefile.
Sources are included in the ZIP-File. I merely plugged together a variety of modules. Credits go to:
- A little utility to patch the Language Driver ID (LDID) byte in dBase files. I manipulated the data in MS Access® and exported the tables as dBase files, to import them in ERSI® ArcView 3.2a. Unfortunately, Access doesn't set the LDID byte when exporting to dBase. So ArcView thinks this is the system's default codepage and messes up the special characters (like ä, ö, etc.). While you can configure ArcView to handle files in a certain directory as having a different codepage (see ESRI Canada for details, and check the help file), I wanted to manipulate the dBase files directly, since I had to use the files on many different machines (I was doing teaching in school, so I had to distribute those files to all my students) and didn't want to configure all those ArcView installations. Therefore I wrote this nice little tool which will patch the LDID byte. The ZIP-Archive comes with a Win32 command line executable, the source code in ANSI C and a short manual how to use the executable. The programm can handle wildcards (i.e. *.dbf) and is therefore nice for batch processing.
- A colorizer for photometric images. This command-line tool reads a grayscale image and a CSV file which includes color definitions for certain grayscale range values and produces a RGB GeoTiff image. In ArcView 3.2a (which I use), you can only color raster data if you have the Spatial Analyst Extension. So if you want to produce some topographical maps, you have to put another dollar in -- or use my tool.
It uses Frank Warmerdam's GDAL API and can therefore handle a wide range of input image file formats like GeoTiff, JPEG 2000, etc. Just check the GDAL homepage to see a list of supported formats. For output formats, only GeoTiff is supported, since GDAL doesn't support multi rasterbands for all formats. The Geo-Information in the files will be copied 1:1 by my tool.
The ZIP-File comes with the Win32 executable (incl. the necessary Dll's) and a sample CSV file, plus a short description. You might want to alter the color values. I used the provided sample colors to colorize the SRTM raster files for Central Europe, and they looked nice. For areas with higher elevations, you might want to try some different colors.
The Source ZIP contains the C++ source code files. It comes with a project file for MS Visual C++ 6. Since I use ANSI C++, the source files should compile on any platform with the appropriate compiler. The GDAL API is not included, use the link above to download it. Includes Chris Losinger's C++ class to parse command line arguments.
- A PERL-Skript to reverse engineer ESRI's ArcView 3.x AVX-Extensions. It takes the name of an AVX-File on the command-line and looks for scripts in it (no extraction of Icon-Data and the like at this point), extracts them and writes them to single files as AVE-Scripts. Call with perl avx2ave.pl myext.avx. DISCLAIMER: This script is for educational purposes only. Does not work on encrypted Avenue scripts! No responsibilty is assumed for damage done to your software. I do not encourage copyright infringements, so use the script only on Extensions that are Open Source, etc. ! This script is still in an alpha stage and needs more testing, so please report any bugs.
More to come ... (last update Nov 25, 2006)